Section 1
//HMAC (com.hurlant.crypto.hash.HMAC)
package com.hurlant.crypto.hash {
import flash.utils.*;
public class HMAC {
private var bits:uint;
private var hash:IHash;
public function HMAC(_arg1:IHash, _arg2:uint=0){
this.hash = _arg1;
this.bits = _arg2;
}
public function getHashSize():uint{
if (bits != 0){
return ((bits / 8));
};
return (hash.getHashSize());
}
public function dispose():void{
hash = null;
bits = 0;
}
public function compute(_arg1:ByteArray, _arg2:ByteArray):ByteArray{
var _local3:ByteArray;
var _local4:ByteArray;
var _local5:ByteArray;
var _local6:uint;
var _local7:ByteArray;
var _local8:ByteArray;
if (_arg1.length > hash.getInputSize()){
_local3 = hash.hash(_arg1);
} else {
_local3 = new ByteArray();
_local3.writeBytes(_arg1);
};
while (_local3.length < hash.getInputSize()) {
_local3[_local3.length] = 0;
};
_local4 = new ByteArray();
_local5 = new ByteArray();
_local6 = 0;
while (_local6 < _local3.length) {
_local4[_local6] = (_local3[_local6] ^ 54);
_local5[_local6] = (_local3[_local6] ^ 92);
_local6++;
};
_local4.position = _local3.length;
_local4.writeBytes(_arg2);
_local7 = hash.hash(_local4);
_local5.position = _local3.length;
_local5.writeBytes(_local7);
_local8 = hash.hash(_local5);
if ((((bits > 0)) && ((bits < (8 * _local8.length))))){
_local8.length = (bits / 8);
};
return (_local8);
}
public function toString():String{
return ((("hmac-" + ((bits > 0)) ? (bits + "-") : "") + hash.toString()));
}
}
}//package com.hurlant.crypto.hash
Section 2
//IHash (com.hurlant.crypto.hash.IHash)
package com.hurlant.crypto.hash {
import flash.utils.*;
public interface IHash {
function toString():String;
function getHashSize():uint;
function getInputSize():uint;
function hash(_arg1:ByteArray):ByteArray;
}
}//package com.hurlant.crypto.hash
Section 3
//MD2 (com.hurlant.crypto.hash.MD2)
package com.hurlant.crypto.hash {
import flash.utils.*;
public class MD2 implements IHash {
public static const HASH_SIZE:int = 16;
private static const S:Array = [41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, 39, 53, 62, 204, 231, 191, 247, 151, 3, 0xFF, 25, 48, 179, 72, 165, 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, 31, 26, 219, 153, 141, 51, 159, 17, 131, 20];
public function getHashSize():uint{
return (HASH_SIZE);
}
public function toString():String{
return ("md2");
}
public function getInputSize():uint{
return (16);
}
public function hash(_arg1:ByteArray):ByteArray{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:ByteArray;
var _local6:uint;
var _local7:ByteArray;
var _local8:uint;
var _local9:uint;
var _local10:uint;
_local2 = _arg1.length;
_local3 = (((16 - (_arg1.length % 16))) || (16));
do {
_arg1[_arg1.length] = _local3;
} while ((_arg1.length % 16) != 0);
_local4 = _arg1.length;
_local5 = new ByteArray();
_local6 = 0;
_local3 = 0;
while (_local3 < _local4) {
_local8 = 0;
while (_local8 < 16) {
_local6 = (_local5[_local8] = (_local5[_local8] ^ S[(_arg1[(_local3 + _local8)] ^ _local6)]));
_local8++;
};
_local3 = (_local3 + 16);
};
_arg1.position = _arg1.length;
_arg1.writeBytes(_local5);
_local4 = (_local4 + 16);
_local7 = new ByteArray();
_local3 = 0;
while (_local3 < _local4) {
_local8 = 0;
while (_local8 < 16) {
_local7[(32 + _local8)] = ((_local7[(16 + _local8)] = _arg1[(_local3 + _local8)]) ^ _local7[_local8]);
_local8++;
};
_local9 = 0;
_local8 = 0;
while (_local8 < 18) {
_local10 = 0;
while (_local10 < 48) {
_local9 = (_local7[_local10] ^ S[_local9]);
_local7[_local10] = _local9;
_local10++;
};
_local9 = ((_local9 + _local8) & 0xFF);
_local8++;
};
_local3 = (_local3 + 16);
};
_local7.length = 16;
_arg1.length = _local2;
return (_local7);
}
}
}//package com.hurlant.crypto.hash
Section 4
//MD5 (com.hurlant.crypto.hash.MD5)
package com.hurlant.crypto.hash {
import flash.utils.*;
public class MD5 implements IHash {
public static const HASH_SIZE:int = 16;
private function ff(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint, _arg7:uint):uint{
return (cmn(((_arg2 & _arg3) | (~(_arg2) & _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
private function hh(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint, _arg7:uint):uint{
return (cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
private function cmn(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint):uint{
return ((rol((((_arg2 + _arg1) + _arg4) + _arg6), _arg5) + _arg3));
}
public function getHashSize():uint{
return (HASH_SIZE);
}
private function ii(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint, _arg7:uint):uint{
return (cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
private function rol(_arg1:uint, _arg2:uint):uint{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public function toString():String{
return ("md5");
}
public function getInputSize():uint{
return (64);
}
private function gg(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:uint, _arg7:uint):uint{
return (cmn(((_arg2 & _arg4) | (_arg3 & ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public function hash(_arg1:ByteArray):ByteArray{
var _local2:uint;
var _local3:String;
var _local4:Array;
var _local5:uint;
var _local6:Array;
var _local7:ByteArray;
_local2 = (_arg1.length * 8);
_local3 = _arg1.endian;
while ((_arg1.length % 4) != 0) {
_arg1[_arg1.length] = 0;
};
_arg1.position = 0;
_local4 = [];
_arg1.endian = Endian.LITTLE_ENDIAN;
_local5 = 0;
while (_local5 < _arg1.length) {
_local4.push(_arg1.readUnsignedInt());
_local5 = (_local5 + 4);
};
_local6 = core_md5(_local4, _local2);
_local7 = new ByteArray();
_local7.endian = Endian.LITTLE_ENDIAN;
_local5 = 0;
while (_local5 < 4) {
_local7.writeUnsignedInt(_local6[_local5]);
_local5++;
};
_arg1.length = (_local2 / 8);
_arg1.endian = _local3;
return (_local7);
}
private function core_md5(_arg1:Array, _arg2:uint):Array{
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (_arg2 % 32)));
_arg1[((((_arg2 + 64) >>> 9) << 4) + 14)] = _arg2;
_local3 = 1732584193;
_local4 = 4023233417;
_local5 = 2562383102;
_local6 = 271733878;
_local7 = 0;
while (_local7 < _arg1.length) {
_arg1[_local7] = ((_arg1[_local7]) || (0));
_arg1[(_local7 + 1)] = ((_arg1[(_local7 + 1)]) || (0));
_arg1[(_local7 + 2)] = ((_arg1[(_local7 + 2)]) || (0));
_arg1[(_local7 + 3)] = ((_arg1[(_local7 + 3)]) || (0));
_arg1[(_local7 + 4)] = ((_arg1[(_local7 + 4)]) || (0));
_arg1[(_local7 + 5)] = ((_arg1[(_local7 + 5)]) || (0));
_arg1[(_local7 + 6)] = ((_arg1[(_local7 + 6)]) || (0));
_arg1[(_local7 + 7)] = ((_arg1[(_local7 + 7)]) || (0));
_arg1[(_local7 + 8)] = ((_arg1[(_local7 + 8)]) || (0));
_arg1[(_local7 + 9)] = ((_arg1[(_local7 + 9)]) || (0));
_arg1[(_local7 + 10)] = ((_arg1[(_local7 + 10)]) || (0));
_arg1[(_local7 + 11)] = ((_arg1[(_local7 + 11)]) || (0));
_arg1[(_local7 + 12)] = ((_arg1[(_local7 + 12)]) || (0));
_arg1[(_local7 + 13)] = ((_arg1[(_local7 + 13)]) || (0));
_arg1[(_local7 + 14)] = ((_arg1[(_local7 + 14)]) || (0));
_arg1[(_local7 + 15)] = ((_arg1[(_local7 + 15)]) || (0));
_local8 = _local3;
_local9 = _local4;
_local10 = _local5;
_local11 = _local6;
_local3 = ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 7, 3614090360);
_local6 = ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 1)], 12, 3905402710);
_local5 = ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 17, 606105819);
_local4 = ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 3)], 22, 3250441966);
_local3 = ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 7, 4118548399);
_local6 = ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 5)], 12, 1200080426);
_local5 = ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 17, 2821735955);
_local4 = ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 7)], 22, 4249261313);
_local3 = ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 7, 1770035416);
_local6 = ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 9)], 12, 2336552879);
_local5 = ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 17, 4294925233);
_local4 = ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 11)], 22, 2304563134);
_local3 = ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 7, 1804603682);
_local6 = ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 13)], 12, 4254626195);
_local5 = ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 17, 2792965006);
_local4 = ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 15)], 22, 1236535329);
_local3 = gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 5, 4129170786);
_local6 = gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 6)], 9, 3225465664);
_local5 = gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 14, 643717713);
_local4 = gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 0)], 20, 3921069994);
_local3 = gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 5, 3593408605);
_local6 = gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 10)], 9, 38016083);
_local5 = gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 14, 3634488961);
_local4 = gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 4)], 20, 3889429448);
_local3 = gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 5, 568446438);
_local6 = gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 14)], 9, 3275163606);
_local5 = gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 14, 4107603335);
_local4 = gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 8)], 20, 1163531501);
_local3 = gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 5, 2850285829);
_local6 = gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 2)], 9, 4243563512);
_local5 = gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 14, 1735328473);
_local4 = gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 12)], 20, 2368359562);
_local3 = hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 4, 4294588738);
_local6 = hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 8)], 11, 2272392833);
_local5 = hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 16, 1839030562);
_local4 = hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 14)], 23, 4259657740);
_local3 = hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 4, 2763975236);
_local6 = hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 4)], 11, 1272893353);
_local5 = hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 16, 4139469664);
_local4 = hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 10)], 23, 3200236656);
_local3 = hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 4, 681279174);
_local6 = hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 0)], 11, 3936430074);
_local5 = hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 16, 3572445317);
_local4 = hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 6)], 23, 76029189);
_local3 = hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 4, 3654602809);
_local6 = hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 12)], 11, 3873151461);
_local5 = hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 16, 530742520);
_local4 = hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 2)], 23, 3299628645);
_local3 = ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 6, 4096336452);
_local6 = ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 7)], 10, 1126891415);
_local5 = ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 15, 2878612391);
_local4 = ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 5)], 21, 4237533241);
_local3 = ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 6, 1700485571);
_local6 = ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 3)], 10, 2399980690);
_local5 = ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 15, 4293915773);
_local4 = ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 1)], 21, 2240044497);
_local3 = ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 6, 1873313359);
_local6 = ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 15)], 10, 4264355552);
_local5 = ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 15, 2734768916);
_local4 = ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 13)], 21, 1309151649);
_local3 = ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 6, 4149444226);
_local6 = ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 11)], 10, 3174756917);
_local5 = ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 15, 718787259);
_local4 = ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 9)], 21, 3951481745);
_local3 = (_local3 + _local8);
_local4 = (_local4 + _local9);
_local5 = (_local5 + _local10);
_local6 = (_local6 + _local11);
_local7 = (_local7 + 16);
};
return ([_local3, _local4, _local5, _local6]);
}
}
}//package com.hurlant.crypto.hash
Section 5
//SHA1 (com.hurlant.crypto.hash.SHA1)
package com.hurlant.crypto.hash {
public class SHA1 extends SHABase implements IHash {
public static const HASH_SIZE:int = 20;
private function ft(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint):uint{
if (_arg1 < 20){
return (((_arg2 & _arg3) | (~(_arg2) & _arg4)));
};
if (_arg1 < 40){
return (((_arg2 ^ _arg3) ^ _arg4));
};
if (_arg1 < 60){
return ((((_arg2 & _arg3) | (_arg2 & _arg4)) | (_arg3 & _arg4)));
};
return (((_arg2 ^ _arg3) ^ _arg4));
}
private function kt(_arg1:uint):uint{
return (((_arg1)<20) ? 1518500249 : ((_arg1)<40) ? 1859775393 : ((_arg1)<60) ? 2400959708 : 3395469782);
}
override public function toString():String{
return ("sha1");
}
override public function getHashSize():uint{
return (HASH_SIZE);
}
private function rol(_arg1:uint, _arg2:uint):uint{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
override protected function core(_arg1:Array, _arg2:uint):Array{
var _local3:Array;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local16:uint;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (24 - (_arg2 % 32))));
_arg1[((((_arg2 + 64) >> 9) << 4) + 15)] = _arg2;
_local3 = [];
_local4 = 1732584193;
_local5 = 4023233417;
_local6 = 2562383102;
_local7 = 271733878;
_local8 = 3285377520;
_local9 = 0;
while (_local9 < _arg1.length) {
_local10 = _local4;
_local11 = _local5;
_local12 = _local6;
_local13 = _local7;
_local14 = _local8;
_local15 = 0;
while (_local15 < 80) {
if (_local15 < 16){
_local3[_local15] = ((_arg1[(_local9 + _local15)]) || (0));
} else {
_local3[_local15] = rol((((_local3[(_local15 - 3)] ^ _local3[(_local15 - 8)]) ^ _local3[(_local15 - 14)]) ^ _local3[(_local15 - 16)]), 1);
};
_local16 = ((((rol(_local4, 5) + ft(_local15, _local5, _local6, _local7)) + _local8) + _local3[_local15]) + kt(_local15));
_local8 = _local7;
_local7 = _local6;
_local6 = rol(_local5, 30);
_local5 = _local4;
_local4 = _local16;
_local15++;
};
_local4 = (_local4 + _local10);
_local5 = (_local5 + _local11);
_local6 = (_local6 + _local12);
_local7 = (_local7 + _local13);
_local8 = (_local8 + _local14);
_local9 = (_local9 + 16);
};
return ([_local4, _local5, _local6, _local7, _local8]);
}
}
}//package com.hurlant.crypto.hash
Section 6
//SHA224 (com.hurlant.crypto.hash.SHA224)
package com.hurlant.crypto.hash {
public class SHA224 extends SHA256 {
public function SHA224(){
h = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428];
}
override public function getHashSize():uint{
return (28);
}
override public function toString():String{
return ("sha224");
}
}
}//package com.hurlant.crypto.hash
Section 7
//SHA256 (com.hurlant.crypto.hash.SHA256)
package com.hurlant.crypto.hash {
public class SHA256 extends SHABase implements IHash {
protected var h:Array;
protected static const k:Array = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298];
public function SHA256(){
h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225];
super();
}
protected function rrol(_arg1:uint, _arg2:uint):uint{
return (((_arg1 << (32 - _arg2)) | (_arg1 >>> _arg2)));
}
override public function toString():String{
return ("sha256");
}
override public function getHashSize():uint{
return (32);
}
override protected function core(_arg1:Array, _arg2:uint):Array{
var _local3:Array;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local16:uint;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:uint;
var _local21:uint;
var _local22:uint;
var _local23:uint;
var _local24:uint;
var _local25:uint;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (24 - (_arg2 % 32))));
_arg1[((((_arg2 + 64) >> 9) << 4) + 15)] = _arg2;
_local3 = [];
_local4 = h[0];
_local5 = h[1];
_local6 = h[2];
_local7 = h[3];
_local8 = h[4];
_local9 = h[5];
_local10 = h[6];
_local11 = h[7];
_local12 = 0;
while (_local12 < _arg1.length) {
_local13 = _local4;
_local14 = _local5;
_local15 = _local6;
_local16 = _local7;
_local17 = _local8;
_local18 = _local9;
_local19 = _local10;
_local20 = _local11;
_local21 = 0;
while (_local21 < 64) {
if (_local21 < 16){
_local3[_local21] = ((_arg1[(_local12 + _local21)]) || (0));
} else {
_local24 = ((rrol(_local3[(_local21 - 15)], 7) ^ rrol(_local3[(_local21 - 15)], 18)) ^ (_local3[(_local21 - 15)] >>> 3));
_local25 = ((rrol(_local3[(_local21 - 2)], 17) ^ rrol(_local3[(_local21 - 2)], 19)) ^ (_local3[(_local21 - 2)] >>> 10));
_local3[_local21] = (((_local3[(_local21 - 16)] + _local24) + _local3[(_local21 - 7)]) + _local25);
};
_local22 = (((rrol(_local4, 2) ^ rrol(_local4, 13)) ^ rrol(_local4, 22)) + (((_local4 & _local5) ^ (_local4 & _local6)) ^ (_local5 & _local6)));
_local23 = ((((_local11 + ((rrol(_local8, 6) ^ rrol(_local8, 11)) ^ rrol(_local8, 25))) + ((_local8 & _local9) ^ (_local10 & ~(_local8)))) + k[_local21]) + _local3[_local21]);
_local11 = _local10;
_local10 = _local9;
_local9 = _local8;
_local8 = (_local7 + _local23);
_local7 = _local6;
_local6 = _local5;
_local5 = _local4;
_local4 = (_local23 + _local22);
_local21++;
};
_local4 = (_local4 + _local13);
_local5 = (_local5 + _local14);
_local6 = (_local6 + _local15);
_local7 = (_local7 + _local16);
_local8 = (_local8 + _local17);
_local9 = (_local9 + _local18);
_local10 = (_local10 + _local19);
_local11 = (_local11 + _local20);
_local12 = (_local12 + 16);
};
return ([_local4, _local5, _local6, _local7, _local8, _local9, _local10, _local11]);
}
}
}//package com.hurlant.crypto.hash
Section 8
//SHABase (com.hurlant.crypto.hash.SHABase)
package com.hurlant.crypto.hash {
import flash.utils.*;
public class SHABase implements IHash {
public function getHashSize():uint{
return (0);
}
public function toString():String{
return ("sha");
}
public function getInputSize():uint{
return (64);
}
public function hash(_arg1:ByteArray):ByteArray{
var _local2:uint;
var _local3:String;
var _local4:uint;
var _local5:Array;
var _local6:uint;
var _local7:Array;
var _local8:ByteArray;
var _local9:uint;
_local2 = _arg1.length;
_local3 = _arg1.endian;
_arg1.endian = Endian.BIG_ENDIAN;
_local4 = (_local2 * 8);
while ((_arg1.length % 4) != 0) {
_arg1[_arg1.length] = 0;
};
_arg1.position = 0;
_local5 = [];
_local6 = 0;
while (_local6 < _arg1.length) {
_local5.push(_arg1.readUnsignedInt());
_local6 = (_local6 + 4);
};
_local7 = core(_local5, _local4);
_local8 = new ByteArray();
_local9 = (getHashSize() / 4);
_local6 = 0;
while (_local6 < _local9) {
_local8.writeUnsignedInt(_local7[_local6]);
_local6++;
};
_arg1.length = _local2;
_arg1.endian = _local3;
return (_local8);
}
protected function core(_arg1:Array, _arg2:uint):Array{
return (null);
}
}
}//package com.hurlant.crypto.hash
Section 9
//ARC4 (com.hurlant.crypto.prng.ARC4)
package com.hurlant.crypto.prng {
import flash.utils.*;
import com.hurlant.crypto.symmetric.*;
import com.hurlant.util.*;
public class ARC4 implements IPRNG, IStreamCipher {
private const psize:uint = 0x0100;
private var S:ByteArray;
private var i:int;// = 0
private var j:int;// = 0
public function ARC4(_arg1:ByteArray=null){
i = 0;
j = 0;
super();
S = new ByteArray();
if (_arg1){
init(_arg1);
};
}
public function decrypt(_arg1:ByteArray):void{
encrypt(_arg1);
}
public function init(_arg1:ByteArray):void{
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = 0;
while (_local2 < 0x0100) {
S[_local2] = _local2;
_local2++;
};
_local3 = 0;
_local2 = 0;
while (_local2 < 0x0100) {
_local3 = (((_local3 + S[_local2]) + _arg1[(_local2 % _arg1.length)]) & 0xFF);
_local4 = S[_local2];
S[_local2] = S[_local3];
S[_local3] = _local4;
_local2++;
};
this.i = 0;
this.j = 0;
}
public function dispose():void{
var _local1:uint;
_local1 = 0;
if (S != null){
_local1 = 0;
while (_local1 < S.length) {
S[_local1] = (Math.random() * 0x0100);
_local1++;
};
S.length = 0;
S = null;
};
this.i = 0;
this.j = 0;
Memory.gc();
}
public function encrypt(_arg1:ByteArray):void{
var _local2:uint;
_local2 = 0;
while (_local2 < _arg1.length) {
var _temp1 = _local2;
_local2 = (_local2 + 1);
var _local3 = _temp1;
_arg1[_local3] = (_arg1[_local3] ^ next());
};
}
public function next():uint{
var _local1:int;
i = ((i + 1) & 0xFF);
j = ((j + S[i]) & 0xFF);
_local1 = S[i];
S[i] = S[j];
S[j] = _local1;
return (S[((_local1 + S[i]) & 0xFF)]);
}
public function getBlockSize():uint{
return (1);
}
public function getPoolSize():uint{
return (psize);
}
public function toString():String{
return ("rc4");
}
}
}//package com.hurlant.crypto.prng
Section 10
//IPRNG (com.hurlant.crypto.prng.IPRNG)
package com.hurlant.crypto.prng {
import flash.utils.*;
public interface IPRNG {
function init(_arg1:ByteArray):void;
function next():uint;
function dispose():void;
function getPoolSize():uint;
function toString():String;
}
}//package com.hurlant.crypto.prng
Section 11
//Random (com.hurlant.crypto.prng.Random)
package com.hurlant.crypto.prng {
import flash.utils.*;
import flash.text.*;
import com.hurlant.util.*;
import flash.system.*;
public class Random {
private var psize:int;
private var ready:Boolean;// = false
private var seeded:Boolean;// = false
private var state:IPRNG;
private var pool:ByteArray;
private var pptr:int;
public function Random(_arg1:Class=null){
var _local2:uint;
ready = false;
seeded = false;
super();
if (_arg1 == null){
_arg1 = ARC4;
};
state = (new (_arg1) as IPRNG);
psize = state.getPoolSize();
pool = new ByteArray();
pptr = 0;
while (pptr < psize) {
_local2 = (65536 * Math.random());
var _local3 = pptr++;
pool[_local3] = (_local2 >>> 8);
var _local4 = pptr++;
pool[_local4] = (_local2 & 0xFF);
};
pptr = 0;
seed();
}
public function seed(_arg1:int=0):void{
if (_arg1 == 0){
_arg1 = new Date().getTime();
};
var _local2 = pptr++;
pool[_local2] = (pool[_local2] ^ (_arg1 & 0xFF));
var _local3 = pptr++;
pool[_local3] = (pool[_local3] ^ ((_arg1 >> 8) & 0xFF));
var _local4 = pptr++;
pool[_local4] = (pool[_local4] ^ ((_arg1 >> 16) & 0xFF));
var _local5 = pptr++;
pool[_local5] = (pool[_local5] ^ ((_arg1 >> 24) & 0xFF));
pptr = (pptr % psize);
seeded = true;
}
public function toString():String{
return (("random-" + state.toString()));
}
public function dispose():void{
var _local1:uint;
_local1 = 0;
while (_local1 < pool.length) {
pool[_local1] = (Math.random() * 0x0100);
_local1++;
};
pool.length = 0;
pool = null;
state.dispose();
state = null;
psize = 0;
pptr = 0;
Memory.gc();
}
public function autoSeed():void{
var _local1:ByteArray;
var _local2:Array;
var _local3:Font;
_local1 = new ByteArray();
_local1.writeUnsignedInt(System.totalMemory);
_local1.writeUTF(Capabilities.serverString);
_local1.writeUnsignedInt(getTimer());
_local1.writeUnsignedInt(new Date().getTime());
_local2 = Font.enumerateFonts(true);
for each (_local3 in _local2) {
_local1.writeUTF(_local3.fontName);
_local1.writeUTF(_local3.fontStyle);
_local1.writeUTF(_local3.fontType);
};
_local1.position = 0;
while (_local1.bytesAvailable >= 4) {
seed(_local1.readUnsignedInt());
};
}
public function nextByte():int{
if (!ready){
if (!seeded){
autoSeed();
};
state.init(pool);
pool.length = 0;
pptr = 0;
ready = true;
};
return (state.next());
}
public function nextBytes(_arg1:ByteArray, _arg2:int):void{
while (_arg2--) {
_arg1.writeByte(nextByte());
};
}
}
}//package com.hurlant.crypto.prng
Section 12
//RSAKey (com.hurlant.crypto.rsa.RSAKey)
package com.hurlant.crypto.rsa {
import flash.utils.*;
import com.hurlant.math.*;
import com.hurlant.crypto.prng.*;
import com.hurlant.util.*;
public class RSAKey {
public var dmp1:BigInteger;
protected var canDecrypt:Boolean;
public var d:BigInteger;
public var e:int;
public var dmq1:BigInteger;
public var n:BigInteger;
public var p:BigInteger;
public var q:BigInteger;
protected var canEncrypt:Boolean;
public var coeff:BigInteger;
public function RSAKey(_arg1:BigInteger, _arg2:int, _arg3:BigInteger=null, _arg4:BigInteger=null, _arg5:BigInteger=null, _arg6:BigInteger=null, _arg7:BigInteger=null, _arg8:BigInteger=null){
this.n = _arg1;
this.e = _arg2;
this.d = _arg3;
this.p = _arg4;
this.q = _arg5;
this.dmp1 = _arg6;
this.dmq1 = _arg7;
this.coeff = _arg8;
canEncrypt = ((!((n == null))) && (!((e == 0))));
canDecrypt = ((canEncrypt) && (!((d == null))));
}
public function verify(_arg1:ByteArray, _arg2:ByteArray, _arg3:uint, _arg4:Function=null):void{
_decrypt(doPublic, _arg1, _arg2, _arg3, _arg4, 1);
}
public function dump():String{
var _local1:String;
_local1 = ((((("N=" + n.toString(16)) + "\n") + "E=") + e.toString(16)) + "\n");
if (canDecrypt){
_local1 = (_local1 + (("D=" + d.toString(16)) + "\n"));
if (((!((p == null))) && (!((q == null))))){
_local1 = (_local1 + (("P=" + p.toString(16)) + "\n"));
_local1 = (_local1 + (("Q=" + q.toString(16)) + "\n"));
_local1 = (_local1 + (("DMP1=" + dmp1.toString(16)) + "\n"));
_local1 = (_local1 + (("DMQ1=" + dmq1.toString(16)) + "\n"));
_local1 = (_local1 + (("IQMP=" + coeff.toString(16)) + "\n"));
};
};
return (_local1);
}
protected function doPrivate2(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
var _local3:BigInteger;
var _local4:BigInteger;
if ((((p == null)) && ((q == null)))){
return (_arg1.modPow(d, n));
};
_local2 = _arg1.mod(p).modPow(dmp1, p);
_local3 = _arg1.mod(q).modPow(dmq1, q);
while (_local2.compareTo(_local3) < 0) {
_local2 = _local2.add(p);
};
_local4 = _local2.subtract(_local3).multiply(coeff).mod(p).multiply(q).add(_local3);
return (_local4);
}
public function decrypt(_arg1:ByteArray, _arg2:ByteArray, _arg3:uint, _arg4:Function=null):void{
_decrypt(doPrivate2, _arg1, _arg2, _arg3, _arg4, 2);
}
private function _decrypt(_arg1:Function, _arg2:ByteArray, _arg3:ByteArray, _arg4:uint, _arg5:Function, _arg6:int):void{
var _local7:uint;
var _local8:int;
var _local9:BigInteger;
var _local10:BigInteger;
var _local11:ByteArray;
if (_arg5 == null){
_arg5 = pkcs1unpad;
};
if (_arg2.position >= _arg2.length){
_arg2.position = 0;
};
_local7 = getBlockSize();
_local8 = (_arg2.position + _arg4);
while (_arg2.position < _local8) {
_local9 = new BigInteger(_arg2, _arg4);
_local10 = _arg1(_local9);
_local11 = _arg5(_local10, _local7);
_arg3.writeBytes(_local11);
};
}
protected function doPublic(_arg1:BigInteger):BigInteger{
return (_arg1.modPowInt(e, n));
}
public function dispose():void{
e = 0;
n.dispose();
n = null;
Memory.gc();
}
private function _encrypt(_arg1:Function, _arg2:ByteArray, _arg3:ByteArray, _arg4:uint, _arg5:Function, _arg6:int):void{
var _local7:uint;
var _local8:int;
var _local9:BigInteger;
var _local10:BigInteger;
if (_arg5 == null){
_arg5 = pkcs1pad;
};
if (_arg2.position >= _arg2.length){
_arg2.position = 0;
};
_local7 = getBlockSize();
_local8 = (_arg2.position + _arg4);
while (_arg2.position < _local8) {
_local9 = new BigInteger(_arg5(_arg2, _local8, _local7, _arg6), _local7);
_local10 = _arg1(_local9);
_local10.toArray(_arg3);
};
}
private function rawpad(_arg1:ByteArray, _arg2:int, _arg3:uint):ByteArray{
return (_arg1);
}
public function encrypt(_arg1:ByteArray, _arg2:ByteArray, _arg3:uint, _arg4:Function=null):void{
_encrypt(doPublic, _arg1, _arg2, _arg3, _arg4, 2);
}
private function pkcs1pad(_arg1:ByteArray, _arg2:int, _arg3:uint, _arg4:uint=2):ByteArray{
var _local5:ByteArray;
var _local6:uint;
var _local7:int;
var _local8:Random;
var _local9:int;
_local5 = new ByteArray();
_local6 = _arg1.position;
_arg2 = Math.min(_arg2, _arg1.length, ((_local6 + _arg3) - 11));
_arg1.position = _arg2;
_local7 = (_arg2 - 1);
while ((((_local7 >= _local6)) && ((_arg3 > 11)))) {
--_arg3;
var _local10 = _arg3;
var _temp1 = _local7;
_local7 = (_local7 - 1);
_local5[_local10] = _arg1[_temp1];
};
--_arg3;
_local10 = _arg3;
_local5[_local10] = 0;
_local8 = new Random();
while (_arg3 > 2) {
_local9 = 0;
while (_local9 == 0) {
_local9 = ((_arg4)==2) ? _local8.nextByte() : 0xFF;
};
--_arg3;
var _local11 = _arg3;
_local5[_local11] = _local9;
};
--_arg3;
_local11 = _arg3;
_local5[_local11] = _arg4;
--_arg3;
var _local12 = _arg3;
_local5[_local12] = 0;
return (_local5);
}
private function pkcs1unpad(_arg1:BigInteger, _arg2:uint, _arg3:uint=2):ByteArray{
var _local4:ByteArray;
var _local5:ByteArray;
var _local6:int;
_local4 = _arg1.toByteArray();
_local5 = new ByteArray();
_local6 = 0;
while ((((_local6 < _local4.length)) && ((_local4[_local6] == 0)))) {
_local6++;
};
if (((!(((_local4.length - _local6) == (_arg2 - 1)))) || ((_local4[_local6] > 2)))){
trace(((("PKCS#1 unpad: i=" + _local6) + ", expected b[i]==[0,1,2], got b[i]=") + _local4[_local6].toString(16)));
return (null);
};
_local6++;
while (_local4[_local6] != 0) {
++_local6;
if (_local6 >= _local4.length){
trace((((("PKCS#1 unpad: i=" + _local6) + ", b[i-1]!=0 (=") + _local4[(_local6 - 1)].toString(16)) + ")"));
return (null);
};
};
while (++_local6 < _local4.length) {
_local5.writeByte(_local4[_local6]);
};
_local5.position = 0;
return (_local5);
}
public function getBlockSize():uint{
return (((n.bitLength() + 7) / 8));
}
public function toString():String{
return ("rsa");
}
public function sign(_arg1:ByteArray, _arg2:ByteArray, _arg3:uint, _arg4:Function=null):void{
_encrypt(doPrivate2, _arg1, _arg2, _arg3, _arg4, 1);
}
protected function doPrivate(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
var _local3:BigInteger;
if ((((p == null)) || ((q == null)))){
return (_arg1.modPow(d, n));
};
_local2 = _arg1.mod(p).modPow(dmp1, p);
_local3 = _arg1.mod(q).modPow(dmq1, q);
while (_local2.compareTo(_local3) < 0) {
_local2 = _local2.add(p);
};
return (_local2.subtract(_local3).multiply(coeff).mod(p).multiply(q).add(_local3));
}
protected static function bigRandom(_arg1:int, _arg2:Random):BigInteger{
var _local3:ByteArray;
var _local4:BigInteger;
if (_arg1 < 2){
return (BigInteger.nbv(1));
};
_local3 = new ByteArray();
_arg2.nextBytes(_local3, (_arg1 >> 3));
_local3.position = 0;
_local4 = new BigInteger(_local3);
_local4.primify(_arg1, 1);
return (_local4);
}
public static function parsePublicKey(_arg1:String, _arg2:String):RSAKey{
return (new RSAKey(new BigInteger(_arg1, 16), parseInt(_arg2, 16)));
}
public static function generate(_arg1:uint, _arg2:String):RSAKey{
var _local3:Random;
var _local4:uint;
var _local5:RSAKey;
var _local6:BigInteger;
var _local7:BigInteger;
var _local8:BigInteger;
var _local9:BigInteger;
var _local10:BigInteger;
_local3 = new Random();
_local4 = (_arg1 >> 1);
_local5 = new RSAKey(null, 0, null);
_local5.e = parseInt(_arg2, 16);
_local6 = new BigInteger(_arg2, 16);
while (true) {
while (true) {
_local5.p = bigRandom((_arg1 - _local4), _local3);
if ((((_local5.p.subtract(BigInteger.ONE).gcd(_local6).compareTo(BigInteger.ONE) == 0)) && (_local5.p.isProbablePrime(10)))){
break;
};
};
while (true) {
_local5.q = bigRandom(_local4, _local3);
if ((((_local5.q.subtract(BigInteger.ONE).gcd(_local6).compareTo(BigInteger.ONE) == 0)) && (_local5.q.isProbablePrime(10)))){
break;
};
};
if (_local5.p.compareTo(_local5.q) <= 0){
_local10 = _local5.p;
_local5.p = _local5.q;
_local5.q = _local10;
};
_local7 = _local5.p.subtract(BigInteger.ONE);
_local8 = _local5.q.subtract(BigInteger.ONE);
_local9 = _local7.multiply(_local8);
if (_local9.gcd(_local6).compareTo(BigInteger.ONE) == 0){
_local5.n = _local5.p.multiply(_local5.q);
_local5.d = _local6.modInverse(_local9);
_local5.dmp1 = _local5.d.mod(_local7);
_local5.dmq1 = _local5.d.mod(_local8);
_local5.coeff = _local5.q.modInverse(_local5.p);
break;
};
};
return (_local5);
}
public static function parsePrivateKey(_arg1:String, _arg2:String, _arg3:String, _arg4:String=null, _arg5:String=null, _arg6:String=null, _arg7:String=null, _arg8:String=null):RSAKey{
if (_arg4 == null){
return (new RSAKey(new BigInteger(_arg1, 16), parseInt(_arg2, 16), new BigInteger(_arg3, 16)));
};
return (new RSAKey(new BigInteger(_arg1, 16), parseInt(_arg2, 16), new BigInteger(_arg3, 16), new BigInteger(_arg4, 16), new BigInteger(_arg5, 16), new BigInteger(_arg6, 16), new BigInteger(_arg7), new BigInteger(_arg8)));
}
}
}//package com.hurlant.crypto.rsa
Section 13
//AESKey (com.hurlant.crypto.symmetric.AESKey)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.crypto.prng.*;
import com.hurlant.util.*;
public class AESKey implements ISymmetricKey {
private var state:ByteArray;
private var tmp:ByteArray;
private var Nr:uint;
private var keyLength:uint;
private var key:ByteArray;
private static const _Xtime2:Array = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 27, 25, 31, 29, 19, 17, 23, 21, 11, 9, 15, 13, 3, 1, 7, 5, 59, 57, 63, 61, 51, 49, 55, 53, 43, 41, 47, 45, 35, 33, 39, 37, 91, 89, 95, 93, 83, 81, 87, 85, 75, 73, 79, 77, 67, 65, 71, 69, 123, 121, 127, 125, 115, 113, 119, 117, 107, 105, 111, 109, 99, 97, 103, 101, 155, 153, 159, 157, 147, 145, 151, 149, 139, 137, 143, 141, 131, 129, 135, 133, 187, 185, 191, 189, 179, 177, 183, 181, 171, 169, 175, 173, 163, 161, 167, 165, 219, 217, 223, 221, 211, 209, 215, 213, 203, 201, 207, 205, 195, 193, 199, 197, 251, 249, 0xFF, 253, 243, 241, 247, 245, 235, 233, 239, 237, 227, 225, 231, 229];
private static const _Xtime9:Array = [0, 9, 18, 27, 36, 45, 54, 63, 72, 65, 90, 83, 108, 101, 126, 119, 144, 153, 130, 139, 180, 189, 166, 175, 216, 209, 202, 195, 252, 245, 238, 231, 59, 50, 41, 32, 31, 22, 13, 4, 115, 122, 97, 104, 87, 94, 69, 76, 171, 162, 185, 176, 143, 134, 157, 148, 227, 234, 241, 248, 199, 206, 213, 220, 118, 127, 100, 109, 82, 91, 64, 73, 62, 55, 44, 37, 26, 19, 8, 1, 230, 239, 244, 253, 194, 203, 208, 217, 174, 167, 188, 181, 138, 131, 152, 145, 77, 68, 95, 86, 105, 96, 123, 114, 5, 12, 23, 30, 33, 40, 51, 58, 221, 212, 207, 198, 249, 240, 235, 226, 149, 156, 135, 142, 177, 184, 163, 170, 236, 229, 254, 247, 200, 193, 218, 211, 164, 173, 182, 191, 128, 137, 146, 155, 124, 117, 110, 103, 88, 81, 74, 67, 52, 61, 38, 47, 16, 25, 2, 11, 215, 222, 197, 204, 243, 250, 225, 232, 159, 150, 141, 132, 187, 178, 169, 160, 71, 78, 85, 92, 99, 106, 113, 120, 15, 6, 29, 20, 43, 34, 57, 48, 154, 147, 136, 129, 190, 183, 172, 165, 210, 219, 192, 201, 246, 0xFF, 228, 237, 10, 3, 24, 17, 46, 39, 60, 53, 66, 75, 80, 89, 102, 111, 116, 125, 161, 168, 179, 186, 133, 140, 151, 158, 233, 224, 251, 242, 205, 196, 223, 214, 49, 56, 35, 42, 21, 28, 7, 14, 121, 112, 107, 98, 93, 84, 79, 70];
private static const Nb:uint = 4;
private static const _XtimeB:Array = [0, 11, 22, 29, 44, 39, 58, 49, 88, 83, 78, 69, 116, 127, 98, 105, 176, 187, 166, 173, 156, 151, 138, 129, 232, 227, 254, 245, 196, 207, 210, 217, 123, 112, 109, 102, 87, 92, 65, 74, 35, 40, 53, 62, 15, 4, 25, 18, 203, 192, 221, 214, 231, 236, 241, 250, 147, 152, 133, 142, 191, 180, 169, 162, 246, 253, 224, 235, 218, 209, 204, 199, 174, 165, 184, 179, 130, 137, 148, 159, 70, 77, 80, 91, 106, 97, 124, 119, 30, 21, 8, 3, 50, 57, 36, 47, 141, 134, 155, 144, 161, 170, 183, 188, 213, 222, 195, 200, 249, 242, 239, 228, 61, 54, 43, 32, 17, 26, 7, 12, 101, 110, 115, 120, 73, 66, 95, 84, 247, 252, 225, 234, 219, 208, 205, 198, 175, 164, 185, 178, 131, 136, 149, 158, 71, 76, 81, 90, 107, 96, 125, 118, 31, 20, 9, 2, 51, 56, 37, 46, 140, 135, 154, 145, 160, 171, 182, 189, 212, 223, 194, 201, 248, 243, 238, 229, 60, 55, 42, 33, 16, 27, 6, 13, 100, 111, 114, 121, 72, 67, 94, 85, 1, 10, 23, 28, 45, 38, 59, 48, 89, 82, 79, 68, 117, 126, 99, 104, 177, 186, 167, 172, 157, 150, 139, 128, 233, 226, 0xFF, 244, 197, 206, 211, 216, 122, 113, 108, 103, 86, 93, 64, 75, 34, 41, 52, 63, 14, 5, 24, 19, 202, 193, 220, 215, 230, 237, 240, 251, 146, 153, 132, 143, 190, 181, 168, 163];
private static const _XtimeE:Array = [0, 14, 28, 18, 56, 54, 36, 42, 112, 126, 108, 98, 72, 70, 84, 90, 224, 238, 252, 242, 216, 214, 196, 202, 144, 158, 140, 130, 168, 166, 180, 186, 219, 213, 199, 201, 227, 237, 0xFF, 241, 171, 165, 183, 185, 147, 157, 143, 129, 59, 53, 39, 41, 3, 13, 31, 17, 75, 69, 87, 89, 115, 125, 111, 97, 173, 163, 177, 191, 149, 155, 137, 135, 221, 211, 193, 207, 229, 235, 249, 247, 77, 67, 81, 95, 117, 123, 105, 103, 61, 51, 33, 47, 5, 11, 25, 23, 118, 120, 106, 100, 78, 64, 82, 92, 6, 8, 26, 20, 62, 48, 34, 44, 150, 152, 138, 132, 174, 160, 178, 188, 230, 232, 250, 244, 222, 208, 194, 204, 65, 79, 93, 83, 121, 119, 101, 107, 49, 63, 45, 35, 9, 7, 21, 27, 161, 175, 189, 179, 153, 151, 133, 139, 209, 223, 205, 195, 233, 231, 245, 251, 154, 148, 134, 136, 162, 172, 190, 176, 234, 228, 246, 248, 210, 220, 206, 192, 122, 116, 102, 104, 66, 76, 94, 80, 10, 4, 22, 24, 50, 60, 46, 32, 236, 226, 240, 254, 212, 218, 200, 198, 156, 146, 128, 142, 164, 170, 184, 182, 12, 2, 16, 30, 52, 58, 40, 38, 124, 114, 96, 110, 68, 74, 88, 86, 55, 57, 43, 37, 15, 1, 19, 29, 71, 73, 91, 85, 127, 113, 99, 109, 215, 217, 203, 197, 239, 225, 243, 253, 167, 169, 187, 181, 159, 145, 131, 141];
private static const _Xtime2Sbox:Array = [198, 248, 238, 246, 0xFF, 214, 222, 145, 96, 2, 206, 86, 231, 181, 77, 236, 143, 31, 137, 250, 239, 178, 142, 251, 65, 179, 95, 69, 35, 83, 228, 155, 117, 225, 61, 76, 108, 126, 245, 131, 104, 81, 209, 249, 226, 171, 98, 42, 8, 149, 70, 157, 48, 55, 10, 47, 14, 36, 27, 223, 205, 78, 127, 234, 18, 29, 88, 52, 54, 220, 180, 91, 164, 118, 183, 125, 82, 221, 94, 19, 166, 185, 0, 193, 64, 227, 121, 182, 212, 141, 103, 114, 148, 152, 176, 133, 187, 197, 79, 237, 134, 154, 102, 17, 138, 233, 4, 254, 160, 120, 37, 75, 162, 93, 128, 5, 63, 33, 112, 241, 99, 119, 175, 66, 32, 229, 253, 191, 129, 24, 38, 195, 190, 53, 136, 46, 147, 85, 252, 122, 200, 186, 50, 230, 192, 25, 158, 163, 68, 84, 59, 11, 140, 199, 107, 40, 167, 188, 22, 173, 219, 100, 116, 20, 146, 12, 72, 184, 159, 189, 67, 196, 57, 49, 211, 242, 213, 139, 110, 218, 1, 177, 156, 73, 216, 172, 243, 207, 202, 244, 71, 16, 111, 240, 74, 92, 56, 87, 115, 151, 203, 161, 232, 62, 150, 97, 13, 15, 224, 124, 113, 204, 144, 6, 247, 28, 194, 106, 174, 105, 23, 153, 58, 39, 217, 235, 43, 34, 210, 169, 7, 51, 45, 60, 21, 201, 135, 170, 80, 165, 3, 89, 9, 26, 101, 215, 132, 208, 130, 41, 90, 30, 123, 168, 109, 44];
private static const _Xtime3Sbox:Array = [165, 132, 153, 141, 13, 189, 177, 84, 80, 3, 169, 125, 25, 98, 230, 154, 69, 157, 64, 135, 21, 235, 201, 11, 236, 103, 253, 234, 191, 247, 150, 91, 194, 28, 174, 106, 90, 65, 2, 79, 92, 244, 52, 8, 147, 115, 83, 63, 12, 82, 101, 94, 40, 161, 15, 181, 9, 54, 155, 61, 38, 105, 205, 159, 27, 158, 116, 46, 45, 178, 238, 251, 246, 77, 97, 206, 123, 62, 113, 151, 245, 104, 0, 44, 96, 31, 200, 237, 190, 70, 217, 75, 222, 212, 232, 74, 107, 42, 229, 22, 197, 215, 85, 148, 207, 16, 6, 129, 240, 68, 186, 227, 243, 254, 192, 138, 173, 188, 72, 4, 223, 193, 117, 99, 48, 26, 14, 109, 76, 20, 53, 47, 225, 162, 204, 57, 87, 242, 130, 71, 172, 231, 43, 149, 160, 152, 209, 127, 102, 126, 171, 131, 202, 41, 211, 60, 121, 226, 29, 118, 59, 86, 78, 30, 219, 10, 108, 228, 93, 110, 239, 166, 168, 164, 55, 139, 50, 67, 89, 183, 140, 100, 210, 224, 180, 250, 7, 37, 175, 142, 233, 24, 213, 136, 111, 114, 36, 241, 199, 81, 35, 124, 156, 33, 221, 220, 134, 133, 144, 66, 196, 170, 216, 5, 1, 18, 163, 95, 249, 208, 145, 88, 39, 185, 56, 19, 179, 51, 187, 112, 137, 167, 182, 34, 146, 32, 73, 0xFF, 120, 122, 143, 248, 128, 23, 218, 49, 198, 184, 195, 176, 119, 17, 203, 252, 214, 58];
private static const _InvSbox:Array = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 0xFF, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125];
private static const _XtimeD:Array = [0, 13, 26, 23, 52, 57, 46, 35, 104, 101, 114, 127, 92, 81, 70, 75, 208, 221, 202, 199, 228, 233, 254, 243, 184, 181, 162, 175, 140, 129, 150, 155, 187, 182, 161, 172, 143, 130, 149, 152, 211, 222, 201, 196, 231, 234, 253, 240, 107, 102, 113, 124, 95, 82, 69, 72, 3, 14, 25, 20, 55, 58, 45, 32, 109, 96, 119, 122, 89, 84, 67, 78, 5, 8, 31, 18, 49, 60, 43, 38, 189, 176, 167, 170, 137, 132, 147, 158, 213, 216, 207, 194, 225, 236, 251, 246, 214, 219, 204, 193, 226, 239, 248, 245, 190, 179, 164, 169, 138, 135, 144, 157, 6, 11, 28, 17, 50, 63, 40, 37, 110, 99, 116, 121, 90, 87, 64, 77, 218, 215, 192, 205, 238, 227, 244, 249, 178, 191, 168, 165, 134, 139, 156, 145, 10, 7, 16, 29, 62, 51, 36, 41, 98, 111, 120, 117, 86, 91, 76, 65, 97, 108, 123, 118, 85, 88, 79, 66, 9, 4, 19, 30, 61, 48, 39, 42, 177, 188, 171, 166, 133, 136, 159, 146, 217, 212, 195, 206, 237, 224, 247, 250, 183, 186, 173, 160, 131, 142, 153, 148, 223, 210, 197, 200, 235, 230, 241, 252, 103, 106, 125, 112, 83, 94, 73, 68, 15, 2, 21, 24, 59, 54, 33, 44, 12, 1, 22, 27, 56, 53, 34, 47, 100, 105, 126, 115, 80, 93, 74, 71, 220, 209, 198, 203, 232, 229, 242, 0xFF, 180, 185, 174, 163, 128, 141, 154, 151];
private static const _Sbox:Array = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 0xFF, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22];
private static var XtimeE:ByteArray = new ByteArray();
private static var i:uint = 0;
private static var Xtime2Sbox:ByteArray = new ByteArray();
private static var Xtime3Sbox:ByteArray = new ByteArray();
private static var _Rcon:Array = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54];
private static var Sbox:ByteArray = new ByteArray();
private static var Rcon:ByteArray = new ByteArray();
private static var InvSbox:ByteArray = new ByteArray();
private static var Xtime2:ByteArray = new ByteArray();
private static var Xtime9:ByteArray = new ByteArray();
private static var XtimeB:ByteArray = new ByteArray();
private static var XtimeD:ByteArray = new ByteArray();
public function AESKey(_arg1:ByteArray){
tmp = new ByteArray();
state = new ByteArray();
keyLength = _arg1.length;
this.key = new ByteArray();
this.key.writeBytes(_arg1);
expandKey();
}
public function toString():String{
return (("aes" + (8 * keyLength)));
}
public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{
var _local3:uint;
state.position = 0;
state.writeBytes(_arg1, _arg2, (Nb * 4));
addRoundKey(key, ((Nr * Nb) * 4));
invShiftRows();
_local3 = Nr;
while (_local3--) {
addRoundKey(key, ((_local3 * Nb) * 4));
if (_local3){
invMixSubColumns();
};
};
_arg1.position = _arg2;
_arg1.writeBytes(state);
}
protected function invShiftRows():void{
var _local1:uint;
state[0] = InvSbox[state[0]];
state[4] = InvSbox[state[4]];
state[8] = InvSbox[state[8]];
state[12] = InvSbox[state[12]];
_local1 = InvSbox[state[13]];
state[13] = InvSbox[state[9]];
state[9] = InvSbox[state[5]];
state[5] = InvSbox[state[1]];
state[1] = _local1;
_local1 = InvSbox[state[2]];
state[2] = InvSbox[state[10]];
state[10] = _local1;
_local1 = InvSbox[state[6]];
state[6] = InvSbox[state[14]];
state[14] = _local1;
_local1 = InvSbox[state[3]];
state[3] = InvSbox[state[7]];
state[7] = InvSbox[state[11]];
state[11] = InvSbox[state[15]];
state[15] = _local1;
}
public function dispose():void{
var _local1:uint;
var _local2:Random;
_local2 = new Random();
_local1 = 0;
while (_local1 < key.length) {
key[_local1] = _local2.nextByte();
_local1++;
};
Nr = _local2.nextByte();
_local1 = 0;
while (_local1 < state.length) {
state[_local1] = _local2.nextByte();
_local1++;
};
_local1 = 0;
while (_local1 < tmp.length) {
tmp[_local1] = _local2.nextByte();
_local1++;
};
key.length = 0;
keyLength = 0;
state.length = 0;
tmp.length = 0;
key = null;
state = null;
tmp = null;
Nr = 0;
Memory.gc();
}
protected function invMixSubColumns():void{
var _local1:uint;
tmp.length = 0;
tmp[0] = (((XtimeE[state[0]] ^ XtimeB[state[1]]) ^ XtimeD[state[2]]) ^ Xtime9[state[3]]);
tmp[5] = (((Xtime9[state[0]] ^ XtimeE[state[1]]) ^ XtimeB[state[2]]) ^ XtimeD[state[3]]);
tmp[10] = (((XtimeD[state[0]] ^ Xtime9[state[1]]) ^ XtimeE[state[2]]) ^ XtimeB[state[3]]);
tmp[15] = (((XtimeB[state[0]] ^ XtimeD[state[1]]) ^ Xtime9[state[2]]) ^ XtimeE[state[3]]);
tmp[4] = (((XtimeE[state[4]] ^ XtimeB[state[5]]) ^ XtimeD[state[6]]) ^ Xtime9[state[7]]);
tmp[9] = (((Xtime9[state[4]] ^ XtimeE[state[5]]) ^ XtimeB[state[6]]) ^ XtimeD[state[7]]);
tmp[14] = (((XtimeD[state[4]] ^ Xtime9[state[5]]) ^ XtimeE[state[6]]) ^ XtimeB[state[7]]);
tmp[3] = (((XtimeB[state[4]] ^ XtimeD[state[5]]) ^ Xtime9[state[6]]) ^ XtimeE[state[7]]);
tmp[8] = (((XtimeE[state[8]] ^ XtimeB[state[9]]) ^ XtimeD[state[10]]) ^ Xtime9[state[11]]);
tmp[13] = (((Xtime9[state[8]] ^ XtimeE[state[9]]) ^ XtimeB[state[10]]) ^ XtimeD[state[11]]);
tmp[2] = (((XtimeD[state[8]] ^ Xtime9[state[9]]) ^ XtimeE[state[10]]) ^ XtimeB[state[11]]);
tmp[7] = (((XtimeB[state[8]] ^ XtimeD[state[9]]) ^ Xtime9[state[10]]) ^ XtimeE[state[11]]);
tmp[12] = (((XtimeE[state[12]] ^ XtimeB[state[13]]) ^ XtimeD[state[14]]) ^ Xtime9[state[15]]);
tmp[1] = (((Xtime9[state[12]] ^ XtimeE[state[13]]) ^ XtimeB[state[14]]) ^ XtimeD[state[15]]);
tmp[6] = (((XtimeD[state[12]] ^ Xtime9[state[13]]) ^ XtimeE[state[14]]) ^ XtimeB[state[15]]);
tmp[11] = (((XtimeB[state[12]] ^ XtimeD[state[13]]) ^ Xtime9[state[14]]) ^ XtimeE[state[15]]);
_local1 = 0;
while (_local1 < (4 * Nb)) {
state[_local1] = InvSbox[tmp[_local1]];
_local1++;
};
}
private function expandKey():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local7 = (key.length / 4);
Nr = (_local7 + 6);
_local6 = _local7;
while (_local6 < (Nb * (Nr + 1))) {
_local1 = key[((4 * _local6) - 4)];
_local2 = key[((4 * _local6) - 3)];
_local3 = key[((4 * _local6) - 2)];
_local4 = key[((4 * _local6) - 1)];
if (!(_local6 % _local7)){
_local5 = _local4;
_local4 = Sbox[_local1];
_local1 = (Sbox[_local2] ^ Rcon[(_local6 / _local7)]);
_local2 = Sbox[_local3];
_local3 = Sbox[_local5];
} else {
if ((((_local7 > 6)) && (((_local6 % _local7) == 4)))){
_local1 = Sbox[_local1];
_local2 = Sbox[_local2];
_local3 = Sbox[_local3];
_local4 = Sbox[_local4];
};
};
key[((4 * _local6) + 0)] = (key[(((4 * _local6) - (4 * _local7)) + 0)] ^ _local1);
key[((4 * _local6) + 1)] = (key[(((4 * _local6) - (4 * _local7)) + 1)] ^ _local2);
key[((4 * _local6) + 2)] = (key[(((4 * _local6) - (4 * _local7)) + 2)] ^ _local3);
key[((4 * _local6) + 3)] = (key[(((4 * _local6) - (4 * _local7)) + 3)] ^ _local4);
_local6++;
};
}
protected function addRoundKey(_arg1:ByteArray, _arg2:uint):void{
var _local3:uint;
_local3 = 0;
while (_local3 < 16) {
state[_local3] = (state[_local3] ^ _arg1[(_local3 + _arg2)]);
_local3++;
};
}
public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{
var _local3:uint;
state.position = 0;
state.writeBytes(_arg1, _arg2, (Nb * 4));
addRoundKey(key, 0);
_local3 = 1;
while (_local3 < (Nr + 1)) {
if (_local3 < Nr){
mixSubColumns();
} else {
shiftRows();
};
addRoundKey(key, ((_local3 * Nb) * 4));
_local3++;
};
_arg1.position = _arg2;
_arg1.writeBytes(state);
}
protected function mixSubColumns():void{
tmp.length = 0;
tmp[0] = (((Xtime2Sbox[state[0]] ^ Xtime3Sbox[state[5]]) ^ Sbox[state[10]]) ^ Sbox[state[15]]);
tmp[1] = (((Sbox[state[0]] ^ Xtime2Sbox[state[5]]) ^ Xtime3Sbox[state[10]]) ^ Sbox[state[15]]);
tmp[2] = (((Sbox[state[0]] ^ Sbox[state[5]]) ^ Xtime2Sbox[state[10]]) ^ Xtime3Sbox[state[15]]);
tmp[3] = (((Xtime3Sbox[state[0]] ^ Sbox[state[5]]) ^ Sbox[state[10]]) ^ Xtime2Sbox[state[15]]);
tmp[4] = (((Xtime2Sbox[state[4]] ^ Xtime3Sbox[state[9]]) ^ Sbox[state[14]]) ^ Sbox[state[3]]);
tmp[5] = (((Sbox[state[4]] ^ Xtime2Sbox[state[9]]) ^ Xtime3Sbox[state[14]]) ^ Sbox[state[3]]);
tmp[6] = (((Sbox[state[4]] ^ Sbox[state[9]]) ^ Xtime2Sbox[state[14]]) ^ Xtime3Sbox[state[3]]);
tmp[7] = (((Xtime3Sbox[state[4]] ^ Sbox[state[9]]) ^ Sbox[state[14]]) ^ Xtime2Sbox[state[3]]);
tmp[8] = (((Xtime2Sbox[state[8]] ^ Xtime3Sbox[state[13]]) ^ Sbox[state[2]]) ^ Sbox[state[7]]);
tmp[9] = (((Sbox[state[8]] ^ Xtime2Sbox[state[13]]) ^ Xtime3Sbox[state[2]]) ^ Sbox[state[7]]);
tmp[10] = (((Sbox[state[8]] ^ Sbox[state[13]]) ^ Xtime2Sbox[state[2]]) ^ Xtime3Sbox[state[7]]);
tmp[11] = (((Xtime3Sbox[state[8]] ^ Sbox[state[13]]) ^ Sbox[state[2]]) ^ Xtime2Sbox[state[7]]);
tmp[12] = (((Xtime2Sbox[state[12]] ^ Xtime3Sbox[state[1]]) ^ Sbox[state[6]]) ^ Sbox[state[11]]);
tmp[13] = (((Sbox[state[12]] ^ Xtime2Sbox[state[1]]) ^ Xtime3Sbox[state[6]]) ^ Sbox[state[11]]);
tmp[14] = (((Sbox[state[12]] ^ Sbox[state[1]]) ^ Xtime2Sbox[state[6]]) ^ Xtime3Sbox[state[11]]);
tmp[15] = (((Xtime3Sbox[state[12]] ^ Sbox[state[1]]) ^ Sbox[state[6]]) ^ Xtime2Sbox[state[11]]);
state.position = 0;
state.writeBytes(tmp, 0, (Nb * 4));
}
protected function shiftRows():void{
var _local1:uint;
state[0] = Sbox[state[0]];
state[4] = Sbox[state[4]];
state[8] = Sbox[state[8]];
state[12] = Sbox[state[12]];
_local1 = Sbox[state[1]];
state[1] = Sbox[state[5]];
state[5] = Sbox[state[9]];
state[9] = Sbox[state[13]];
state[13] = _local1;
_local1 = Sbox[state[2]];
state[2] = Sbox[state[10]];
state[10] = _local1;
_local1 = Sbox[state[6]];
state[6] = Sbox[state[14]];
state[14] = _local1;
_local1 = Sbox[state[15]];
state[15] = Sbox[state[11]];
state[11] = Sbox[state[7]];
state[7] = Sbox[state[3]];
state[3] = _local1;
}
public function getBlockSize():uint{
return (16);
}
while (i < 0x0100) {
Sbox[i] = _Sbox[i];
InvSbox[i] = _InvSbox[i];
Xtime2Sbox[i] = _Xtime2Sbox[i];
Xtime3Sbox[i] = _Xtime3Sbox[i];
Xtime2[i] = _Xtime2[i];
Xtime9[i] = _Xtime9[i];
XtimeB[i] = _XtimeB[i];
XtimeD[i] = _XtimeD[i];
XtimeE[i] = _XtimeE[i];
i++;
};
i = 0;
while (i < _Rcon.length) {
Rcon[i] = _Rcon[i];
i++;
};
}
}//package com.hurlant.crypto.symmetric
Section 14
//BlowFishKey (com.hurlant.crypto.symmetric.BlowFishKey)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.util.*;
public class BlowFishKey implements ISymmetricKey {
private var S3:Array;
private var S2:Array;
private var P:Array;
private var key:ByteArray;// = null
private var S0:Array;
private var S1:Array;
private static const KP:Array = [608135816, 2242054355, 320440878, 57701188, 2752067618, 698298832, 137296536, 3964562569, 1160258022, 953160567, 3193202383, 887688300, 3232508343, 3380367581, 1065670069, 3041331479, 2450970073, 2306472731];
private static const KS0:Array = [3509652390, 2564797868, 805139163, 3491422135, 3101798381, 1780907670, 3128725573, 4046225305, 614570311, 3012652279, 134345442, 2240740374, 1667834072, 1901547113, 2757295779, 4103290238, 227898511, 1921955416, 1904987480, 2182433518, 2069144605, 3260701109, 2620446009, 720527379, 3318853667, 677414384, 3393288472, 3101374703, 2390351024, 1614419982, 1822297739, 2954791486, 3608508353, 3174124327, 2024746970, 1432378464, 3864339955, 2857741204, 1464375394, 1676153920, 1439316330, 715854006, 3033291828, 289532110, 2706671279, 2087905683, 3018724369, 1668267050, 732546397, 1947742710, 3462151702, 2609353502, 2950085171, 1814351708, 2050118529, 680887927, 999245976, 1800124847, 3300911131, 1713906067, 1641548236, 4213287313, 1216130144, 1575780402, 4018429277, 3917837745, 3693486850, 3949271944, 596196993, 3549867205, 258830323, 2213823033, 772490370, 2760122372, 1774776394, 2652871518, 566650946, 4142492826, 1728879713, 2882767088, 1783734482, 3629395816, 2517608232, 2874225571, 1861159788, 326777828, 3124490320, 2130389656, 2716951837, 967770486, 1724537150, 2185432712, 2364442137, 1164943284, 2105845187, 998989502, 3765401048, 2244026483, 1075463327, 1455516326, 1322494562, 910128902, 469688178, 1117454909, 936433444, 3490320968, 3675253459, 1240580251, 122909385, 2157517691, 634681816, 4142456567, 3825094682, 3061402683, 2540495037, 79693498, 3249098678, 1084186820, 1583128258, 426386531, 1761308591, 1047286709, 322548459, 995290223, 1845252383, 2603652396, 3431023940, 2942221577, 3202600964, 3727903485, 1712269319, 422464435, 3234572375, 1170764815, 3523960633, 3117677531, 1434042557, 442511882, 3600875718, 1076654713, 1738483198, 4213154764, 2393238008, 3677496056, 1014306527, 4251020053, 793779912, 2902807211, 842905082, 4246964064, 1395751752, 1040244610, 2656851899, 3396308128, 445077038, 3742853595, 3577915638, 679411651, 2892444358, 2354009459, 1767581616, 3150600392, 3791627101, 3102740896, 284835224, 4246832056, 1258075500, 768725851, 2589189241, 3069724005, 3532540348, 1274779536, 3789419226, 2764799539, 1660621633, 3471099624, 4011903706, 913787905, 3497959166, 737222580, 2514213453, 2928710040, 3937242737, 1804850592, 3499020752, 2949064160, 2386320175, 2390070455, 2415321851, 4061277028, 2290661394, 2416832540, 1336762016, 1754252060, 3520065937, 3014181293, 791618072, 3188594551, 3933548030, 2332172193, 3852520463, 3043980520, 413987798, 3465142937, 3030929376, 4245938359, 2093235073, 3534596313, 375366246, 2157278981, 2479649556, 555357303, 3870105701, 2008414854, 3344188149, 4221384143, 3956125452, 2067696032, 3594591187, 2921233993, 2428461, 544322398, 577241275, 1471733935, 610547355, 4027169054, 1432588573, 1507829418, 2025931657, 3646575487, 545086370, 48609733, 2200306550, 1653985193, 298326376, 1316178497, 3007786442, 2064951626, 458293330, 2589141269, 3591329599, 3164325604, 727753846, 2179363840, 146436021, 1461446943, 4069977195, 705550613, 3059967265, 3887724982, 4281599278, 3313849956, 1404054877, 2845806497, 146425753, 1854211946];
private static const KS1:Array = [1266315497, 3048417604, 3681880366, 3289982499, 2909710000, 1235738493, 2632868024, 2414719590, 3970600049, 1771706367, 1449415276, 3266420449, 422970021, 1963543593, 2690192192, 3826793022, 1062508698, 1531092325, 1804592342, 2583117782, 2714934279, 4024971509, 1294809318, 4028980673, 1289560198, 2221992742, 1669523910, 35572830, 157838143, 1052438473, 1016535060, 1802137761, 1753167236, 1386275462, 3080475397, 2857371447, 1040679964, 2145300060, 2390574316, 1461121720, 2956646967, 4031777805, 4028374788, 33600511, 2920084762, 1018524850, 629373528, 3691585981, 3515945977, 2091462646, 2486323059, 586499841, 988145025, 935516892, 3367335476, 2599673255, 2839830854, 265290510, 3972581182, 2759138881, 3795373465, 1005194799, 847297441, 406762289, 1314163512, 1332590856, 1866599683, 4127851711, 750260880, 613907577, 1450815602, 3165620655, 3734664991, 3650291728, 3012275730, 3704569646, 1427272223, 778793252, 1343938022, 2676280711, 2052605720, 1946737175, 3164576444, 3914038668, 3967478842, 3682934266, 1661551462, 3294938066, 4011595847, 840292616, 3712170807, 616741398, 312560963, 711312465, 1351876610, 322626781, 1910503582, 271666773, 2175563734, 1594956187, 70604529, 3617834859, 1007753275, 1495573769, 4069517037, 2549218298, 2663038764, 504708206, 2263041392, 3941167025, 2249088522, 1514023603, 1998579484, 1312622330, 694541497, 2582060303, 2151582166, 1382467621, 776784248, 2618340202, 3323268794, 2497899128, 2784771155, 503983604, 4076293799, 907881277, 423175695, 432175456, 1378068232, 4145222326, 3954048622, 3938656102, 3820766613, 2793130115, 2977904593, 26017576, 3274890735, 3194772133, 1700274565, 1756076034, 4006520079, 3677328699, 720338349, 1533947780, 354530856, 688349552, 3973924725, 1637815568, 332179504, 3949051286, 53804574, 2852348879, 3044236432, 1282449977, 3583942155, 3416972820, 4006381244, 1617046695, 2628476075, 3002303598, 1686838959, 431878346, 2686675385, 1700445008, 1080580658, 1009431731, 832498133, 3223435511, 2605976345, 2271191193, 2516031870, 1648197032, 4164389018, 2548247927, 300782431, 375919233, 238389289, 3353747414, 2531188641, 2019080857, 1475708069, 455242339, 2609103871, 448939670, 3451063019, 1395535956, 2413381860, 1841049896, 1491858159, 885456874, 4264095073, 4001119347, 1565136089, 3898914787, 1108368660, 540939232, 1173283510, 2745871338, 3681308437, 4207628240, 3343053890, 4016749493, 1699691293, 1103962373, 3625875870, 2256883143, 3830138730, 1031889488, 3479347698, 1535977030, 4236805024, 3251091107, 2132092099, 1774941330, 1199868427, 1452454533, 157007616, 2904115357, 342012276, 595725824, 1480756522, 206960106, 497939518, 591360097, 863170706, 2375253569, 3596610801, 1814182875, 2094937945, 3421402208, 1082520231, 3463918190, 2785509508, 435703966, 3908032597, 1641649973, 2842273706, 3305899714, 1510255612, 2148256476, 2655287854, 3276092548, 4258621189, 236887753, 3681803219, 274041037, 1734335097, 3815195456, 3317970021, 1899903192, 1026095262, 4050517792, 356393447, 2410691914, 3873677099, 3682840055];
private static const KS3:Array = [976866871, 3556439503, 2881648439, 1522871579, 1555064734, 1336096578, 3548522304, 2579274686, 3574697629, 3205460757, 3593280638, 3338716283, 3079412587, 564236357, 2993598910, 1781952180, 1464380207, 3163844217, 3332601554, 1699332808, 1393555694, 1183702653, 3581086237, 1288719814, 691649499, 2847557200, 2895455976, 3193889540, 2717570544, 1781354906, 1676643554, 2592534050, 3230253752, 1126444790, 2770207658, 2633158820, 2210423226, 2615765581, 2414155088, 3127139286, 673620729, 2805611233, 1269405062, 4015350505, 3341807571, 4149409754, 1057255273, 2012875353, 2162469141, 2276492801, 2601117357, 993977747, 3918593370, 2654263191, 753973209, 36408145, 2530585658, 25011837, 3520020182, 2088578344, 530523599, 2918365339, 1524020338, 1518925132, 3760827505, 3759777254, 1202760957, 3985898139, 3906192525, 674977740, 4174734889, 2031300136, 2019492241, 3983892565, 4153806404, 3822280332, 352677332, 2297720250, 60907813, 90501309, 3286998549, 1016092578, 2535922412, 2839152426, 457141659, 509813237, 4120667899, 652014361, 1966332200, 2975202805, 55981186, 2327461051, 676427537, 3255491064, 2882294119, 3433927263, 1307055953, 942726286, 933058658, 2468411793, 3933900994, 4215176142, 1361170020, 2001714738, 2830558078, 3274259782, 1222529897, 1679025792, 2729314320, 3714953764, 1770335741, 151462246, 3013232138, 1682292957, 1483529935, 471910574, 1539241949, 458788160, 3436315007, 1807016891, 3718408830, 978976581, 1043663428, 3165965781, 1927990952, 4200891579, 2372276910, 3208408903, 3533431907, 1412390302, 2931980059, 4132332400, 1947078029, 3881505623, 4168226417, 2941484381, 1077988104, 1320477388, 886195818, 18198404, 3786409000, 2509781533, 112762804, 3463356488, 1866414978, 891333506, 18488651, 661792760, 1628790961, 3885187036, 3141171499, 876946877, 2693282273, 1372485963, 791857591, 2686433993, 3759982718, 3167212022, 3472953795, 2716379847, 445679433, 3561995674, 3504004811, 3574258232, 54117162, 3331405415, 2381918588, 3769707343, 4154350007, 1140177722, 4074052095, 668550556, 3214352940, 367459370, 261225585, 2610173221, 4209349473, 3468074219, 3265815641, 314222801, 3066103646, 3808782860, 282218597, 3406013506, 3773591054, 379116347, 1285071038, 846784868, 2669647154, 3771962079, 3550491691, 2305946142, 453669953, 1268987020, 3317592352, 3279303384, 3744833421, 2610507566, 3859509063, 266596637, 3847019092, 517658769, 3462560207, 3443424879, 370717030, 4247526661, 2224018117, 4143653529, 4112773975, 2788324899, 2477274417, 1456262402, 2901442914, 1517677493, 1846949527, 2295493580, 3734397586, 2176403920, 1280348187, 1908823572, 3871786941, 846861322, 1172426758, 3287448474, 3383383037, 1655181056, 3139813346, 901632758, 1897031941, 2986607138, 3066810236, 3447102507, 1393639104, 373351379, 950779232, 625454576, 3124240540, 4148612726, 2007998917, 544563296, 2244738638, 2330496472, 2058025392, 1291430526, 424198748, 50039436, 29584100, 3605783033, 2429876329, 2791104160, 1057563949, 3255363231, 3075367218, 3463963227, 1469046755, 985887462];
private static const ROUNDS:uint = 16;
private static const KS2:Array = [3913112168, 2491498743, 4132185628, 2489919796, 1091903735, 1979897079, 3170134830, 3567386728, 3557303409, 857797738, 1136121015, 1342202287, 507115054, 2535736646, 337727348, 3213592640, 1301675037, 2528481711, 1895095763, 1721773893, 3216771564, 62756741, 2142006736, 835421444, 2531993523, 1442658625, 3659876326, 2882144922, 676362277, 1392781812, 170690266, 3921047035, 1759253602, 3611846912, 1745797284, 664899054, 1329594018, 3901205900, 3045908486, 2062866102, 2865634940, 3543621612, 3464012697, 1080764994, 553557557, 3656615353, 3996768171, 991055499, 499776247, 1265440854, 648242737, 3940784050, 980351604, 3713745714, 1749149687, 3396870395, 4211799374, 3640570775, 1161844396, 3125318951, 1431517754, 545492359, 4268468663, 3499529547, 1437099964, 2702547544, 3433638243, 2581715763, 2787789398, 1060185593, 1593081372, 2418618748, 4260947970, 69676912, 2159744348, 86519011, 2512459080, 3838209314, 1220612927, 3339683548, 133810670, 1090789135, 1078426020, 1569222167, 845107691, 3583754449, 4072456591, 1091646820, 628848692, 1613405280, 3757631651, 526609435, 236106946, 48312990, 2942717905, 3402727701, 1797494240, 859738849, 992217954, 4005476642, 2243076622, 3870952857, 3732016268, 765654824, 3490871365, 2511836413, 1685915746, 3888969200, 1414112111, 2273134842, 3281911079, 4080962846, 172450625, 2569994100, 980381355, 4109958455, 2819808352, 2716589560, 2568741196, 3681446669, 3329971472, 1835478071, 660984891, 3704678404, 4045999559, 3422617507, 3040415634, 1762651403, 1719377915, 3470491036, 2693910283, 3642056355, 3138596744, 1364962596, 2073328063, 1983633131, 926494387, 3423689081, 2150032023, 4096667949, 1749200295, 3328846651, 309677260, 2016342300, 1779581495, 3079819751, 111262694, 1274766160, 443224088, 298511866, 1025883608, 3806446537, 1145181785, 168956806, 3641502830, 3584813610, 1689216846, 3666258015, 3200248200, 1692713982, 2646376535, 4042768518, 1618508792, 1610833997, 3523052358, 4130873264, 2001055236, 3610705100, 2202168115, 4028541809, 2961195399, 1006657119, 2006996926, 3186142756, 1430667929, 3210227297, 1314452623, 4074634658, 4101304120, 2273951170, 1399257539, 3367210612, 3027628629, 1190975929, 2062231137, 2333990788, 2221543033, 2438960610, 1181637006, 548689776, 2362791313, 3372408396, 3104550113, 3145860560, 296247880, 1970579870, 3078560182, 3769228297, 1714227617, 3291629107, 3898220290, 166772364, 1251581989, 493813264, 448347421, 195405023, 2709975567, 677966185, 3703036547, 1463355134, 2715995803, 1338867538, 1343315457, 2802222074, 2684532164, 233230375, 2599980071, 2000651841, 3277868038, 1638401717, 4028070440, 3237316320, 6314154, 819756386, 300326615, 590932579, 1405279636, 3267499572, 3150704214, 2428286686, 3959192993, 3461946742, 1862657033, 1266418056, 963775037, 2089974820, 2263052895, 1917689273, 448879540, 3550394620, 3981727096, 150775221, 3627908307, 1303187396, 508620638, 2975983352, 2726630617, 1817252668, 1876281319, 1457606340, 908771278, 3720792119, 3617206836, 2455994898, 1729034894, 1080033504];
private static const BLOCK_SIZE:uint = 8;
private static const P_SZ:uint = (ROUNDS + 2);
private static const SBOX_SK:uint = 0x0100;
public function BlowFishKey(_arg1:ByteArray){
key = null;
super();
this.key = _arg1;
setKey(_arg1);
}
private function F(_arg1:uint):uint{
return ((((S0[(_arg1 >>> 24)] + S1[((_arg1 >>> 16) & 0xFF)]) ^ S2[((_arg1 >>> 8) & 0xFF)]) + S3[(_arg1 & 0xFF)]));
}
private function BytesTo32bits(_arg1:ByteArray, _arg2:uint):uint{
return ((((((_arg1[_arg2] & 0xFF) << 24) | ((_arg1[(_arg2 + 1)] & 0xFF) << 16)) | ((_arg1[(_arg2 + 2)] & 0xFF) << 8)) | (_arg1[(_arg2 + 3)] & 0xFF)));
}
public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{
decryptBlock(_arg1, _arg2, _arg1, _arg2);
}
private function decryptBlock(_arg1:ByteArray, _arg2:uint, _arg3:ByteArray, _arg4:uint):void{
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local5 = BytesTo32bits(_arg1, _arg2);
_local6 = BytesTo32bits(_arg1, (_arg2 + 4));
_local5 = (_local5 ^ P[(ROUNDS + 1)]);
_local7 = ROUNDS;
while (_local7 > 0) {
_local6 = (_local6 ^ (F(_local5) ^ P[_local7]));
_local5 = (_local5 ^ (F(_local6) ^ P[(_local7 - 1)]));
_local7 = (_local7 - 2);
};
_local6 = (_local6 ^ P[0]);
Bits32ToBytes(_local6, _arg3, _arg4);
Bits32ToBytes(_local5, _arg3, (_arg4 + 4));
}
private function setKey(_arg1:ByteArray):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
S0 = KS0.concat();
S1 = KS1.concat();
S2 = KS2.concat();
S3 = KS3.concat();
P = KP.concat();
_local2 = _arg1.length;
_local3 = 0;
_local4 = 0;
while (_local4 < P_SZ) {
_local5 = 0;
_local6 = 0;
while (_local6 < 4) {
var _temp1 = _local3;
_local3 = (_local3 + 1);
_local5 = ((_local5 << 8) | (_arg1[_temp1] & 0xFF));
if (_local3 >= _local2){
_local3 = 0;
};
_local6++;
};
P[_local4] = (P[_local4] ^ _local5);
_local4++;
};
processTable(0, 0, P);
processTable(P[(P_SZ - 2)], P[(P_SZ - 1)], S0);
processTable(S0[(SBOX_SK - 2)], S0[(SBOX_SK - 1)], S1);
processTable(S1[(SBOX_SK - 2)], S1[(SBOX_SK - 1)], S2);
processTable(S2[(SBOX_SK - 2)], S2[(SBOX_SK - 1)], S3);
}
public function dispose():void{
var _local1:uint;
_local1 = 0;
_local1 = 0;
while (_local1 < S0.length) {
S0[_local1] = 0;
_local1++;
};
_local1 = 0;
while (_local1 < S1.length) {
S1[_local1] = 0;
_local1++;
};
_local1 = 0;
while (_local1 < S2.length) {
S2[_local1] = 0;
_local1++;
};
_local1 = 0;
while (_local1 < S3.length) {
S3[_local1] = 0;
_local1++;
};
_local1 = 0;
while (_local1 < P.length) {
P[_local1] = 0;
_local1++;
};
S0 = null;
S1 = null;
S2 = null;
S3 = null;
P = null;
_local1 = 0;
while (_local1 < key.length) {
key[_local1] = 0;
_local1++;
};
key.length = 0;
key = null;
Memory.gc();
}
private function encryptBlock(_arg1:ByteArray, _arg2:uint, _arg3:ByteArray, _arg4:uint):void{
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local5 = BytesTo32bits(_arg1, _arg2);
_local6 = BytesTo32bits(_arg1, (_arg2 + 4));
_local5 = (_local5 ^ P[0]);
_local7 = 1;
while (_local7 < ROUNDS) {
_local6 = (_local6 ^ (F(_local5) ^ P[_local7]));
_local5 = (_local5 ^ (F(_local6) ^ P[(_local7 + 1)]));
_local7 = (_local7 + 2);
};
_local6 = (_local6 ^ P[(ROUNDS + 1)]);
Bits32ToBytes(_local6, _arg3, _arg4);
Bits32ToBytes(_local5, _arg3, (_arg4 + 4));
}
public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{
encryptBlock(_arg1, _arg2, _arg1, _arg2);
}
private function Bits32ToBytes(_arg1:uint, _arg2:ByteArray, _arg3:uint):void{
_arg2[(_arg3 + 3)] = _arg1;
_arg2[(_arg3 + 2)] = (_arg1 >> 8);
_arg2[(_arg3 + 1)] = (_arg1 >> 16);
_arg2[_arg3] = (_arg1 >> 24);
}
private function processTable(_arg1:uint, _arg2:uint, _arg3:Array):void{
var _local4:uint;
var _local5:uint;
var _local6:uint;
_local4 = _arg3.length;
_local5 = 0;
while (_local5 < _local4) {
_arg1 = (_arg1 ^ P[0]);
_local6 = 1;
while (_local6 < ROUNDS) {
_arg2 = (_arg2 ^ (F(_arg1) ^ P[_local6]));
_arg1 = (_arg1 ^ (F(_arg2) ^ P[(_local6 + 1)]));
_local6 = (_local6 + 2);
};
_arg2 = (_arg2 ^ P[(ROUNDS + 1)]);
_arg3[_local5] = _arg2;
_arg3[(_local5 + 1)] = _arg1;
_arg2 = _arg1;
_arg1 = _arg3[_local5];
_local5 = (_local5 + 2);
};
}
public function toString():String{
return ("blowfish");
}
public function getBlockSize():uint{
return (BLOCK_SIZE);
}
}
}//package com.hurlant.crypto.symmetric
Section 15
//CBCMode (com.hurlant.crypto.symmetric.CBCMode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public class CBCMode extends IVMode implements IMode {
public function CBCMode(_arg1:ISymmetricKey, _arg2:IPad=null){
super(_arg1, _arg2);
}
public function toString():String{
return ((key.toString() + "-cbc"));
}
public function decrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
var _local3:ByteArray;
var _local4:uint;
var _local5:uint;
_local2 = getIV4d();
_local3 = new ByteArray();
_local4 = 0;
while (_local4 < _arg1.length) {
_local3.position = 0;
_local3.writeBytes(_arg1, _local4, blockSize);
key.decrypt(_arg1, _local4);
_local5 = 0;
while (_local5 < blockSize) {
_arg1[(_local4 + _local5)] = (_arg1[(_local4 + _local5)] ^ _local2[_local5]);
_local5++;
};
_local2.position = 0;
_local2.writeBytes(_local3, 0, blockSize);
_local4 = (_local4 + blockSize);
};
padding.unpad(_arg1);
}
public function encrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
var _local3:uint;
var _local4:uint;
padding.pad(_arg1);
_local2 = getIV4e();
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = 0;
while (_local4 < blockSize) {
_arg1[(_local3 + _local4)] = (_arg1[(_local3 + _local4)] ^ _local2[_local4]);
_local4++;
};
key.encrypt(_arg1, _local3);
_local2.position = 0;
_local2.writeBytes(_arg1, _local3, blockSize);
_local3 = (_local3 + blockSize);
};
}
}
}//package com.hurlant.crypto.symmetric
Section 16
//CFB8Mode (com.hurlant.crypto.symmetric.CFB8Mode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public class CFB8Mode extends IVMode implements IMode {
public function CFB8Mode(_arg1:ISymmetricKey, _arg2:IPad=null){
super(_arg1, null);
}
public function toString():String{
return ((key.toString() + "-cfb8"));
}
public function decrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
var _local3:ByteArray;
var _local4:uint;
var _local5:uint;
var _local6:uint;
_local2 = getIV4d();
_local3 = new ByteArray();
_local4 = 0;
while (_local4 < _arg1.length) {
_local5 = _arg1[_local4];
_local3.position = 0;
_local3.writeBytes(_local2);
key.encrypt(_local2);
_arg1[_local4] = (_arg1[_local4] ^ _local2[0]);
_local6 = 0;
while (_local6 < (blockSize - 1)) {
_local2[_local6] = _local3[(_local6 + 1)];
_local6++;
};
_local2[(blockSize - 1)] = _local5;
_local4++;
};
}
public function encrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
var _local3:ByteArray;
var _local4:uint;
var _local5:uint;
_local2 = getIV4e();
_local3 = new ByteArray();
_local4 = 0;
while (_local4 < _arg1.length) {
_local3.position = 0;
_local3.writeBytes(_local2);
key.encrypt(_local2);
_arg1[_local4] = (_arg1[_local4] ^ _local2[0]);
_local5 = 0;
while (_local5 < (blockSize - 1)) {
_local2[_local5] = _local3[(_local5 + 1)];
_local5++;
};
_local2[(blockSize - 1)] = _arg1[_local4];
_local4++;
};
}
}
}//package com.hurlant.crypto.symmetric
Section 17
//CFBMode (com.hurlant.crypto.symmetric.CFBMode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public class CFBMode extends IVMode implements IMode {
public function CFBMode(_arg1:ISymmetricKey, _arg2:IPad=null){
super(_arg1, null);
}
public function toString():String{
return ((key.toString() + "-cfb"));
}
public function decrypt(_arg1:ByteArray):void{
var _local2:uint;
var _local3:ByteArray;
var _local4:ByteArray;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local2 = _arg1.length;
_local3 = getIV4d();
_local4 = new ByteArray();
_local5 = 0;
while (_local5 < _arg1.length) {
key.encrypt(_local3);
_local6 = (((_local5 + blockSize))<_local2) ? blockSize : (_local2 - _local5);
_local4.position = 0;
_local4.writeBytes(_arg1, _local5, _local6);
_local7 = 0;
while (_local7 < _local6) {
_arg1[(_local5 + _local7)] = (_arg1[(_local5 + _local7)] ^ _local3[_local7]);
_local7++;
};
_local3.position = 0;
_local3.writeBytes(_local4);
_local5 = (_local5 + blockSize);
};
}
public function encrypt(_arg1:ByteArray):void{
var _local2:uint;
var _local3:ByteArray;
var _local4:uint;
var _local5:uint;
var _local6:uint;
_local2 = _arg1.length;
_local3 = getIV4e();
_local4 = 0;
while (_local4 < _arg1.length) {
key.encrypt(_local3);
_local5 = (((_local4 + blockSize))<_local2) ? blockSize : (_local2 - _local4);
_local6 = 0;
while (_local6 < _local5) {
_arg1[(_local4 + _local6)] = (_arg1[(_local4 + _local6)] ^ _local3[_local6]);
_local6++;
};
_local3.position = 0;
_local3.writeBytes(_arg1, _local4, _local5);
_local4 = (_local4 + blockSize);
};
}
}
}//package com.hurlant.crypto.symmetric
Section 18
//CTRMode (com.hurlant.crypto.symmetric.CTRMode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public class CTRMode extends IVMode implements IMode {
public function CTRMode(_arg1:ISymmetricKey, _arg2:IPad=null){
super(_arg1, _arg2);
}
public function toString():String{
return ((key.toString() + "-ctr"));
}
private function core(_arg1:ByteArray, _arg2:ByteArray):void{
var _local3:ByteArray;
var _local4:ByteArray;
var _local5:uint;
var _local6:uint;
_local3 = new ByteArray();
_local4 = new ByteArray();
_local3.writeBytes(_arg2);
_local5 = 0;
while (_local5 < _arg1.length) {
_local4.position = 0;
_local4.writeBytes(_local3);
key.encrypt(_local4);
_local6 = 0;
while (_local6 < blockSize) {
_arg1[(_local5 + _local6)] = (_arg1[(_local5 + _local6)] ^ _local4[_local6]);
_local6++;
};
_local6 = (blockSize - 1);
while (_local6 >= 0) {
var _local7 = _local3;
var _local8 = _local6;
var _local9 = (_local7[_local8] + 1);
_local7[_local8] = _local9;
if (_local3[_local6] != 0){
break;
};
_local6--;
};
_local5 = (_local5 + blockSize);
};
}
public function decrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
_local2 = getIV4d();
core(_arg1, _local2);
padding.unpad(_arg1);
}
public function encrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
padding.pad(_arg1);
_local2 = getIV4e();
core(_arg1, _local2);
}
}
}//package com.hurlant.crypto.symmetric
Section 19
//DESKey (com.hurlant.crypto.symmetric.DESKey)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.util.*;
public class DESKey implements ISymmetricKey {
protected var encKey:Array;
protected var key:ByteArray;
protected var decKey:Array;
private static const SP8:Array = [268439616, 0x1000, 262144, 268701760, 268435456, 268439616, 64, 268435456, 262208, 268697600, 268701760, 266240, 268701696, 266304, 0x1000, 64, 268697600, 268435520, 268439552, 4160, 266240, 262208, 268697664, 268701696, 4160, 0, 0, 268697664, 268435520, 268439552, 266304, 262144, 266304, 262144, 268701696, 0x1000, 64, 268697664, 0x1000, 266304, 268439552, 64, 268435520, 268697600, 268697664, 268435456, 262144, 268439616, 0, 268701760, 262208, 268435520, 268697600, 268439552, 268439616, 0, 268701760, 266240, 266240, 4160, 4160, 262208, 268435456, 268701696];
private static const bytebit:Array = [128, 64, 32, 16, 8, 4, 2, 1];
private static const bigbyte:Array = [0x800000, 0x400000, 0x200000, 0x100000, 524288, 262144, 131072, 65536, 0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100, 128, 64, 32, 16, 8, 4, 2, 1];
private static const pc1:Array = [56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3];
private static const pc2:Array = [13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, 40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47, 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31];
private static const Df_Key:Array = [1, 35, 69, 103, 137, 171, 205, 239, 254, 220, 186, 152, 118, 84, 50, 16, 137, 171, 205, 239, 1, 35, 69, 103];
private static const totrot:Array = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
private static const SP1:Array = [16843776, 0, 65536, 16843780, 16842756, 66564, 4, 65536, 0x0400, 16843776, 16843780, 0x0400, 16778244, 16842756, 16777216, 4, 0x0404, 16778240, 16778240, 66560, 66560, 16842752, 16842752, 16778244, 65540, 16777220, 16777220, 65540, 0, 0x0404, 66564, 16777216, 65536, 16843780, 4, 16842752, 16843776, 16777216, 16777216, 0x0400, 16842756, 65536, 66560, 16777220, 0x0400, 4, 16778244, 66564, 16843780, 65540, 16842752, 16778244, 16777220, 0x0404, 66564, 16843776, 0x0404, 16778240, 16778240, 0, 65540, 66560, 0, 16842756];
private static const SP2:Array = [2148565024, 2147516416, 0x8000, 1081376, 0x100000, 32, 2148532256, 2147516448, 2147483680, 2148565024, 2148564992, 2147483648, 2147516416, 0x100000, 32, 2148532256, 0x108000, 0x100020, 2147516448, 0, 2147483648, 0x8000, 1081376, 2148532224, 0x100020, 2147483680, 0, 0x108000, 32800, 2148564992, 2148532224, 32800, 0, 1081376, 2148532256, 0x100000, 2147516448, 2148532224, 2148564992, 0x8000, 2148532224, 2147516416, 32, 2148565024, 1081376, 32, 0x8000, 2147483648, 32800, 2148564992, 0x100000, 2147483680, 0x100020, 2147516448, 2147483680, 0x100020, 0x108000, 0, 2147516416, 32800, 2147483648, 2148532256, 2148565024, 0x108000];
private static const SP3:Array = [520, 134349312, 0, 134348808, 134218240, 0, 131592, 134218240, 131080, 134217736, 134217736, 131072, 134349320, 131080, 134348800, 520, 134217728, 8, 134349312, 0x0200, 131584, 134348800, 134348808, 131592, 134218248, 131584, 131072, 134218248, 8, 134349320, 0x0200, 134217728, 134349312, 134217728, 131080, 520, 131072, 134349312, 134218240, 0, 0x0200, 131080, 134349320, 134218240, 134217736, 0x0200, 0, 134348808, 134218248, 131072, 134217728, 134349320, 8, 131592, 131584, 134217736, 134348800, 134218248, 520, 134348800, 131592, 8, 134348808, 131584];
private static const SP4:Array = [8396801, 8321, 8321, 128, 8396928, 0x800081, 0x800001, 8193, 0, 0x802000, 0x802000, 8396929, 129, 0, 0x800080, 0x800001, 1, 0x2000, 0x800000, 8396801, 128, 0x800000, 8193, 8320, 0x800081, 1, 8320, 0x800080, 0x2000, 8396928, 8396929, 129, 0x800080, 0x800001, 0x802000, 8396929, 129, 0, 0, 0x802000, 8320, 0x800080, 0x800081, 1, 8396801, 8321, 8321, 128, 8396929, 129, 1, 0x2000, 0x800001, 8193, 8396928, 0x800081, 8193, 8320, 0x800000, 8396801, 128, 0x800000, 0x2000, 8396928];
private static const SP5:Array = [0x0100, 34078976, 34078720, 1107296512, 524288, 0x0100, 1073741824, 34078720, 1074266368, 524288, 33554688, 1074266368, 1107296512, 1107820544, 524544, 1073741824, 33554432, 1074266112, 1074266112, 0, 1073742080, 1107820800, 1107820800, 33554688, 1107820544, 1073742080, 0, 1107296256, 34078976, 33554432, 1107296256, 524544, 524288, 1107296512, 0x0100, 33554432, 1073741824, 34078720, 1107296512, 1074266368, 33554688, 1073741824, 1107820544, 34078976, 1074266368, 0x0100, 33554432, 1107820544, 1107820800, 524544, 1107296256, 1107820800, 34078720, 0, 1074266112, 1107296256, 524544, 33554688, 1073742080, 524288, 0, 1074266112, 34078976, 1073742080];
private static const SP6:Array = [536870928, 541065216, 0x4000, 541081616, 541065216, 16, 541081616, 0x400000, 536887296, 4210704, 0x400000, 536870928, 0x400010, 536887296, 536870912, 16400, 0, 0x400010, 536887312, 0x4000, 0x404000, 536887312, 16, 541065232, 541065232, 0, 4210704, 541081600, 16400, 0x404000, 541081600, 536870912, 536887296, 16, 541065232, 0x404000, 541081616, 0x400000, 16400, 536870928, 0x400000, 536887296, 536870912, 16400, 536870928, 541081616, 0x404000, 541065216, 4210704, 541081600, 0, 541065232, 16, 0x4000, 541065216, 4210704, 0x4000, 0x400010, 536887312, 0, 541081600, 536870912, 0x400010, 536887312];
private static const SP7:Array = [0x200000, 69206018, 67110914, 0, 0x0800, 67110914, 2099202, 69208064, 69208066, 0x200000, 0, 67108866, 2, 67108864, 69206018, 2050, 67110912, 2099202, 0x200002, 67110912, 67108866, 69206016, 69208064, 0x200002, 69206016, 0x0800, 2050, 69208066, 0x200800, 2, 67108864, 0x200800, 67108864, 0x200800, 0x200000, 67110914, 67110914, 69206018, 69206018, 2, 0x200002, 67108864, 67110912, 0x200000, 69208064, 2050, 2099202, 69208064, 2050, 67108866, 69208066, 69206016, 0x200800, 0, 2, 69208066, 0, 2099202, 69206016, 0x0800, 67108866, 67110912, 0x0800, 0x200002];
public function DESKey(_arg1:ByteArray){
this.key = _arg1;
this.encKey = generateWorkingKey(true, _arg1, 0);
this.decKey = generateWorkingKey(false, _arg1, 0);
}
protected function generateWorkingKey(_arg1:Boolean, _arg2:ByteArray, _arg3:uint):Array{
var _local4:Array;
var _local5:ByteArray;
var _local6:ByteArray;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
_local4 = [];
_local5 = new ByteArray();
_local6 = new ByteArray();
_local8 = 0;
while (_local8 < 56) {
_local7 = pc1[_local8];
_local5[_local8] = !(((_arg2[(_arg3 + (_local7 >>> 3))] & bytebit[(_local7 & 7)]) == 0));
_local8++;
};
_local9 = 0;
while (_local9 < 16) {
if (_arg1){
_local10 = (_local9 << 1);
} else {
_local10 = ((15 - _local9) << 1);
};
_local11 = (_local10 + 1);
_local4[_local10] = (_local4[_local11] = 0);
_local8 = 0;
while (_local8 < 28) {
_local7 = (_local8 + totrot[_local9]);
if (_local7 < 28){
_local6[_local8] = _local5[_local7];
} else {
_local6[_local8] = _local5[(_local7 - 28)];
};
_local8++;
};
_local8 = 28;
while (_local8 < 56) {
_local7 = (_local8 + totrot[_local9]);
if (_local7 < 56){
_local6[_local8] = _local5[_local7];
} else {
_local6[_local8] = _local5[(_local7 - 28)];
};
_local8++;
};
_local8 = 0;
while (_local8 < 24) {
if (_local6[pc2[_local8]]){
_local4[_local10] = (_local4[_local10] | bigbyte[_local8]);
};
if (_local6[pc2[(_local8 + 24)]]){
_local4[_local11] = (_local4[_local11] | bigbyte[_local8]);
};
_local8++;
};
_local9++;
};
_local9 = 0;
while (_local9 != 32) {
_local12 = _local4[_local9];
_local13 = _local4[(_local9 + 1)];
_local4[_local9] = (((((_local12 & 0xFC0000) << 6) | ((_local12 & 4032) << 10)) | ((_local13 & 0xFC0000) >>> 10)) | ((_local13 & 4032) >>> 6));
_local4[(_local9 + 1)] = (((((_local12 & 258048) << 12) | ((_local12 & 63) << 16)) | ((_local13 & 258048) >>> 4)) | (_local13 & 63));
_local9 = (_local9 + 2);
};
return (_local4);
}
public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{
desFunc(encKey, _arg1, _arg2, _arg1, _arg2);
}
public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{
desFunc(decKey, _arg1, _arg2, _arg1, _arg2);
}
public function dispose():void{
var _local1:uint;
_local1 = 0;
_local1 = 0;
while (_local1 < encKey.length) {
encKey[_local1] = 0;
_local1++;
};
_local1 = 0;
while (_local1 < decKey.length) {
decKey[_local1] = 0;
_local1++;
};
encKey = null;
decKey = null;
_local1 = 0;
while (_local1 < key.length) {
key[_local1] = 0;
_local1++;
};
key.length = 0;
key = null;
Memory.gc();
}
protected function desFunc(_arg1:Array, _arg2:ByteArray, _arg3:uint, _arg4:ByteArray, _arg5:uint):void{
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
_local8 = ((_arg2[(_arg3 + 0)] & 0xFF) << 24);
_local8 = (_local8 | ((_arg2[(_arg3 + 1)] & 0xFF) << 16));
_local8 = (_local8 | ((_arg2[(_arg3 + 2)] & 0xFF) << 8));
_local8 = (_local8 | (_arg2[(_arg3 + 3)] & 0xFF));
_local7 = ((_arg2[(_arg3 + 4)] & 0xFF) << 24);
_local7 = (_local7 | ((_arg2[(_arg3 + 5)] & 0xFF) << 16));
_local7 = (_local7 | ((_arg2[(_arg3 + 6)] & 0xFF) << 8));
_local7 = (_local7 | (_arg2[(_arg3 + 7)] & 0xFF));
_local6 = (((_local8 >>> 4) ^ _local7) & 252645135);
_local7 = (_local7 ^ _local6);
_local8 = (_local8 ^ (_local6 << 4));
_local6 = (((_local8 >>> 16) ^ _local7) & 0xFFFF);
_local7 = (_local7 ^ _local6);
_local8 = (_local8 ^ (_local6 << 16));
_local6 = (((_local7 >>> 2) ^ _local8) & 858993459);
_local8 = (_local8 ^ _local6);
_local7 = (_local7 ^ (_local6 << 2));
_local6 = (((_local7 >>> 8) ^ _local8) & 0xFF00FF);
_local8 = (_local8 ^ _local6);
_local7 = (_local7 ^ (_local6 << 8));
_local7 = (((_local7 << 1) | ((_local7 >>> 31) & 1)) & 4294967295);
_local6 = ((_local8 ^ _local7) & 2863311530);
_local8 = (_local8 ^ _local6);
_local7 = (_local7 ^ _local6);
_local8 = (((_local8 << 1) | ((_local8 >>> 31) & 1)) & 4294967295);
_local9 = 0;
while (_local9 < 8) {
_local6 = ((_local7 << 28) | (_local7 >>> 4));
_local6 = (_local6 ^ _arg1[((_local9 * 4) + 0)]);
_local10 = SP7[(_local6 & 63)];
_local10 = (_local10 | SP5[((_local6 >>> 8) & 63)]);
_local10 = (_local10 | SP3[((_local6 >>> 16) & 63)]);
_local10 = (_local10 | SP1[((_local6 >>> 24) & 63)]);
_local6 = (_local7 ^ _arg1[((_local9 * 4) + 1)]);
_local10 = (_local10 | SP8[(_local6 & 63)]);
_local10 = (_local10 | SP6[((_local6 >>> 8) & 63)]);
_local10 = (_local10 | SP4[((_local6 >>> 16) & 63)]);
_local10 = (_local10 | SP2[((_local6 >>> 24) & 63)]);
_local8 = (_local8 ^ _local10);
_local6 = ((_local8 << 28) | (_local8 >>> 4));
_local6 = (_local6 ^ _arg1[((_local9 * 4) + 2)]);
_local10 = SP7[(_local6 & 63)];
_local10 = (_local10 | SP5[((_local6 >>> 8) & 63)]);
_local10 = (_local10 | SP3[((_local6 >>> 16) & 63)]);
_local10 = (_local10 | SP1[((_local6 >>> 24) & 63)]);
_local6 = (_local8 ^ _arg1[((_local9 * 4) + 3)]);
_local10 = (_local10 | SP8[(_local6 & 63)]);
_local10 = (_local10 | SP6[((_local6 >>> 8) & 63)]);
_local10 = (_local10 | SP4[((_local6 >>> 16) & 63)]);
_local10 = (_local10 | SP2[((_local6 >>> 24) & 63)]);
_local7 = (_local7 ^ _local10);
_local9++;
};
_local7 = ((_local7 << 31) | (_local7 >>> 1));
_local6 = ((_local8 ^ _local7) & 2863311530);
_local8 = (_local8 ^ _local6);
_local7 = (_local7 ^ _local6);
_local8 = ((_local8 << 31) | (_local8 >>> 1));
_local6 = (((_local8 >>> 8) ^ _local7) & 0xFF00FF);
_local7 = (_local7 ^ _local6);
_local8 = (_local8 ^ (_local6 << 8));
_local6 = (((_local8 >>> 2) ^ _local7) & 858993459);
_local7 = (_local7 ^ _local6);
_local8 = (_local8 ^ (_local6 << 2));
_local6 = (((_local7 >>> 16) ^ _local8) & 0xFFFF);
_local8 = (_local8 ^ _local6);
_local7 = (_local7 ^ (_local6 << 16));
_local6 = (((_local7 >>> 4) ^ _local8) & 252645135);
_local8 = (_local8 ^ _local6);
_local7 = (_local7 ^ (_local6 << 4));
_arg4[(_arg5 + 0)] = ((_local7 >>> 24) & 0xFF);
_arg4[(_arg5 + 1)] = ((_local7 >>> 16) & 0xFF);
_arg4[(_arg5 + 2)] = ((_local7 >>> 8) & 0xFF);
_arg4[(_arg5 + 3)] = (_local7 & 0xFF);
_arg4[(_arg5 + 4)] = ((_local8 >>> 24) & 0xFF);
_arg4[(_arg5 + 5)] = ((_local8 >>> 16) & 0xFF);
_arg4[(_arg5 + 6)] = ((_local8 >>> 8) & 0xFF);
_arg4[(_arg5 + 7)] = (_local8 & 0xFF);
}
public function toString():String{
return ("des");
}
public function getBlockSize():uint{
return (8);
}
}
}//package com.hurlant.crypto.symmetric
Section 20
//ECBMode (com.hurlant.crypto.symmetric.ECBMode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.util.*;
public class ECBMode implements IMode, ICipher {
private var key:ISymmetricKey;
private var padding:IPad;
public function ECBMode(_arg1:ISymmetricKey, _arg2:IPad=null){
this.key = _arg1;
if (_arg2 == null){
_arg2 = new PKCS5(_arg1.getBlockSize());
} else {
_arg2.setBlockSize(_arg1.getBlockSize());
};
this.padding = _arg2;
}
public function encrypt(_arg1:ByteArray):void{
var _local2:uint;
var _local3:ByteArray;
var _local4:ByteArray;
var _local5:uint;
padding.pad(_arg1);
_arg1.position = 0;
_local2 = key.getBlockSize();
_local3 = new ByteArray();
_local4 = new ByteArray();
_local5 = 0;
while (_local5 < _arg1.length) {
_local3.length = 0;
_arg1.readBytes(_local3, 0, _local2);
key.encrypt(_local3);
_local4.writeBytes(_local3);
_local5 = (_local5 + _local2);
};
_arg1.length = 0;
_arg1.writeBytes(_local4);
}
public function decrypt(_arg1:ByteArray):void{
var _local2:uint;
var _local3:ByteArray;
var _local4:ByteArray;
var _local5:uint;
_arg1.position = 0;
_local2 = key.getBlockSize();
if ((_arg1.length % _local2) != 0){
throw (new Error(("ECB mode cipher length must be a multiple of blocksize " + _local2)));
};
_local3 = new ByteArray();
_local4 = new ByteArray();
_local5 = 0;
while (_local5 < _arg1.length) {
_local3.length = 0;
_arg1.readBytes(_local3, 0, _local2);
key.decrypt(_local3);
_local4.writeBytes(_local3);
_local5 = (_local5 + _local2);
};
padding.unpad(_local4);
_arg1.length = 0;
_arg1.writeBytes(_local4);
}
public function dispose():void{
key.dispose();
key = null;
padding = null;
Memory.gc();
}
public function getBlockSize():uint{
return (key.getBlockSize());
}
public function toString():String{
return ((key.toString() + "-ecb"));
}
}
}//package com.hurlant.crypto.symmetric
Section 21
//ICipher (com.hurlant.crypto.symmetric.ICipher)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public interface ICipher {
function encrypt(_arg1:ByteArray):void;
function dispose():void;
function getBlockSize():uint;
function toString():String;
function decrypt(_arg1:ByteArray):void;
}
}//package com.hurlant.crypto.symmetric
Section 22
//IMode (com.hurlant.crypto.symmetric.IMode)
package com.hurlant.crypto.symmetric {
public interface IMode extends ICipher {
}
}//package com.hurlant.crypto.symmetric
Section 23
//IPad (com.hurlant.crypto.symmetric.IPad)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public interface IPad {
function pad(_arg1:ByteArray):void;
function unpad(_arg1:ByteArray):void;
function setBlockSize(_arg1:uint):void;
}
}//package com.hurlant.crypto.symmetric
Section 24
//IStreamCipher (com.hurlant.crypto.symmetric.IStreamCipher)
package com.hurlant.crypto.symmetric {
public interface IStreamCipher extends ICipher {
}
}//package com.hurlant.crypto.symmetric
Section 25
//ISymmetricKey (com.hurlant.crypto.symmetric.ISymmetricKey)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public interface ISymmetricKey {
function encrypt(_arg1:ByteArray, _arg2:uint=0):void;
function dispose():void;
function getBlockSize():uint;
function toString():String;
function decrypt(_arg1:ByteArray, _arg2:uint=0):void;
}
}//package com.hurlant.crypto.symmetric
Section 26
//IVMode (com.hurlant.crypto.symmetric.IVMode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.crypto.prng.*;
import com.hurlant.util.*;
public class IVMode {
protected var lastIV:ByteArray;
protected var iv:ByteArray;
protected var blockSize:uint;
protected var padding:IPad;
protected var prng:Random;
protected var key:ISymmetricKey;
public function IVMode(_arg1:ISymmetricKey, _arg2:IPad=null){
this.key = _arg1;
blockSize = _arg1.getBlockSize();
if (_arg2 == null){
_arg2 = new PKCS5(blockSize);
} else {
_arg2.setBlockSize(blockSize);
};
this.padding = _arg2;
prng = new Random();
iv = null;
lastIV = new ByteArray();
}
public function set IV(_arg1:ByteArray):void{
iv = _arg1;
lastIV.length = 0;
lastIV.writeBytes(iv);
}
protected function getIV4d():ByteArray{
var _local1:ByteArray;
_local1 = new ByteArray();
if (iv){
_local1.writeBytes(iv);
} else {
throw (new Error("an IV must be set before calling decrypt()"));
};
return (_local1);
}
protected function getIV4e():ByteArray{
var _local1:ByteArray;
_local1 = new ByteArray();
if (iv){
_local1.writeBytes(iv);
} else {
prng.nextBytes(_local1, blockSize);
};
lastIV.length = 0;
lastIV.writeBytes(_local1);
return (_local1);
}
public function get IV():ByteArray{
return (lastIV);
}
public function dispose():void{
var _local1:uint;
if (iv != null){
_local1 = 0;
while (_local1 < iv.length) {
iv[_local1] = prng.nextByte();
_local1++;
};
iv.length = 0;
iv = null;
};
if (lastIV != null){
_local1 = 0;
while (_local1 < iv.length) {
lastIV[_local1] = prng.nextByte();
_local1++;
};
lastIV.length = 0;
lastIV = null;
};
key.dispose();
key = null;
padding = null;
prng.dispose();
prng = null;
Memory.gc();
}
public function getBlockSize():uint{
return (key.getBlockSize());
}
}
}//package com.hurlant.crypto.symmetric
Section 27
//NullPad (com.hurlant.crypto.symmetric.NullPad)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public class NullPad implements IPad {
public function pad(_arg1:ByteArray):void{
}
public function unpad(_arg1:ByteArray):void{
}
public function setBlockSize(_arg1:uint):void{
}
}
}//package com.hurlant.crypto.symmetric
Section 28
//OFBMode (com.hurlant.crypto.symmetric.OFBMode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public class OFBMode extends IVMode implements IMode {
public function OFBMode(_arg1:ISymmetricKey, _arg2:IPad=null){
super(_arg1, null);
}
public function toString():String{
return ((key.toString() + "-ofb"));
}
private function core(_arg1:ByteArray, _arg2:ByteArray):void{
var _local3:uint;
var _local4:ByteArray;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local3 = _arg1.length;
_local4 = new ByteArray();
_local5 = 0;
while (_local5 < _arg1.length) {
key.encrypt(_arg2);
_local4.position = 0;
_local4.writeBytes(_arg2);
_local6 = (((_local5 + blockSize))<_local3) ? blockSize : (_local3 - _local5);
_local7 = 0;
while (_local7 < _local6) {
_arg1[(_local5 + _local7)] = (_arg1[(_local5 + _local7)] ^ _arg2[_local7]);
_local7++;
};
_arg2.position = 0;
_arg2.writeBytes(_local4);
_local5 = (_local5 + blockSize);
};
}
public function decrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
_local2 = getIV4d();
core(_arg1, _local2);
}
public function encrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
_local2 = getIV4e();
core(_arg1, _local2);
}
}
}//package com.hurlant.crypto.symmetric
Section 29
//PKCS5 (com.hurlant.crypto.symmetric.PKCS5)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public class PKCS5 implements IPad {
private var blockSize:uint;
public function PKCS5(_arg1:uint=0){
this.blockSize = _arg1;
}
public function unpad(_arg1:ByteArray):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
_local2 = (_arg1.length % blockSize);
if (_local2 != 0){
throw (new Error("PKCS#5::unpad: ByteArray.length isn't a multiple of the blockSize"));
};
_local2 = _arg1[(_arg1.length - 1)];
_local3 = _local2;
while (_local3 > 0) {
_local4 = _arg1[(_arg1.length - 1)];
_arg1.length--;
if (_local2 != _local4){
throw (new Error((((("PKCS#5:unpad: Invalid padding value. expected [" + _local2) + "], found [") + _local4) + "]")));
};
_local3--;
};
}
public function pad(_arg1:ByteArray):void{
var _local2:uint;
var _local3:uint;
_local2 = (blockSize - (_arg1.length % blockSize));
_local3 = 0;
while (_local3 < _local2) {
_arg1[_arg1.length] = _local2;
_local3++;
};
}
public function setBlockSize(_arg1:uint):void{
blockSize = _arg1;
}
}
}//package com.hurlant.crypto.symmetric
Section 30
//SimpleIVMode (com.hurlant.crypto.symmetric.SimpleIVMode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.util.*;
public class SimpleIVMode implements IMode, ICipher {
protected var mode:IVMode;
protected var cipher:ICipher;
public function SimpleIVMode(_arg1:IVMode){
this.mode = _arg1;
cipher = (_arg1 as ICipher);
}
public function encrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
cipher.encrypt(_arg1);
_local2 = new ByteArray();
_local2.writeBytes(mode.IV);
_local2.writeBytes(_arg1);
_arg1.position = 0;
_arg1.writeBytes(_local2);
}
public function decrypt(_arg1:ByteArray):void{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeBytes(_arg1, 0, getBlockSize());
mode.IV = _local2;
_local2 = new ByteArray();
_local2.writeBytes(_arg1, getBlockSize());
cipher.decrypt(_local2);
_arg1.length = 0;
_arg1.writeBytes(_local2);
}
public function dispose():void{
mode.dispose();
mode = null;
cipher = null;
Memory.gc();
}
public function toString():String{
return (("simple-" + cipher.toString()));
}
public function getBlockSize():uint{
return (mode.getBlockSize());
}
}
}//package com.hurlant.crypto.symmetric
Section 31
//TripleDESKey (com.hurlant.crypto.symmetric.TripleDESKey)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.util.*;
public class TripleDESKey extends DESKey {
protected var decKey2:Array;
protected var decKey3:Array;
protected var encKey2:Array;
protected var encKey3:Array;
public function TripleDESKey(_arg1:ByteArray){
super(_arg1);
encKey2 = generateWorkingKey(false, _arg1, 8);
decKey2 = generateWorkingKey(true, _arg1, 8);
if (_arg1.length > 16){
encKey3 = generateWorkingKey(true, _arg1, 16);
decKey3 = generateWorkingKey(false, _arg1, 16);
} else {
encKey3 = encKey;
decKey3 = decKey;
};
}
override public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{
desFunc(decKey3, _arg1, _arg2, _arg1, _arg2);
desFunc(decKey2, _arg1, _arg2, _arg1, _arg2);
desFunc(decKey, _arg1, _arg2, _arg1, _arg2);
}
override public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{
desFunc(encKey, _arg1, _arg2, _arg1, _arg2);
desFunc(encKey2, _arg1, _arg2, _arg1, _arg2);
desFunc(encKey3, _arg1, _arg2, _arg1, _arg2);
}
override public function dispose():void{
var _local1:uint;
super.dispose();
_local1 = 0;
if (encKey2 != null){
_local1 = 0;
while (_local1 < encKey2.length) {
encKey2[_local1] = 0;
_local1++;
};
encKey2 = null;
};
if (encKey3 != null){
_local1 = 0;
while (_local1 < encKey3.length) {
encKey3[_local1] = 0;
_local1++;
};
encKey3 = null;
};
if (decKey2 != null){
_local1 = 0;
while (_local1 < decKey2.length) {
decKey2[_local1] = 0;
_local1++;
};
decKey2 = null;
};
if (decKey3 != null){
_local1 = 0;
while (_local1 < decKey3.length) {
decKey3[_local1] = 0;
_local1++;
};
decKey3 = null;
};
Memory.gc();
}
override public function toString():String{
return ("3des");
}
}
}//package com.hurlant.crypto.symmetric
Section 32
//XTeaKey (com.hurlant.crypto.symmetric.XTeaKey)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.crypto.prng.*;
import com.hurlant.util.*;
public class XTeaKey implements ISymmetricKey {
public const NUM_ROUNDS:uint = 64;
private var k:Array;
public function XTeaKey(_arg1:ByteArray){
_arg1.position = 0;
k = [_arg1.readUnsignedInt(), _arg1.readUnsignedInt(), _arg1.readUnsignedInt(), _arg1.readUnsignedInt()];
}
public function dispose():void{
var _local1:Random;
var _local2:uint;
_local1 = new Random();
_local2 = 0;
while (_local2 < k.length) {
k[_local2] = _local1.nextByte();
delete k[_local2];
_local2++;
};
k = null;
Memory.gc();
}
public function encrypt(_arg1:ByteArray, _arg2:uint=0):void{
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_arg1.position = _arg2;
_local3 = _arg1.readUnsignedInt();
_local4 = _arg1.readUnsignedInt();
_local6 = 0;
_local7 = 2654435769;
_local5 = 0;
while (_local5 < NUM_ROUNDS) {
_local3 = (_local3 + ((((_local4 << 4) ^ (_local4 >> 5)) + _local4) ^ (_local6 + k[(_local6 & 3)])));
_local6 = (_local6 + _local7);
_local4 = (_local4 + ((((_local3 << 4) ^ (_local3 >> 5)) + _local3) ^ (_local6 + k[((_local6 >> 11) & 3)])));
_local5++;
};
_arg1.position = (_arg1.position - 8);
_arg1.writeUnsignedInt(_local3);
_arg1.writeUnsignedInt(_local4);
}
public function decrypt(_arg1:ByteArray, _arg2:uint=0):void{
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_arg1.position = _arg2;
_local3 = _arg1.readUnsignedInt();
_local4 = _arg1.readUnsignedInt();
_local6 = 2654435769;
_local7 = (_local6 * NUM_ROUNDS);
_local5 = 0;
while (_local5 < NUM_ROUNDS) {
_local4 = (_local4 - ((((_local3 << 4) ^ (_local3 >> 5)) + _local3) ^ (_local7 + k[((_local7 >> 11) & 3)])));
_local7 = (_local7 - _local6);
_local3 = (_local3 - ((((_local4 << 4) ^ (_local4 >> 5)) + _local4) ^ (_local7 + k[(_local7 & 3)])));
_local5++;
};
_arg1.position = (_arg1.position - 8);
_arg1.writeUnsignedInt(_local3);
_arg1.writeUnsignedInt(_local4);
}
public function toString():String{
return ("xtea");
}
public function getBlockSize():uint{
return (8);
}
public static function parseKey(_arg1:String):XTeaKey{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeUnsignedInt(parseInt(_arg1.substr(0, 8), 16));
_local2.writeUnsignedInt(parseInt(_arg1.substr(8, 8), 16));
_local2.writeUnsignedInt(parseInt(_arg1.substr(16, 8), 16));
_local2.writeUnsignedInt(parseInt(_arg1.substr(24, 8), 16));
_local2.position = 0;
return (new XTeaKey(_local2));
}
}
}//package com.hurlant.crypto.symmetric
Section 33
//Crypto (com.hurlant.crypto.Crypto)
package com.hurlant.crypto {
import flash.utils.*;
import com.hurlant.crypto.symmetric.*;
import com.hurlant.crypto.hash.*;
import com.hurlant.crypto.rsa.*;
import com.hurlant.crypto.prng.*;
import com.hurlant.util.*;
public class Crypto {
private var b64:Base64;
public static function getCipher(_arg1:String, _arg2:ByteArray, _arg3:IPad=null):ICipher{
var _local4:Array;
var _local5:ICipher;
_local4 = _arg1.split("-");
switch (_local4[0]){
case "simple":
_local4.shift();
_arg1 = _local4.join("-");
_local5 = getCipher(_arg1, _arg2, _arg3);
if ((_local5 is IVMode)){
return (new SimpleIVMode((_local5 as IVMode)));
};
return (_local5);
case "aes":
case "aes128":
case "aes192":
case "aes256":
_local4.shift();
if ((_arg2.length * 8) == _local4[0]){
_local4.shift();
};
return (getMode(_local4[0], new AESKey(_arg2), _arg3));
case "bf":
case "blowfish":
_local4.shift();
return (getMode(_local4[0], new BlowFishKey(_arg2), _arg3));
case "des":
_local4.shift();
if (((!((_local4[0] == "ede"))) && (!((_local4[0] == "ede3"))))){
return (getMode(_local4[0], new DESKey(_arg2), _arg3));
};
if (_local4.length == 1){
_local4.push("ecb");
};
case "3des":
case "des3":
_local4.shift();
return (getMode(_local4[0], new TripleDESKey(_arg2), _arg3));
case "xtea":
_local4.shift();
return (getMode(_local4[0], new XTeaKey(_arg2), _arg3));
case "rc4":
_local4.shift();
return (new ARC4(_arg2));
};
return (null);
}
public static function getHash(_arg1:String):IHash{
switch (_arg1){
case "md2":
return (new MD2());
case "md5":
return (new MD5());
case "sha":
case "sha1":
return (new SHA1());
case "sha224":
return (new SHA224());
case "sha256":
return (new SHA256());
};
return (null);
}
public static function getRSA(_arg1:String, _arg2:String):RSAKey{
return (RSAKey.parsePublicKey(_arg2, _arg1));
}
private static function getMode(_arg1:String, _arg2:ISymmetricKey, _arg3:IPad=null):IMode{
switch (_arg1){
case "ecb":
return (new ECBMode(_arg2, _arg3));
case "cfb":
return (new CFBMode(_arg2, _arg3));
case "cfb8":
return (new CFB8Mode(_arg2, _arg3));
case "ofb":
return (new OFBMode(_arg2, _arg3));
case "ctr":
return (new CTRMode(_arg2, _arg3));
case "cbc":
default:
return (new CBCMode(_arg2, _arg3));
};
}
public static function getKeySize(_arg1:String):uint{
var _local2:Array;
_local2 = _arg1.split("-");
switch (_local2[0]){
case "simple":
_local2.shift();
return (getKeySize(_local2.join("-")));
case "aes128":
return (16);
case "aes192":
return (24);
case "aes256":
return (32);
case "aes":
_local2.shift();
return ((parseInt(_local2[0]) / 8));
case "bf":
case "blowfish":
return (16);
case "des":
_local2.shift();
switch (_local2[0]){
case "ede":
return (16);
case "ede3":
return (24);
default:
return (8);
};
case "3des":
case "des3":
return (24);
case "xtea":
return (8);
case "rc4":
if (parseInt(_local2[1]) > 0){
return ((parseInt(_local2[1]) / 8));
};
return (16);
};
return (0);
}
public static function getPad(_arg1:String):IPad{
switch (_arg1){
case "null":
return (new NullPad());
case "pkcs5":
default:
return (new PKCS5());
};
}
public static function getHMAC(_arg1:String):HMAC{
var _local2:Array;
var _local3:uint;
_local2 = _arg1.split("-");
if (_local2[0] == "hmac"){
_local2.shift();
};
_local3 = 0;
if (_local2.length > 1){
_local3 = parseInt(_local2[1]);
};
return (new HMAC(getHash(_local2[0]), _local3));
}
}
}//package com.hurlant.crypto
Section 34
//BarrettReduction (com.hurlant.math.BarrettReduction)
package com.hurlant.math {
import com.hurlant.math.*;
class BarrettReduction implements IReduction {
private var r2:BigInteger;
private var q3:BigInteger;
private var mu:BigInteger;
private var m:BigInteger;
function BarrettReduction(_arg1:BigInteger){
r2 = new BigInteger();
q3 = new BigInteger();
BigInteger.ONE.dlShiftTo((2 * _arg1.t), r2);
mu = r2.divide(_arg1);
this.m = _arg1;
}
public function reduce(_arg1:BigInteger):void{
var _local2:BigInteger;
_local2 = (_arg1 as BigInteger);
_local2.drShiftTo((m.t - 1), r2);
if (_local2.t > (m.t + 1)){
_local2.t = (m.t + 1);
_local2.clamp();
};
mu.multiplyUpperTo(r2, (m.t + 1), q3);
m.multiplyLowerTo(q3, (m.t + 1), r2);
while (_local2.compareTo(r2) < 0) {
_local2.dAddOffset(1, (m.t + 1));
};
_local2.subTo(r2, _local2);
while (_local2.compareTo(m) >= 0) {
_local2.subTo(m, _local2);
};
}
public function revert(_arg1:BigInteger):BigInteger{
return (_arg1);
}
public function convert(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
if ((((_arg1.s < 0)) || ((_arg1.t > (2 * m.t))))){
return (_arg1.mod(m));
};
if (_arg1.compareTo(m) < 0){
return (_arg1);
};
_local2 = new BigInteger();
_arg1.copyTo(_local2);
reduce(_local2);
return (_local2);
}
public function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void{
_arg1.squareTo(_arg2);
reduce(_arg2);
}
public function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void{
_arg1.multiplyTo(_arg2, _arg3);
reduce(_arg3);
}
}
}//package com.hurlant.math
Section 35
//bi_internal (com.hurlant.math.bi_internal)
package com.hurlant.math {
public namespace bi_internal = "http://crypto.hurlant.com/BigInteger";
}//package com.hurlant.math
Section 36
//BigInteger (com.hurlant.math.BigInteger)
package com.hurlant.math {
import flash.utils.*;
import com.hurlant.crypto.prng.*;
import com.hurlant.util.*;
public class BigInteger {
bi_internal var a:Array;
bi_internal var s:int;
public var t:int;
public static const ONE:BigInteger = nbv(1);
public static const ZERO:BigInteger = nbv(0);
public static const DM:int = (DV - 1);
public static const F1:int = 22;
public static const F2:int = 8;
public static const lplim:int = ((1 << 26) / lowprimes[(lowprimes.length - 1)]);
public static const lowprimes:Array = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 0x0101, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509];
public static const FV:Number = Math.pow(2, BI_FP);
public static const BI_FP:int = 52;
public static const DV:int = (1 << DB);
public static const DB:int = 30;
public function BigInteger(_arg1=null, _arg2:int=0){
var _local3:ByteArray;
var _local4:int;
super();
a = new Array();
if ((_arg1 is String)){
_arg1 = Hex.toArray(_arg1);
_arg2 = 0;
};
if ((_arg1 is ByteArray)){
_local3 = (_arg1 as ByteArray);
_local4 = ((_arg2) || ((_local3.length - _local3.position)));
fromArray(_local3, _local4);
};
}
public function clearBit(_arg1:int):BigInteger{
return (changeBit(_arg1, op_andnot));
}
public function negate():BigInteger{
var _local1:BigInteger;
_local1 = nbi();
ZERO.subTo(this, _local1);
return (_local1);
}
public function andNot(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
bitwiseTo(_arg1, op_andnot, _local2);
return (_local2);
}
public function modPow(_arg1:BigInteger, _arg2:BigInteger):BigInteger{
var _local3:int;
var _local4:int;
var _local5:BigInteger;
var _local6:IReduction;
var _local7:Array;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:Boolean;
var _local14:BigInteger;
var _local15:BigInteger;
var _local16:BigInteger;
_local3 = _arg1.bitLength();
_local5 = nbv(1);
if (_local3 <= 0){
return (_local5);
};
if (_local3 < 18){
_local4 = 1;
} else {
if (_local3 < 48){
_local4 = 3;
} else {
if (_local3 < 144){
_local4 = 4;
} else {
if (_local3 < 0x0300){
_local4 = 5;
} else {
_local4 = 6;
};
};
};
};
if (_local3 < 8){
_local6 = new ClassicReduction(_arg2);
} else {
if (_arg2.isEven()){
_local6 = new BarrettReduction(_arg2);
} else {
_local6 = new MontgomeryReduction(_arg2);
};
};
_local7 = [];
_local8 = 3;
_local9 = (_local4 - 1);
_local10 = ((1 << _local4) - 1);
_local7[1] = _local6.convert(this);
if (_local4 > 1){
_local16 = new BigInteger();
_local6.sqrTo(_local7[1], _local16);
while (_local8 <= _local10) {
_local7[_local8] = new BigInteger();
_local6.mulTo(_local16, _local7[(_local8 - 2)], _local7[_local8]);
_local8 = (_local8 + 2);
};
};
_local11 = (_arg1.t - 1);
_local13 = true;
_local14 = new BigInteger();
_local3 = (nbits(_arg1.a[_local11]) - 1);
while (_local11 >= 0) {
if (_local3 >= _local9){
_local12 = ((_arg1.a[_local11] >> (_local3 - _local9)) & _local10);
} else {
_local12 = ((_arg1.a[_local11] & ((1 << (_local3 + 1)) - 1)) << (_local9 - _local3));
if (_local11 > 0){
_local12 = (_local12 | (_arg1.a[(_local11 - 1)] >> ((DB + _local3) - _local9)));
};
};
_local8 = _local4;
while ((_local12 & 1) == 0) {
_local12 = (_local12 >> 1);
_local8--;
};
_local3 = (_local3 - _local8);
if (_local3 < 0){
_local3 = (_local3 + DB);
_local11--;
};
if (_local13){
_local7[_local12].copyTo(_local5);
_local13 = false;
} else {
while (_local8 > 1) {
_local6.sqrTo(_local5, _local14);
_local6.sqrTo(_local14, _local5);
_local8 = (_local8 - 2);
};
if (_local8 > 0){
_local6.sqrTo(_local5, _local14);
} else {
_local15 = _local5;
_local5 = _local14;
_local14 = _local15;
};
_local6.mulTo(_local14, _local7[_local12], _local5);
};
while ((((_local11 >= 0)) && (((_arg1.a[_local11] & (1 << _local3)) == 0)))) {
_local6.sqrTo(_local5, _local14);
_local15 = _local5;
_local5 = _local14;
_local14 = _local15;
--_local3;
if (_local3 < 0){
_local3 = (DB - 1);
_local11--;
};
};
};
return (_local6.revert(_local5));
}
public function isProbablePrime(_arg1:int):Boolean{
var _local2:int;
var _local3:BigInteger;
var _local4:int;
var _local5:int;
_local3 = abs();
if ((((_local3.t == 1)) && ((_local3.a[0] <= lowprimes[(lowprimes.length - 1)])))){
_local2 = 0;
while (_local2 < lowprimes.length) {
if (_local3[0] == lowprimes[_local2]){
return (true);
};
_local2++;
};
return (false);
};
if (_local3.isEven()){
return (false);
};
_local2 = 1;
while (_local2 < lowprimes.length) {
_local4 = lowprimes[_local2];
_local5 = (_local2 + 1);
while ((((_local5 < lowprimes.length)) && ((_local4 < lplim)))) {
var _temp1 = _local5;
_local5 = (_local5 + 1);
_local4 = (_local4 * lowprimes[_temp1]);
};
_local4 = _local3.modInt(_local4);
while (_local2 < _local5) {
var _temp2 = _local4;
var _temp3 = _local2;
_local2 = (_local2 + 1);
if ((_temp2 % lowprimes[_temp3]) == 0){
return (false);
};
};
};
return (_local3.millerRabin(_arg1));
}
private function op_or(_arg1:int, _arg2:int):int{
return ((_arg1 | _arg2));
}
public function mod(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = nbi();
abs().divRemTo(_arg1, null, _local2);
if ((((s < 0)) && ((_local2.compareTo(ZERO) > 0)))){
_arg1.subTo(_local2, _local2);
};
return (_local2);
}
protected function addTo(_arg1:BigInteger, _arg2:BigInteger):void{
var _local3:int;
var _local4:int;
var _local5:int;
_local3 = 0;
_local4 = 0;
_local5 = Math.min(_arg1.t, t);
while (_local3 < _local5) {
_local4 = (_local4 + (this.a[_local3] + _arg1.a[_local3]));
var _temp1 = _local3;
_local3 = (_local3 + 1);
var _local6 = _temp1;
_arg2.a[_local6] = (_local4 & DM);
_local4 = (_local4 >> DB);
};
if (_arg1.t < t){
_local4 = (_local4 + _arg1.s);
while (_local3 < t) {
_local4 = (_local4 + this.a[_local3]);
var _temp2 = _local3;
_local3 = (_local3 + 1);
_local6 = _temp2;
_arg2.a[_local6] = (_local4 & DM);
_local4 = (_local4 >> DB);
};
_local4 = (_local4 + s);
} else {
_local4 = (_local4 + s);
while (_local3 < _arg1.t) {
_local4 = (_local4 + _arg1.a[_local3]);
var _temp3 = _local3;
_local3 = (_local3 + 1);
_local6 = _temp3;
_arg2.a[_local6] = (_local4 & DM);
_local4 = (_local4 >> DB);
};
_local4 = (_local4 + _arg1.s);
};
_arg2.s = ((_local4)<0) ? -1 : 0;
if (_local4 > 0){
var _temp4 = _local3;
_local3 = (_local3 + 1);
_local6 = _temp4;
_arg2.a[_local6] = _local4;
} else {
if (_local4 < -1){
var _temp5 = _local3;
_local3 = (_local3 + 1);
_local6 = _temp5;
_arg2.a[_local6] = (DV + _local4);
};
};
_arg2.t = _local3;
_arg2.clamp();
}
protected function bitwiseTo(_arg1:BigInteger, _arg2:Function, _arg3:BigInteger):void{
var _local4:int;
var _local5:int;
var _local6:int;
_local6 = Math.min(_arg1.t, t);
_local4 = 0;
while (_local4 < _local6) {
_arg3.a[_local4] = _arg2(this.a[_local4], _arg1.a[_local4]);
_local4++;
};
if (_arg1.t < t){
_local5 = (_arg1.s & DM);
_local4 = _local6;
while (_local4 < t) {
_arg3.a[_local4] = _arg2(this.a[_local4], _local5);
_local4++;
};
_arg3.t = t;
} else {
_local5 = (s & DM);
_local4 = _local6;
while (_local4 < _arg1.t) {
_arg3.a[_local4] = _arg2(_local5, _arg1.a[_local4]);
_local4++;
};
_arg3.t = _arg1.t;
};
_arg3.s = _arg2(s, _arg1.s);
_arg3.clamp();
}
protected function modInt(_arg1:int):int{
var _local2:int;
var _local3:int;
var _local4:int;
if (_arg1 <= 0){
return (0);
};
_local2 = (DV % _arg1);
_local3 = ((s)<0) ? (_arg1 - 1) : 0;
if (t > 0){
if (_local2 == 0){
_local3 = (a[0] % _arg1);
} else {
_local4 = (t - 1);
while (_local4 >= 0) {
_local3 = (((_local2 * _local3) + a[_local4]) % _arg1);
_local4--;
};
};
};
return (_local3);
}
protected function chunkSize(_arg1:Number):int{
return (Math.floor(((Math.LN2 * DB) / Math.log(_arg1))));
}
bi_internal function dAddOffset(_arg1:int, _arg2:int):void{
while (t <= _arg2) {
var _local3 = t++;
a[_local3] = 0;
};
a[_arg2] = (a[_arg2] + _arg1);
while (a[_arg2] >= DV) {
a[_arg2] = (a[_arg2] - DV);
++_arg2;
if (_arg2 >= t){
_local3 = t++;
a[_local3] = 0;
};
_local3 = a;
var _local4 = _arg2;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
};
}
bi_internal function lShiftTo(_arg1:int, _arg2:BigInteger):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
_local3 = (_arg1 % DB);
_local4 = (DB - _local3);
_local5 = ((1 << _local4) - 1);
_local6 = (_arg1 / DB);
_local7 = ((s << _local3) & DM);
_local8 = (t - 1);
while (_local8 >= 0) {
_arg2.a[((_local8 + _local6) + 1)] = ((a[_local8] >> _local4) | _local7);
_local7 = ((a[_local8] & _local5) << _local3);
_local8--;
};
_local8 = (_local6 - 1);
while (_local8 >= 0) {
_arg2.a[_local8] = 0;
_local8--;
};
_arg2.a[_local6] = _local7;
_arg2.t = ((t + _local6) + 1);
_arg2.s = s;
_arg2.clamp();
}
public function getLowestSetBit():int{
var _local1:int;
_local1 = 0;
while (_local1 < t) {
if (a[_local1] != 0){
return (((_local1 * DB) + lbit(a[_local1])));
};
_local1++;
};
if (s < 0){
return ((t * DB));
};
return (-1);
}
public function subtract(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
subTo(_arg1, _local2);
return (_local2);
}
public function primify(_arg1:int, _arg2:int):void{
if (!testBit((_arg1 - 1))){
bitwiseTo(BigInteger.ONE.shiftLeft((_arg1 - 1)), op_or, this);
};
if (isEven()){
dAddOffset(1, 0);
};
while (!(isProbablePrime(_arg2))) {
dAddOffset(2, 0);
while (bitLength() > _arg1) {
subTo(BigInteger.ONE.shiftLeft((_arg1 - 1)), this);
};
};
}
public function gcd(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
var _local3:BigInteger;
var _local4:int;
var _local5:int;
var _local6:BigInteger;
_local2 = ((s)<0) ? negate() : clone();
_local3 = ((_arg1.s)<0) ? _arg1.negate() : _arg1.clone();
if (_local2.compareTo(_local3) < 0){
_local6 = _local2;
_local2 = _local3;
_local3 = _local6;
};
_local4 = _local2.getLowestSetBit();
_local5 = _local3.getLowestSetBit();
if (_local5 < 0){
return (_local2);
};
if (_local4 < _local5){
_local5 = _local4;
};
if (_local5 > 0){
_local2.rShiftTo(_local5, _local2);
_local3.rShiftTo(_local5, _local3);
};
while (_local2.sigNum() > 0) {
_local4 = _local2.getLowestSetBit();
if (_local4 > 0){
_local2.rShiftTo(_local4, _local2);
};
_local4 = _local3.getLowestSetBit();
if (_local4 > 0){
_local3.rShiftTo(_local4, _local3);
};
if (_local2.compareTo(_local3) >= 0){
_local2.subTo(_local3, _local2);
_local2.rShiftTo(1, _local2);
} else {
_local3.subTo(_local2, _local3);
_local3.rShiftTo(1, _local3);
};
};
if (_local5 > 0){
_local3.lShiftTo(_local5, _local3);
};
return (_local3);
}
bi_internal function multiplyLowerTo(_arg1:BigInteger, _arg2:int, _arg3:BigInteger):void{
var _local4:int;
var _local5:int;
_local4 = Math.min((t + _arg1.t), _arg2);
_arg3.s = 0;
_arg3.t = _local4;
while (_local4 > 0) {
--_local4;
var _local6 = _local4;
_arg3.a[_local6] = 0;
};
_local5 = (_arg3.t - t);
while (_local4 < _local5) {
_arg3.a[(_local4 + t)] = am(0, _arg1.a[_local4], _arg3, _local4, 0, t);
_local4++;
};
_local5 = Math.min(_arg1.t, _arg2);
while (_local4 < _local5) {
am(0, _arg1.a[_local4], _arg3, _local4, 0, (_arg2 - _local4));
_local4++;
};
_arg3.clamp();
}
public function modPowInt(_arg1:int, _arg2:BigInteger):BigInteger{
var _local3:IReduction;
if ((((_arg1 < 0x0100)) || (_arg2.isEven()))){
_local3 = new ClassicReduction(_arg2);
} else {
_local3 = new MontgomeryReduction(_arg2);
};
return (exp(_arg1, _local3));
}
bi_internal function intAt(_arg1:String, _arg2:int):int{
return (parseInt(_arg1.charAt(_arg2), 36));
}
public function testBit(_arg1:int):Boolean{
var _local2:int;
_local2 = Math.floor((_arg1 / DB));
if (_local2 >= t){
return (!((s == 0)));
};
return (!(((a[_local2] & (1 << (_arg1 % DB))) == 0)));
}
bi_internal function exp(_arg1:int, _arg2:IReduction):BigInteger{
var _local3:BigInteger;
var _local4:BigInteger;
var _local5:BigInteger;
var _local6:int;
var _local7:BigInteger;
if ((((_arg1 > 4294967295)) || ((_arg1 < 1)))){
return (ONE);
};
_local3 = nbi();
_local4 = nbi();
_local5 = _arg2.convert(this);
_local6 = (nbits(_arg1) - 1);
_local5.copyTo(_local3);
while (--_local6 >= 0) {
_arg2.sqrTo(_local3, _local4);
if ((_arg1 & (1 << _local6)) > 0){
_arg2.mulTo(_local4, _local5, _local3);
} else {
_local7 = _local3;
_local3 = _local4;
_local4 = _local7;
};
};
return (_arg2.revert(_local3));
}
public function toArray(_arg1:ByteArray):uint{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Boolean;
var _local8:int;
_local2 = 8;
_local3 = ((1 << 8) - 1);
_local4 = 0;
_local5 = t;
_local6 = (DB - ((_local5 * DB) % _local2));
_local7 = false;
_local8 = 0;
var _temp1 = _local5;
_local5 = (_local5 - 1);
if (_temp1 > 0){
if ((((_local6 < DB)) && (((a[_local5] >> _local6) > 0)))){
_local7 = true;
_arg1.writeByte(_local4);
_local8++;
};
while (_local5 >= 0) {
if (_local6 < _local2){
_local4 = ((a[_local5] & ((1 << _local6) - 1)) << (_local2 - _local6));
var _temp2 = _local4;
_local5 = (_local5 - 1);
_local6 = (_local6 + (DB - _local2));
_local4 = (_temp2 | (a[_local5] >> _local6));
} else {
_local6 = (_local6 - _local2);
_local4 = ((a[_local5] >> _local6) & _local3);
if (_local6 <= 0){
_local6 = (_local6 + DB);
_local5--;
};
};
if (_local4 > 0){
_local7 = true;
};
if (_local7){
_arg1.writeByte(_local4);
_local8++;
};
};
};
return (_local8);
}
public function dispose():void{
var _local1:Random;
var _local2:uint;
_local1 = new Random();
_local2 = 0;
while (_local2 < a.length) {
a[_local2] = _local1.nextByte();
delete a[_local2];
_local2++;
};
a = null;
t = 0;
s = 0;
Memory.gc();
}
private function lbit(_arg1:int):int{
var _local2:int;
if (_arg1 == 0){
return (-1);
};
_local2 = 0;
if ((_arg1 & 0xFFFF) == 0){
_arg1 = (_arg1 >> 16);
_local2 = (_local2 + 16);
};
if ((_arg1 & 0xFF) == 0){
_arg1 = (_arg1 >> 8);
_local2 = (_local2 + 8);
};
if ((_arg1 & 15) == 0){
_arg1 = (_arg1 >> 4);
_local2 = (_local2 + 4);
};
if ((_arg1 & 3) == 0){
_arg1 = (_arg1 >> 2);
_local2 = (_local2 + 2);
};
if ((_arg1 & 1) == 0){
_local2++;
};
return (_local2);
}
bi_internal function divRemTo(_arg1:BigInteger, _arg2:BigInteger=null, _arg3:BigInteger=null):void{
var pm:BigInteger;
var pt:BigInteger;
var y:BigInteger;
var ts:int;
var ms:int;
var nsh:int;
var ys:int;
var y0:int;
var yt:Number;
var d1:Number;
var d2:Number;
var e:Number;
var i:int;
var j:int;
var t:BigInteger;
var qd:int;
var m = _arg1;
var q = _arg2;
var r = _arg3;
pm = m.abs();
if (pm.t <= 0){
return;
};
pt = abs();
if (pt.t < pm.t){
if (q != null){
q.fromInt(0);
};
if (r != null){
copyTo(r);
};
return;
};
if (r == null){
r = nbi();
};
y = nbi();
ts = s;
ms = m.s;
nsh = (DB - nbits(pm.a[(pm.t - 1)]));
if (nsh > 0){
pm.lShiftTo(nsh, y);
pt.lShiftTo(nsh, r);
} else {
pm.copyTo(y);
pt.copyTo(r);
};
ys = y.t;
y0 = y.a[(ys - 1)];
if (y0 == 0){
return;
};
yt = ((y0 * (1 << F1)) + ((ys)>1) ? (y.a[(ys - 2)] >> F2) : 0);
d1 = (FV / yt);
d2 = ((1 << F1) / yt);
e = (1 << F2);
i = r.t;
j = (i - ys);
t = ((q)==null) ? nbi() : q;
y.dlShiftTo(j, t);
if (r.compareTo(t) >= 0){
var _local5 = r.t++;
r.a[_local5] = 1;
r.subTo(t, r);
};
ONE.dlShiftTo(ys, t);
t.subTo(y, y);
while (y.t < ys) {
y.(y.t++); //not popped
};
while ((j = (j - 1)), (j - 1) >= 0) {
i = (i - 1);
qd = ((r.a[(i - 1)])==y0) ? DM : ((Number(r.a[i]) * d1) + ((Number(r.a[(i - 1)]) + e) * d2));
if ((r.a[i] = (r.a[i] + y.am(0, qd, r, j, 0, ys))) < qd){
y.dlShiftTo(j, t);
r.subTo(t, r);
while ((qd = (qd - 1)), r.a[i] < (qd - 1)) {
r.subTo(t, r);
};
};
};
if (q != null){
r.drShiftTo(ys, q);
if (ts != ms){
ZERO.subTo(q, q);
};
};
r.t = ys;
r.clamp();
if (nsh > 0){
r.rShiftTo(nsh, r);
};
if (ts < 0){
ZERO.subTo(r, r);
};
}
public function remainder(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
divRemTo(_arg1, null, _local2);
return (_local2);
}
public function divide(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
divRemTo(_arg1, _local2, null);
return (_local2);
}
public function divideAndRemainder(_arg1:BigInteger):Array{
var _local2:BigInteger;
var _local3:BigInteger;
_local2 = new BigInteger();
_local3 = new BigInteger();
divRemTo(_arg1, _local2, _local3);
return ([_local2, _local3]);
}
public function valueOf():Number{
var _local1:Number;
var _local2:Number;
var _local3:uint;
_local1 = 1;
_local2 = 0;
_local3 = 0;
while (_local3 < t) {
_local2 = (_local2 + (a[_local3] * _local1));
_local1 = (_local1 * DV);
_local3++;
};
return (_local2);
}
public function shiftLeft(_arg1:int):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
if (_arg1 < 0){
rShiftTo(-(_arg1), _local2);
} else {
lShiftTo(_arg1, _local2);
};
return (_local2);
}
public function multiply(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
multiplyTo(_arg1, _local2);
return (_local2);
}
bi_internal function am(_arg1:int, _arg2:int, _arg3:BigInteger, _arg4:int, _arg5:int, _arg6:int):int{
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
_local7 = (_arg2 & 32767);
_local8 = (_arg2 >> 15);
while (--_arg6 >= 0) {
_local9 = (a[_arg1] & 32767);
var _temp1 = _arg1;
_arg1 = (_arg1 + 1);
_local10 = (a[_temp1] >> 15);
_local11 = ((_local8 * _local9) + (_local10 * _local7));
_local9 = ((((_local7 * _local9) + ((_local11 & 32767) << 15)) + _arg3.a[_arg4]) + (_arg5 & 1073741823));
_arg5 = ((((_local9 >>> 30) + (_local11 >>> 15)) + (_local8 * _local10)) + (_arg5 >>> 30));
var _temp2 = _arg4;
_arg4 = (_arg4 + 1);
var _local12 = _temp2;
_arg3.a[_local12] = (_local9 & 1073741823);
};
return (_arg5);
}
bi_internal function drShiftTo(_arg1:int, _arg2:BigInteger):void{
var _local3:int;
_local3 = _arg1;
while (_local3 < t) {
_arg2.a[(_local3 - _arg1)] = a[_local3];
_local3++;
};
_arg2.t = Math.max((t - _arg1), 0);
_arg2.s = s;
}
public function add(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
addTo(_arg1, _local2);
return (_local2);
}
bi_internal function multiplyUpperTo(_arg1:BigInteger, _arg2:int, _arg3:BigInteger):void{
var _local4:int;
_arg2--;
_local4 = (_arg3.t = ((t + _arg1.t) - _arg2));
_arg3.s = 0;
while (--_local4 >= 0) {
_arg3.a[_local4] = 0;
};
_local4 = Math.max((_arg2 - t), 0);
while (_local4 < _arg1.t) {
_arg3.a[((t + _local4) - _arg2)] = am((_arg2 - _local4), _arg1.a[_local4], _arg3, 0, 0, ((t + _local4) - _arg2));
_local4++;
};
_arg3.clamp();
_arg3.drShiftTo(1, _arg3);
}
protected function nbi(){
return (new BigInteger());
}
protected function millerRabin(_arg1:int):Boolean{
var _local2:BigInteger;
var _local3:int;
var _local4:BigInteger;
var _local5:BigInteger;
var _local6:int;
var _local7:BigInteger;
var _local8:int;
_local2 = subtract(BigInteger.ONE);
_local3 = _local2.getLowestSetBit();
if (_local3 <= 0){
return (false);
};
_local4 = _local2.shiftRight(_local3);
_arg1 = ((_arg1 + 1) >> 1);
if (_arg1 > lowprimes.length){
_arg1 = lowprimes.length;
};
_local5 = new BigInteger();
_local6 = 0;
while (_local6 < _arg1) {
_local5.fromInt(lowprimes[_local6]);
_local7 = _local5.modPow(_local4, this);
if (((!((_local7.compareTo(BigInteger.ONE) == 0))) && (!((_local7.compareTo(_local2) == 0))))){
_local8 = 1;
while ((((_local8++ < _local3)) && (!((_local7.compareTo(_local2) == 0))))) {
_local7 = _local7.modPowInt(2, this);
if (_local7.compareTo(BigInteger.ONE) == 0){
return (false);
};
};
if (_local7.compareTo(_local2) != 0){
return (false);
};
};
_local6++;
};
return (true);
}
bi_internal function dMultiply(_arg1:int):void{
a[t] = am(0, (_arg1 - 1), this, 0, 0, t);
t++;
clamp();
}
private function op_andnot(_arg1:int, _arg2:int):int{
return ((_arg1 & ~(_arg2)));
}
bi_internal function clamp():void{
var _local1:int;
_local1 = (s & DM);
while ((((t > 0)) && ((a[(t - 1)] == _local1)))) {
t--;
};
}
bi_internal function invDigit():int{
var _local1:int;
var _local2:int;
if (t < 1){
return (0);
};
_local1 = a[0];
if ((_local1 & 1) == 0){
return (0);
};
_local2 = (_local1 & 3);
_local2 = ((_local2 * (2 - ((_local1 & 15) * _local2))) & 15);
_local2 = ((_local2 * (2 - ((_local1 & 0xFF) * _local2))) & 0xFF);
_local2 = ((_local2 * (2 - (((_local1 & 0xFFFF) * _local2) & 0xFFFF))) & 0xFFFF);
_local2 = ((_local2 * (2 - ((_local1 * _local2) % DV))) % DV);
return (((_local2)>0) ? (DV - _local2) : -(_local2));
}
protected function changeBit(_arg1:int, _arg2:Function):BigInteger{
var _local3:BigInteger;
_local3 = BigInteger.ONE.shiftLeft(_arg1);
bitwiseTo(_local3, _arg2, _local3);
return (_local3);
}
public function equals(_arg1:BigInteger):Boolean{
return ((compareTo(_arg1) == 0));
}
public function compareTo(_arg1:BigInteger):int{
var _local2:int;
var _local3:int;
_local2 = (s - _arg1.s);
if (_local2 != 0){
return (_local2);
};
_local3 = t;
_local2 = (_local3 - _arg1.t);
if (_local2 != 0){
return (_local2);
};
while (--_local3 >= 0) {
_local2 = (a[_local3] - _arg1.a[_local3]);
if (_local2 != 0){
return (_local2);
};
};
return (0);
}
public function shiftRight(_arg1:int):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
if (_arg1 < 0){
lShiftTo(-(_arg1), _local2);
} else {
rShiftTo(_arg1, _local2);
};
return (_local2);
}
bi_internal function multiplyTo(_arg1:BigInteger, _arg2:BigInteger):void{
var _local3:BigInteger;
var _local4:BigInteger;
var _local5:int;
_local3 = abs();
_local4 = _arg1.abs();
_local5 = _local3.t;
_arg2.t = (_local5 + _local4.t);
while (--_local5 >= 0) {
_arg2.a[_local5] = 0;
};
_local5 = 0;
while (_local5 < _local4.t) {
_arg2.a[(_local5 + _local3.t)] = _local3.am(0, _local4.a[_local5], _arg2, _local5, 0, _local3.t);
_local5++;
};
_arg2.s = 0;
_arg2.clamp();
if (s != _arg1.s){
ZERO.subTo(_arg2, _arg2);
};
}
public function bitCount():int{
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = 0;
_local2 = (s & DM);
_local3 = 0;
while (_local3 < t) {
_local1 = (_local1 + cbit((a[_local3] ^ _local2)));
_local3++;
};
return (_local1);
}
public function byteValue():int{
return (((t)==0) ? s : ((a[0] << 24) >> 24));
}
private function cbit(_arg1:int):int{
var _local2:uint;
_local2 = 0;
while (_arg1 != 0) {
_arg1 = (_arg1 & (_arg1 - 1));
_local2++;
};
return (_local2);
}
bi_internal function rShiftTo(_arg1:int, _arg2:BigInteger):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
_arg2.s = s;
_local3 = (_arg1 / DB);
if (_local3 >= t){
_arg2.t = 0;
return;
};
_local4 = (_arg1 % DB);
_local5 = (DB - _local4);
_local6 = ((1 << _local4) - 1);
_arg2.a[0] = (a[_local3] >> _local4);
_local7 = (_local3 + 1);
while (_local7 < t) {
_arg2.a[((_local7 - _local3) - 1)] = (_arg2.a[((_local7 - _local3) - 1)] | ((a[_local7] & _local6) << _local5));
_arg2.a[(_local7 - _local3)] = (a[_local7] >> _local4);
_local7++;
};
if (_local4 > 0){
_arg2.a[((t - _local3) - 1)] = (_arg2.a[((t - _local3) - 1)] | ((s & _local6) << _local5));
};
_arg2.t = (t - _local3);
_arg2.clamp();
}
public function modInverse(_arg1:BigInteger):BigInteger{
var _local2:Boolean;
var _local3:BigInteger;
var _local4:BigInteger;
var _local5:BigInteger;
var _local6:BigInteger;
var _local7:BigInteger;
var _local8:BigInteger;
_local2 = _arg1.isEven();
if (((((isEven()) && (_local2))) || ((_arg1.sigNum() == 0)))){
return (BigInteger.ZERO);
};
_local3 = _arg1.clone();
_local4 = clone();
_local5 = nbv(1);
_local6 = nbv(0);
_local7 = nbv(0);
_local8 = nbv(1);
while (_local3.sigNum() != 0) {
while (_local3.isEven()) {
_local3.rShiftTo(1, _local3);
if (_local2){
if (((!(_local5.isEven())) || (!(_local6.isEven())))){
_local5.addTo(this, _local5);
_local6.subTo(_arg1, _local6);
};
_local5.rShiftTo(1, _local5);
} else {
if (!_local6.isEven()){
_local6.subTo(_arg1, _local6);
};
};
_local6.rShiftTo(1, _local6);
};
while (_local4.isEven()) {
_local4.rShiftTo(1, _local4);
if (_local2){
if (((!(_local7.isEven())) || (!(_local8.isEven())))){
_local7.addTo(this, _local7);
_local8.subTo(_arg1, _local8);
};
_local7.rShiftTo(1, _local7);
} else {
if (!_local8.isEven()){
_local8.subTo(_arg1, _local8);
};
};
_local8.rShiftTo(1, _local8);
};
if (_local3.compareTo(_local4) >= 0){
_local3.subTo(_local4, _local3);
if (_local2){
_local5.subTo(_local7, _local5);
};
_local6.subTo(_local8, _local6);
} else {
_local4.subTo(_local3, _local4);
if (_local2){
_local7.subTo(_local5, _local7);
};
_local8.subTo(_local6, _local8);
};
};
if (_local4.compareTo(BigInteger.ONE) != 0){
return (BigInteger.ZERO);
};
if (_local8.compareTo(_arg1) >= 0){
return (_local8.subtract(_arg1));
};
if (_local8.sigNum() < 0){
_local8.addTo(_arg1, _local8);
} else {
return (_local8);
};
if (_local8.sigNum() < 0){
return (_local8.add(_arg1));
};
return (_local8);
}
bi_internal function fromArray(_arg1:ByteArray, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
_local3 = _arg1.position;
_local4 = (_local3 + _arg2);
_local5 = 0;
_local6 = 8;
t = 0;
s = 0;
while (--_local4 >= _local3) {
_local7 = ((_local4 < _arg1.length)) ? _arg1[_local4] : 0;
if (_local5 == 0){
var _local8 = t++;
a[_local8] = _local7;
} else {
if ((_local5 + _local6) > DB){
a[(t - 1)] = (a[(t - 1)] | ((_local7 & ((1 << (DB - _local5)) - 1)) << _local5));
_local8 = t++;
a[_local8] = (_local7 >> (DB - _local5));
} else {
a[(t - 1)] = (a[(t - 1)] | (_local7 << _local5));
};
};
_local5 = (_local5 + _local6);
if (_local5 >= DB){
_local5 = (_local5 - DB);
};
};
clamp();
_arg1.position = Math.min((_local3 + _arg2), _arg1.length);
}
bi_internal function copyTo(_arg1:BigInteger):void{
var _local2:int;
_local2 = (t - 1);
while (_local2 >= 0) {
_arg1.a[_local2] = a[_local2];
_local2--;
};
_arg1.t = t;
_arg1.s = s;
}
public function intValue():int{
if (s < 0){
if (t == 1){
return ((a[0] - DV));
};
if (t == 0){
return (-1);
};
} else {
if (t == 1){
return (a[0]);
};
if (t == 0){
return (0);
};
};
return ((((a[1] & ((1 << (32 - DB)) - 1)) << DB) | a[0]));
}
public function min(_arg1:BigInteger):BigInteger{
return (((compareTo(_arg1))<0) ? this : _arg1);
}
public function bitLength():int{
if (t <= 0){
return (0);
};
return (((DB * (t - 1)) + nbits((a[(t - 1)] ^ (s & DM)))));
}
public function shortValue():int{
return (((t)==0) ? s : ((a[0] << 16) >> 16));
}
public function and(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
bitwiseTo(_arg1, op_and, _local2);
return (_local2);
}
protected function toRadix(_arg1:uint=10):String{
var _local2:int;
var _local3:Number;
var _local4:BigInteger;
var _local5:BigInteger;
var _local6:BigInteger;
var _local7:String;
if ((((((sigNum() == 0)) || ((_arg1 < 2)))) || ((_arg1 > 32)))){
return ("0");
};
_local2 = chunkSize(_arg1);
_local3 = Math.pow(_arg1, _local2);
_local4 = nbv(_local3);
_local5 = nbi();
_local6 = nbi();
_local7 = "";
divRemTo(_local4, _local5, _local6);
while (_local5.sigNum() > 0) {
_local7 = ((_local3 + _local6.intValue()).toString(_arg1).substr(1) + _local7);
_local5.divRemTo(_local4, _local5, _local6);
};
return ((_local6.intValue().toString(_arg1) + _local7));
}
public function not():BigInteger{
var _local1:BigInteger;
var _local2:int;
_local1 = new BigInteger();
_local2 = 0;
while (_local2 < t) {
_local1[_local2] = (DM & ~(a[_local2]));
_local2++;
};
_local1.t = t;
_local1.s = ~(s);
return (_local1);
}
bi_internal function subTo(_arg1:BigInteger, _arg2:BigInteger):void{
var _local3:int;
var _local4:int;
var _local5:int;
_local3 = 0;
_local4 = 0;
_local5 = Math.min(_arg1.t, t);
while (_local3 < _local5) {
_local4 = (_local4 + (a[_local3] - _arg1.a[_local3]));
var _temp1 = _local3;
_local3 = (_local3 + 1);
var _local6 = _temp1;
_arg2.a[_local6] = (_local4 & DM);
_local4 = (_local4 >> DB);
};
if (_arg1.t < t){
_local4 = (_local4 - _arg1.s);
while (_local3 < t) {
_local4 = (_local4 + a[_local3]);
var _temp2 = _local3;
_local3 = (_local3 + 1);
_local6 = _temp2;
_arg2.a[_local6] = (_local4 & DM);
_local4 = (_local4 >> DB);
};
_local4 = (_local4 + s);
} else {
_local4 = (_local4 + s);
while (_local3 < _arg1.t) {
_local4 = (_local4 - _arg1.a[_local3]);
var _temp3 = _local3;
_local3 = (_local3 + 1);
_local6 = _temp3;
_arg2.a[_local6] = (_local4 & DM);
_local4 = (_local4 >> DB);
};
_local4 = (_local4 - _arg1.s);
};
_arg2.s = ((_local4)<0) ? -1 : 0;
if (_local4 < -1){
var _temp4 = _local3;
_local3 = (_local3 + 1);
_local6 = _temp4;
_arg2.a[_local6] = (DV + _local4);
} else {
if (_local4 > 0){
var _temp5 = _local3;
_local3 = (_local3 + 1);
_local6 = _temp5;
_arg2.a[_local6] = _local4;
};
};
_arg2.t = _local3;
_arg2.clamp();
}
public function clone():BigInteger{
var _local1:BigInteger;
_local1 = new BigInteger();
this.copyTo(_local1);
return (_local1);
}
public function pow(_arg1:int):BigInteger{
return (exp(_arg1, new NullReduction()));
}
public function flipBit(_arg1:int):BigInteger{
return (changeBit(_arg1, op_xor));
}
public function xor(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
bitwiseTo(_arg1, op_xor, _local2);
return (_local2);
}
public function or(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
bitwiseTo(_arg1, op_or, _local2);
return (_local2);
}
public function max(_arg1:BigInteger):BigInteger{
return (((compareTo(_arg1))>0) ? this : _arg1);
}
bi_internal function fromInt(_arg1:int):void{
t = 1;
s = ((_arg1)<0) ? -1 : 0;
if (_arg1 > 0){
a[0] = _arg1;
} else {
if (_arg1 < -1){
a[0] = (_arg1 + DV);
} else {
t = 0;
};
};
}
bi_internal function isEven():Boolean{
return ((((t)>0) ? (a[0] & 1) : s == 0));
}
public function toString(_arg1:Number=16):String{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Boolean;
var _local6:String;
var _local7:int;
var _local8:int;
if (s < 0){
return (("-" + negate().toString(_arg1)));
};
switch (_arg1){
case 2:
_local2 = 1;
break;
case 4:
_local2 = 2;
break;
case 8:
_local2 = 3;
break;
case 16:
_local2 = 4;
break;
case 32:
_local2 = 5;
break;
};
_local3 = ((1 << _local2) - 1);
_local4 = 0;
_local5 = false;
_local6 = "";
_local7 = t;
_local8 = (DB - ((_local7 * DB) % _local2));
var _temp1 = _local7;
_local7 = (_local7 - 1);
if (_temp1 > 0){
if ((((_local8 < DB)) && (((a[_local7] >> _local8) > 0)))){
_local5 = true;
_local6 = _local4.toString(36);
};
while (_local7 >= 0) {
if (_local8 < _local2){
_local4 = ((a[_local7] & ((1 << _local8) - 1)) << (_local2 - _local8));
var _temp2 = _local4;
_local7 = (_local7 - 1);
_local8 = (_local8 + (DB - _local2));
_local4 = (_temp2 | (a[_local7] >> _local8));
} else {
_local8 = (_local8 - _local2);
_local4 = ((a[_local7] >> _local8) & _local3);
if (_local8 <= 0){
_local8 = (_local8 + DB);
_local7--;
};
};
if (_local4 > 0){
_local5 = true;
};
if (_local5){
_local6 = (_local6 + _local4.toString(36));
};
};
};
return ((_local5) ? _local6 : "0");
}
public function setBit(_arg1:int):BigInteger{
return (changeBit(_arg1, op_or));
}
public function abs():BigInteger{
return (((s)<0) ? negate() : this);
}
bi_internal function nbits(_arg1:int):int{
var _local2:int;
var _local3:int;
_local2 = 1;
_local3 = (_arg1 >>> 16);
if (_local3 != 0){
_arg1 = _local3;
_local2 = (_local2 + 16);
};
_local3 = (_arg1 >> 8);
if (_local3 != 0){
_arg1 = _local3;
_local2 = (_local2 + 8);
};
_local3 = (_arg1 >> 4);
if (_local3 != 0){
_arg1 = _local3;
_local2 = (_local2 + 4);
};
_local3 = (_arg1 >> 2);
if (_local3 != 0){
_arg1 = _local3;
_local2 = (_local2 + 2);
};
_local3 = (_arg1 >> 1);
if (_local3 != 0){
_arg1 = _local3;
_local2 = (_local2 + 1);
};
return (_local2);
}
public function sigNum():int{
if (s < 0){
return (-1);
};
if ((((t <= 0)) || ((((t == 1)) && ((a[0] <= 0)))))){
return (0);
};
return (1);
}
public function toByteArray():ByteArray{
var _local1:int;
var _local2:ByteArray;
var _local3:int;
var _local4:int;
var _local5:int;
_local1 = t;
_local2 = new ByteArray();
_local2[0] = s;
_local3 = (DB - ((_local1 * DB) % 8));
_local5 = 0;
var _temp1 = _local1;
_local1 = (_local1 - 1);
if (_temp1 > 0){
if ((((_local3 < DB)) && (!(((a[_local1] >> _local3) == ((s & DM) >> _local3)))))){
var _temp2 = _local5;
_local5 = (_local5 + 1);
var _local6 = _temp2;
_local2[_local6] = (_local4 | (s << (DB - _local3)));
};
while (_local1 >= 0) {
if (_local3 < 8){
_local4 = ((a[_local1] & ((1 << _local3) - 1)) << (8 - _local3));
var _temp3 = _local4;
_local1 = (_local1 - 1);
_local3 = (_local3 + (DB - 8));
_local4 = (_temp3 | (a[_local1] >> _local3));
} else {
_local3 = (_local3 - 8);
_local4 = ((a[_local1] >> _local3) & 0xFF);
if (_local3 <= 0){
_local3 = (_local3 + DB);
_local1--;
};
};
if ((_local4 & 128) != 0){
_local4 = (_local4 | -256);
};
if ((((_local5 == 0)) && (!(((s & 128) == (_local4 & 128)))))){
_local5++;
};
if ((((_local5 > 0)) || (!((_local4 == s))))){
var _temp4 = _local5;
_local5 = (_local5 + 1);
_local6 = _temp4;
_local2[_local6] = _local4;
};
};
};
return (_local2);
}
bi_internal function squareTo(_arg1:BigInteger):void{
var _local2:BigInteger;
var _local3:int;
var _local4:int;
_local2 = abs();
_local3 = (_arg1.t = (2 * _local2.t));
while (--_local3 >= 0) {
_arg1.a[_local3] = 0;
};
_local3 = 0;
while (_local3 < (_local2.t - 1)) {
_local4 = _local2.am(_local3, _local2.a[_local3], _arg1, (2 * _local3), 0, 1);
if ((_arg1.a[(_local3 + _local2.t)] = (_arg1.a[(_local3 + _local2.t)] + _local2.am((_local3 + 1), (2 * _local2.a[_local3]), _arg1, ((2 * _local3) + 1), _local4, ((_local2.t - _local3) - 1)))) >= DV){
_arg1.a[(_local3 + _local2.t)] = (_arg1.a[(_local3 + _local2.t)] - DV);
_arg1.a[((_local3 + _local2.t) + 1)] = 1;
};
_local3++;
};
if (_arg1.t > 0){
_arg1.a[(_arg1.t - 1)] = (_arg1.a[(_arg1.t - 1)] + _local2.am(_local3, _local2.a[_local3], _arg1, (2 * _local3), 0, 1));
};
_arg1.s = 0;
_arg1.clamp();
}
private function op_and(_arg1:int, _arg2:int):int{
return ((_arg1 & _arg2));
}
protected function fromRadix(_arg1:String, _arg2:int=10):void{
var _local3:int;
var _local4:Number;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
fromInt(0);
_local3 = chunkSize(_arg2);
_local4 = Math.pow(_arg2, _local3);
_local5 = false;
_local6 = 0;
_local7 = 0;
_local8 = 0;
while (_local8 < _arg1.length) {
_local9 = intAt(_arg1, _local8);
if (_local9 < 0){
if ((((_arg1.charAt(_local8) == "-")) && ((sigNum() == 0)))){
_local5 = true;
};
} else {
_local7 = ((_arg2 * _local7) + _local9);
++_local6;
if (_local6 >= _local3){
dMultiply(_local4);
dAddOffset(_local7, 0);
_local6 = 0;
_local7 = 0;
};
};
_local8++;
};
if (_local6 > 0){
dMultiply(Math.pow(_arg2, _local6));
dAddOffset(_local7, 0);
};
if (_local5){
BigInteger.ZERO.subTo(this, this);
};
}
bi_internal function dlShiftTo(_arg1:int, _arg2:BigInteger):void{
var _local3:int;
_local3 = (t - 1);
while (_local3 >= 0) {
_arg2.a[(_local3 + _arg1)] = a[_local3];
_local3--;
};
_local3 = (_arg1 - 1);
while (_local3 >= 0) {
_arg2.a[_local3] = 0;
_local3--;
};
_arg2.t = (t + _arg1);
_arg2.s = s;
}
private function op_xor(_arg1:int, _arg2:int):int{
return ((_arg1 ^ _arg2));
}
public static function nbv(_arg1:int):BigInteger{
var _local2:BigInteger;
_local2 = new (BigInteger);
_local2.fromInt(_arg1);
return (_local2);
}
}
}//package com.hurlant.math
Section 37
//ClassicReduction (com.hurlant.math.ClassicReduction)
package com.hurlant.math {
import com.hurlant.math.*;
class ClassicReduction implements IReduction {
private var m:BigInteger;
function ClassicReduction(_arg1:BigInteger){
this.m = _arg1;
}
public function revert(_arg1:BigInteger):BigInteger{
return (_arg1);
}
public function reduce(_arg1:BigInteger):void{
_arg1.divRemTo(m, null, _arg1);
}
public function convert(_arg1:BigInteger):BigInteger{
if ((((_arg1.s < 0)) || ((_arg1.compareTo(m) >= 0)))){
return (_arg1.mod(m));
};
return (_arg1);
}
public function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void{
_arg1.squareTo(_arg2);
reduce(_arg2);
}
public function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void{
_arg1.multiplyTo(_arg2, _arg3);
reduce(_arg3);
}
}
}//package com.hurlant.math
Section 38
//IReduction (com.hurlant.math.IReduction)
package com.hurlant.math {
import com.hurlant.math.*;
interface IReduction {
function convert(_arg1:BigInteger):BigInteger;
function revert(_arg1:BigInteger):BigInteger;
function reduce(_arg1:BigInteger):void;
function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void;
function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void;
}
}//package com.hurlant.math
Section 39
//MontgomeryReduction (com.hurlant.math.MontgomeryReduction)
package com.hurlant.math {
import com.hurlant.math.*;
class MontgomeryReduction implements IReduction {
private var um:int;
private var mp:int;
private var mph:int;
private var mpl:int;
private var mt2:int;
private var m:BigInteger;
function MontgomeryReduction(_arg1:BigInteger){
this.m = _arg1;
mp = _arg1.invDigit();
mpl = (mp & 32767);
mph = (mp >> 15);
um = ((1 << (BigInteger.DB - 15)) - 1);
mt2 = (2 * _arg1.t);
}
public function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void{
_arg1.multiplyTo(_arg2, _arg3);
reduce(_arg3);
}
public function revert(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
_arg1.copyTo(_local2);
reduce(_local2);
return (_local2);
}
public function convert(_arg1:BigInteger):BigInteger{
var _local2:BigInteger;
_local2 = new BigInteger();
_arg1.abs().dlShiftTo(m.t, _local2);
_local2.divRemTo(m, null, _local2);
if ((((_arg1.s < 0)) && ((_local2.compareTo(BigInteger.ZERO) > 0)))){
m.subTo(_local2, _local2);
};
return (_local2);
}
public function reduce(_arg1:BigInteger):void{
var _local2:int;
var _local3:int;
var _local4:int;
while (_arg1.t <= mt2) {
var _local5 = _arg1.t++;
_arg1.a[_local5] = 0;
};
_local2 = 0;
while (_local2 < m.t) {
_local3 = (_arg1.a[_local2] & 32767);
_local4 = (((_local3 * mpl) + ((((_local3 * mph) + ((_arg1.a[_local2] >> 15) * mpl)) & um) << 15)) & BigInteger.DM);
_local3 = (_local2 + m.t);
_arg1.a[_local3] = (_arg1.a[_local3] + m.am(0, _local4, _arg1, _local2, 0, m.t));
while (_arg1.a[_local3] >= BigInteger.DV) {
_arg1.a[_local3] = (_arg1.a[_local3] - BigInteger.DV);
_local5 = _arg1.a;
++_local3;
var _local6 = _local3;
var _local7 = (_local5[_local6] + 1);
_local5[_local6] = _local7;
};
_local2++;
};
_arg1.clamp();
_arg1.drShiftTo(m.t, _arg1);
if (_arg1.compareTo(m) >= 0){
_arg1.subTo(m, _arg1);
};
}
public function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void{
_arg1.squareTo(_arg2);
reduce(_arg2);
}
}
}//package com.hurlant.math
Section 40
//NullReduction (com.hurlant.math.NullReduction)
package com.hurlant.math {
public class NullReduction implements IReduction {
public function reduce(_arg1:BigInteger):void{
}
public function revert(_arg1:BigInteger):BigInteger{
return (_arg1);
}
public function mulTo(_arg1:BigInteger, _arg2:BigInteger, _arg3:BigInteger):void{
_arg1.multiplyTo(_arg2, _arg3);
}
public function convert(_arg1:BigInteger):BigInteger{
return (_arg1);
}
public function sqrTo(_arg1:BigInteger, _arg2:BigInteger):void{
_arg1.squareTo(_arg2);
}
}
}//package com.hurlant.math
Section 41
//Base64 (com.hurlant.util.Base64)
package com.hurlant.util {
import flash.utils.*;
public class Base64 {
public static const version:String = "1.0.0";
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
public function Base64(){
throw (new Error("Base64 class is static container only"));
}
public static function encode(_arg1:String):String{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (encodeByteArray(_local2));
}
public static function encodeByteArray(_arg1:ByteArray):String{
var _local2:String;
var _local3:Array;
var _local4:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local2 = "";
_local4 = new Array(4);
_arg1.position = 0;
while (_arg1.bytesAvailable > 0) {
_local3 = new Array();
_local5 = 0;
while ((((_local5 < 3)) && ((_arg1.bytesAvailable > 0)))) {
_local3[_local5] = _arg1.readUnsignedByte();
_local5++;
};
_local4[0] = ((_local3[0] & 252) >> 2);
_local4[1] = (((_local3[0] & 3) << 4) | (_local3[1] >> 4));
_local4[2] = (((_local3[1] & 15) << 2) | (_local3[2] >> 6));
_local4[3] = (_local3[2] & 63);
_local6 = _local3.length;
while (_local6 < 3) {
_local4[(_local6 + 1)] = 64;
_local6++;
};
_local7 = 0;
while (_local7 < _local4.length) {
_local2 = (_local2 + BASE64_CHARS.charAt(_local4[_local7]));
_local7++;
};
};
return (_local2);
}
public static function decode(_arg1:String):String{
var _local2:ByteArray;
_local2 = decodeToByteArray(_arg1);
return (_local2.readUTFBytes(_local2.length));
}
public static function decodeToByteArray(_arg1:String):ByteArray{
var _local2:ByteArray;
var _local3:Array;
var _local4:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local2 = new ByteArray();
_local3 = new Array(4);
_local4 = new Array(3);
_local5 = 0;
while (_local5 < _arg1.length) {
_local6 = 0;
while ((((_local6 < 4)) && (((_local5 + _local6) < _arg1.length)))) {
_local3[_local6] = BASE64_CHARS.indexOf(_arg1.charAt((_local5 + _local6)));
_local6++;
};
_local4[0] = ((_local3[0] << 2) + ((_local3[1] & 48) >> 4));
_local4[1] = (((_local3[1] & 15) << 4) + ((_local3[2] & 60) >> 2));
_local4[2] = (((_local3[2] & 3) << 6) + _local3[3]);
_local7 = 0;
while (_local7 < _local4.length) {
if (_local3[(_local7 + 1)] == 64){
break;
};
_local2.writeByte(_local4[_local7]);
_local7++;
};
_local5 = (_local5 + 4);
};
_local2.position = 0;
return (_local2);
}
}
}//package com.hurlant.util
Section 42
//Hex (com.hurlant.util.Hex)
package com.hurlant.util {
import flash.utils.*;
public class Hex {
public static function fromString(_arg1:String, _arg2:Boolean=false):String{
var _local3:ByteArray;
_local3 = new ByteArray();
_local3.writeUTFBytes(_arg1);
return (fromArray(_local3, _arg2));
}
public static function toString(_arg1:String):String{
var _local2:ByteArray;
_local2 = toArray(_arg1);
return (_local2.readUTFBytes(_local2.length));
}
public static function toArray(_arg1:String):ByteArray{
var _local2:ByteArray;
var _local3:uint;
_arg1 = _arg1.replace(/\s|:/gm, "");
_local2 = new ByteArray();
if ((_arg1.length & (1 == 1))){
_arg1 = ("0" + _arg1);
};
_local3 = 0;
while (_local3 < _arg1.length) {
_local2[(_local3 / 2)] = parseInt(_arg1.substr(_local3, 2), 16);
_local3 = (_local3 + 2);
};
return (_local2);
}
public static function fromArray(_arg1:ByteArray, _arg2:Boolean=false):String{
var _local3:String;
var _local4:uint;
_local3 = "";
_local4 = 0;
while (_local4 < _arg1.length) {
_local3 = (_local3 + ("0" + _arg1[_local4].toString(16)).substr(-2, 2));
if (_arg2){
if (_local4 < (_arg1.length - 1)){
_local3 = (_local3 + ":");
};
};
_local4++;
};
return (_local3);
}
}
}//package com.hurlant.util
Section 43
//Memory (com.hurlant.util.Memory)
package com.hurlant.util {
import flash.net.*;
import flash.system.*;
public class Memory {
public static function gc():void{
try {
new LocalConnection().connect("foo");
new LocalConnection().connect("foo");
} catch(e) {
};
}
public static function get used():uint{
return (System.totalMemory);
}
}
}//package com.hurlant.util
Section 44
//MochiBot (com.mochibot.MochiBot)
package com.mochibot {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
_local8.loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, io_errorHandler);
return (_local3);
}
public static function io_errorHandler(_arg1:IOErrorEvent):void{
trace("Mochibot Fail");
}
}
}//package com.mochibot
Section 45
//Cubic (gs.easing.Cubic)
package gs.easing {
public class Cubic {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
}
}//package gs.easing
Section 46
//Linear (gs.easing.Linear)
package gs.easing {
public class Linear {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package gs.easing
Section 47
//TweenEvent (gs.events.TweenEvent)
package gs.events {
import flash.events.*;
public class TweenEvent extends Event {
public var info:Object;
public static const UPDATE:String = "update";
public static const START:String = "start";
public static const version:Number = 0.9;
public static const COMPLETE:String = "complete";
public function TweenEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
this.info = _arg2;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.info, this.bubbles, this.cancelable));
}
}
}//package gs.events
Section 48
//AutoAlphaPlugin (gs.plugins.AutoAlphaPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class AutoAlphaPlugin extends TweenPlugin {
protected var _tweenVisible:Boolean;
protected var _target:Object;
protected var _visible:Boolean;
protected var _tween:TweenLite;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function AutoAlphaPlugin(){
this.propName = "autoAlpha";
this.overwriteProps = ["alpha", "visible"];
this.onComplete = onCompleteTween;
}
override public function killProps(_arg1:Object):void{
super.killProps(_arg1);
_tweenVisible = !(Boolean(("visible" in _arg1)));
}
public function onCompleteTween():void{
if (((((_tweenVisible) && (!((_tween.vars.runBackwards == true))))) && ((_tween.ease == _tween.vars.ease)))){
_target.visible = _visible;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_tween = _arg3;
_visible = Boolean(!((_arg2 == 0)));
_tweenVisible = true;
addTween(_arg1, "alpha", _arg1.alpha, _arg2, "alpha");
return (true);
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
if (((!((_target.visible == true))) && (_tweenVisible))){
_target.visible = true;
};
}
}
}//package gs.plugins
Section 49
//BevelFilterPlugin (gs.plugins.BevelFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class BevelFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function BevelFilterPlugin(){
this.propName = "bevelFilter";
this.overwriteProps = ["bevelFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = BevelFilter;
initFilter(_arg2, new BevelFilter(0, 0, 0xFFFFFF, 0.5, 0, 0.5, 2, 2, 0, ((_arg2.quality) || (2))));
return (true);
}
}
}//package gs.plugins
Section 50
//BezierPlugin (gs.plugins.BezierPlugin)
package gs.plugins {
import gs.*;
import gs.utils.tween.*;
public class BezierPlugin extends TweenPlugin {
protected var _future:Object;
protected var _orient:Boolean;
protected var _orientData:Array;
protected var _target:Object;
protected var _beziers:Object;
protected static const _RAD2DEG:Number = 57.2957795130823;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function BezierPlugin(){
_future = {};
super();
this.propName = "bezier";
this.overwriteProps = [];
}
override public function killProps(_arg1:Object):void{
var _local2:String;
for (_local2 in _beziers) {
if ((_local2 in _arg1)){
delete _beziers[_local2];
};
};
super.killProps(_arg1);
}
protected function init(_arg1:TweenLite, _arg2:Array, _arg3:Boolean):void{
var _local5:int;
var _local6:String;
_target = _arg1.target;
if (_arg1.exposedVars.orientToBezier == true){
_orientData = [["x", "y", "rotation", 0]];
_orient = true;
} else {
if ((_arg1.exposedVars.orientToBezier is Array)){
_orientData = _arg1.exposedVars.orientToBezier;
_orient = true;
};
};
var _local4:Object = {};
_local5 = 0;
while (_local5 < _arg2.length) {
for (_local6 in _arg2[_local5]) {
if (_local4[_local6] == undefined){
_local4[_local6] = [_arg1.target[_local6]];
};
if (typeof(_arg2[_local5][_local6]) == "number"){
_local4[_local6].push(_arg2[_local5][_local6]);
} else {
_local4[_local6].push((_arg1.target[_local6] + Number(_arg2[_local5][_local6])));
};
};
_local5++;
};
for (_local6 in _local4) {
this.overwriteProps[this.overwriteProps.length] = _local6;
if (_arg1.exposedVars[_local6] != undefined){
if (typeof(_arg1.exposedVars[_local6]) == "number"){
_local4[_local6].push(_arg1.exposedVars[_local6]);
} else {
_local4[_local6].push((_arg1.target[_local6] + Number(_arg1.exposedVars[_local6])));
};
delete _arg1.exposedVars[_local6];
_local5 = (_arg1.tweens.length - 1);
while (_local5 > -1) {
if (_arg1.tweens[_local5].name == _local6){
_arg1.tweens.splice(_local5, 1);
};
_local5--;
};
};
};
_beziers = parseBeziers(_local4, _arg3);
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!(_arg2 is Array)){
return (false);
};
init(_arg3, (_arg2 as Array), false);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:String;
var _local4:Object;
var _local5:Number;
var _local6:uint;
var _local7:Number;
var _local8:int;
var _local9:Object;
var _local10:Boolean;
var _local11:Number;
var _local12:Number;
var _local13:Array;
var _local14:Number;
if (_arg1 == 1){
for (_local3 in _beziers) {
_local2 = (_beziers[_local3].length - 1);
_target[_local3] = _beziers[_local3][_local2][2];
};
} else {
for (_local3 in _beziers) {
_local6 = _beziers[_local3].length;
if (_arg1 < 0){
_local2 = 0;
} else {
if (_arg1 >= 1){
_local2 = (_local6 - 1);
} else {
_local2 = int((_local6 * _arg1));
};
};
_local5 = ((_arg1 - (_local2 * (1 / _local6))) * _local6);
_local4 = _beziers[_local3][_local2];
if (this.round){
_local7 = (_local4[0] + (_local5 * (((2 * (1 - _local5)) * (_local4[1] - _local4[0])) + (_local5 * (_local4[2] - _local4[0])))));
_local8 = ((_local7)<0) ? -1 : 1;
_target[_local3] = ((((_local7 % 1) * _local8))>0.5) ? (int(_local7) + _local8) : int(_local7);
} else {
_target[_local3] = (_local4[0] + (_local5 * (((2 * (1 - _local5)) * (_local4[1] - _local4[0])) + (_local5 * (_local4[2] - _local4[0])))));
};
};
};
if (_orient){
_local9 = _target;
_local10 = this.round;
_target = _future;
this.round = false;
_orient = false;
this.changeFactor = (_arg1 + 0.01);
_target = _local9;
this.round = _local10;
_orient = true;
_local2 = 0;
while (_local2 < _orientData.length) {
_local13 = _orientData[_local2];
_local14 = ((_local13[3]) || (0));
_local11 = (_future[_local13[0]] - _target[_local13[0]]);
_local12 = (_future[_local13[1]] - _target[_local13[1]]);
_target[_local13[2]] = ((Math.atan2(_local12, _local11) * _RAD2DEG) + _local14);
_local2++;
};
};
}
public static function parseBeziers(_arg1:Object, _arg2:Boolean=false):Object{
var _local3:int;
var _local4:Array;
var _local5:Object;
var _local6:String;
var _local7:Object = {};
if (_arg2){
for (_local6 in _arg1) {
_local4 = _arg1[_local6];
_local5 = [];
_local7[_local6] = _local5;
if (_local4.length > 2){
_local5[_local5.length] = [_local4[0], (_local4[1] - ((_local4[2] - _local4[0]) / 4)), _local4[1]];
_local3 = 1;
while (_local3 < (_local4.length - 1)) {
_local5[_local5.length] = [_local4[_local3], (_local4[_local3] + (_local4[_local3] - _local5[(_local3 - 1)][1])), _local4[(_local3 + 1)]];
_local3++;
};
} else {
_local5[_local5.length] = [_local4[0], ((_local4[0] + _local4[1]) / 2), _local4[1]];
};
};
} else {
for (_local6 in _arg1) {
_local4 = _arg1[_local6];
_local5 = [];
_local7[_local6] = _local5;
if (_local4.length > 3){
_local5[_local5.length] = [_local4[0], _local4[1], ((_local4[1] + _local4[2]) / 2)];
_local3 = 2;
while (_local3 < (_local4.length - 2)) {
_local5[_local5.length] = [_local5[(_local3 - 2)][2], _local4[_local3], ((_local4[_local3] + _local4[(_local3 + 1)]) / 2)];
_local3++;
};
_local5[_local5.length] = [_local5[(_local5.length - 1)][2], _local4[(_local4.length - 2)], _local4[(_local4.length - 1)]];
} else {
if (_local4.length == 3){
_local5[_local5.length] = [_local4[0], _local4[1], _local4[2]];
} else {
if (_local4.length == 2){
_local5[_local5.length] = [_local4[0], ((_local4[0] + _local4[1]) / 2), _local4[1]];
};
};
};
};
};
return (_local7);
}
}
}//package gs.plugins
Section 51
//BezierThroughPlugin (gs.plugins.BezierThroughPlugin)
package gs.plugins {
import gs.*;
public class BezierThroughPlugin extends BezierPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function BezierThroughPlugin(){
this.propName = "bezierThrough";
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!(_arg2 is Array)){
return (false);
};
init(_arg3, (_arg2 as Array), true);
return (true);
}
}
}//package gs.plugins
Section 52
//BlurFilterPlugin (gs.plugins.BlurFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class BlurFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function BlurFilterPlugin(){
this.propName = "blurFilter";
this.overwriteProps = ["blurFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = BlurFilter;
initFilter(_arg2, new BlurFilter(0, 0, ((_arg2.quality) || (2))));
return (true);
}
}
}//package gs.plugins
Section 53
//ColorMatrixFilterPlugin (gs.plugins.ColorMatrixFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class ColorMatrixFilterPlugin extends FilterPlugin {
protected var _matrix:Array;
protected var _matrixTween:EndArrayPlugin;
public static const API:Number = 1;
public static const VERSION:Number = 1.01;
protected static var _lumG:Number = 0.71516;
protected static var _lumR:Number = 0.212671;
protected static var _idMatrix:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
protected static var _lumB:Number = 0.072169;
public function ColorMatrixFilterPlugin(){
this.propName = "colorMatrixFilter";
this.overwriteProps = ["colorMatrixFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = ColorMatrixFilter;
var _local4:Object = _arg2;
initFilter({}, new ColorMatrixFilter(_idMatrix.slice()));
_matrix = ColorMatrixFilter(_filter).matrix;
var _local5:Array = [];
if (((!((_local4.matrix == null))) && ((_local4.matrix is Array)))){
_local5 = _local4.matrix;
} else {
if (_local4.relative == true){
_local5 = _matrix.slice();
} else {
_local5 = _idMatrix.slice();
};
_local5 = setBrightness(_local5, _local4.brightness);
_local5 = setContrast(_local5, _local4.contrast);
_local5 = setHue(_local5, _local4.hue);
_local5 = setSaturation(_local5, _local4.saturation);
_local5 = setThreshold(_local5, _local4.threshold);
if (!isNaN(_local4.colorize)){
_local5 = colorize(_local5, _local4.colorize, _local4.amount);
};
};
_matrixTween = new EndArrayPlugin();
_matrixTween.init(_matrix, _local5);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
_matrixTween.changeFactor = _arg1;
ColorMatrixFilter(_filter).matrix = _matrix;
super.changeFactor = _arg1;
}
public static function setSaturation(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
var _local3:Number = (1 - _arg2);
var _local4:Number = (_local3 * _lumR);
var _local5:Number = (_local3 * _lumG);
var _local6:Number = (_local3 * _lumB);
var _local7:Array = [(_local4 + _arg2), _local5, _local6, 0, 0, _local4, (_local5 + _arg2), _local6, 0, 0, _local4, _local5, (_local6 + _arg2), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local7, _arg1));
}
public static function setHue(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 * (Math.PI / 180));
var _local3:Number = Math.cos(_arg2);
var _local4:Number = Math.sin(_arg2);
var _local5:Array = [((_lumR + (_local3 * (1 - _lumR))) + (_local4 * -(_lumR))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * -(_lumG))), ((_lumB + (_local3 * -(_lumB))) + (_local4 * (1 - _lumB))), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * 0.143)), ((_lumG + (_local3 * (1 - _lumG))) + (_local4 * 0.14)), ((_lumB + (_local3 * -(_lumB))) + (_local4 * -0.283)), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * -((1 - _lumR)))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * _lumG)), ((_lumB + (_local3 * (1 - _lumB))) + (_local4 * _lumB)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
return (applyMatrix(_local5, _arg1));
}
public static function setThreshold(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
var _local3:Array = [(_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
public static function applyMatrix(_arg1:Array, _arg2:Array):Array{
var _local6:int;
var _local7:int;
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (_arg2);
};
var _local3:Array = [];
var _local4:int;
var _local5:int;
_local6 = 0;
while (_local6 < 4) {
_local7 = 0;
while (_local7 < 5) {
if (_local7 == 4){
_local5 = _arg1[(_local4 + 4)];
} else {
_local5 = 0;
};
_local3[(_local4 + _local7)] = (((((_arg1[_local4] * _arg2[_local7]) + (_arg1[(_local4 + 1)] * _arg2[(_local7 + 5)])) + (_arg1[(_local4 + 2)] * _arg2[(_local7 + 10)])) + (_arg1[(_local4 + 3)] * _arg2[(_local7 + 15)])) + _local5);
_local7++;
};
_local4 = (_local4 + 5);
_local6++;
};
return (_local3);
}
public static function colorize(_arg1:Array, _arg2:Number, _arg3:Number=1):Array{
if (isNaN(_arg2)){
return (_arg1);
};
if (isNaN(_arg3)){
_arg3 = 1;
};
var _local4:Number = (((_arg2 >> 16) & 0xFF) / 0xFF);
var _local5:Number = (((_arg2 >> 8) & 0xFF) / 0xFF);
var _local6:Number = ((_arg2 & 0xFF) / 0xFF);
var _local7:Number = (1 - _arg3);
var _local8:Array = [(_local7 + ((_arg3 * _local4) * _lumR)), ((_arg3 * _local4) * _lumG), ((_arg3 * _local4) * _lumB), 0, 0, ((_arg3 * _local5) * _lumR), (_local7 + ((_arg3 * _local5) * _lumG)), ((_arg3 * _local5) * _lumB), 0, 0, ((_arg3 * _local6) * _lumR), ((_arg3 * _local6) * _lumG), (_local7 + ((_arg3 * _local6) * _lumB)), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local8, _arg1));
}
public static function setBrightness(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = ((_arg2 * 100) - 100);
return (applyMatrix([1, 0, 0, 0, _arg2, 0, 1, 0, 0, _arg2, 0, 0, 1, 0, _arg2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], _arg1));
}
public static function setContrast(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 + 0.01);
var _local3:Array = [_arg2, 0, 0, 0, (128 * (1 - _arg2)), 0, _arg2, 0, 0, (128 * (1 - _arg2)), 0, 0, _arg2, 0, (128 * (1 - _arg2)), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
}
}//package gs.plugins
Section 54
//DropShadowFilterPlugin (gs.plugins.DropShadowFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class DropShadowFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function DropShadowFilterPlugin(){
this.propName = "dropShadowFilter";
this.overwriteProps = ["dropShadowFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = DropShadowFilter;
initFilter(_arg2, new DropShadowFilter(0, 45, 0, 0, 0, 0, 1, ((_arg2.quality) || (2)), _arg2.inner, _arg2.knockout, _arg2.hideObject));
return (true);
}
}
}//package gs.plugins
Section 55
//EndArrayPlugin (gs.plugins.EndArrayPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import gs.utils.tween.*;
public class EndArrayPlugin extends TweenPlugin {
protected var _a:Array;
protected var _info:Array;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function EndArrayPlugin(){
_info = [];
super();
this.propName = "endArray";
this.overwriteProps = ["endArray"];
}
public function init(_arg1:Array, _arg2:Array):void{
_a = _arg1;
var _local3:int = (_arg2.length - 1);
while (_local3 > -1) {
if (((!((_arg1[_local3] == _arg2[_local3]))) && (!((_arg1[_local3] == null))))){
_info[_info.length] = new ArrayTweenInfo(_local3, _a[_local3], (_arg2[_local3] - _a[_local3]));
};
_local3--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (false);
};
init((_arg1 as Array), _arg2);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:ArrayTweenInfo;
var _local4:Number;
var _local5:int;
if (this.round){
_local2 = (_info.length - 1);
while (_local2 > -1) {
_local3 = _info[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_local5 = ((_local4)<0) ? -1 : 1;
_a[_local3.index] = ((((_local4 % 1) * _local5))>0.5) ? (int(_local4) + _local5) : int(_local4);
_local2--;
};
} else {
_local2 = (_info.length - 1);
while (_local2 > -1) {
_local3 = _info[_local2];
_a[_local3.index] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
};
}
}
}//package gs.plugins
Section 56
//FilterPlugin (gs.plugins.FilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
import gs.utils.tween.*;
public class FilterPlugin extends TweenPlugin {
protected var _remove:Boolean;
protected var _target:Object;
protected var _index:int;
protected var _filter:BitmapFilter;
protected var _type:Class;
public static const VERSION:Number = 1.03;
public static const API:Number = 1;
public function onCompleteTween():void{
var _local1:int;
var _local2:Array;
if (_remove){
_local2 = _target.filters;
if (!(_local2[_index] is _type)){
_local1 = (_local2.length - 1);
while (_local1 > -1) {
if ((_local2[_local1] is _type)){
_local2.splice(_local1, 1);
break;
};
_local1--;
};
} else {
_local2.splice(_index, 1);
};
_target.filters = _local2;
};
}
protected function initFilter(_arg1:Object, _arg2:BitmapFilter):void{
var _local4:String;
var _local5:int;
var _local6:HexColorsPlugin;
var _local3:Array = _target.filters;
_index = -1;
if (_arg1.index != null){
_index = _arg1.index;
} else {
_local5 = (_local3.length - 1);
while (_local5 > -1) {
if ((_local3[_local5] is _type)){
_index = _local5;
break;
};
_local5--;
};
};
if ((((((_index == -1)) || ((_local3[_index] == null)))) || ((_arg1.addFilter == true)))){
_index = ((_arg1.index)!=null) ? _arg1.index : _local3.length;
_local3[_index] = _arg2;
_target.filters = _local3;
};
_filter = _local3[_index];
_remove = Boolean((_arg1.remove == true));
if (_remove){
this.onComplete = onCompleteTween;
};
var _local7:Object = ((_arg1.isTV)==true) ? _arg1.exposedVars : _arg1;
for (_local4 in _local7) {
if (((((((((!((_local4 in _filter))) || ((_filter[_local4] == _local7[_local4])))) || ((_local4 == "remove")))) || ((_local4 == "index")))) || ((_local4 == "addFilter")))){
} else {
if ((((((_local4 == "color")) || ((_local4 == "highlightColor")))) || ((_local4 == "shadowColor")))){
_local6 = new HexColorsPlugin();
_local6.initColor(_filter, _local4, _filter[_local4], _local7[_local4]);
_tweens[_tweens.length] = new TweenInfo(_local6, "changeFactor", 0, 1, _local4, false);
} else {
if ((((((((_local4 == "quality")) || ((_local4 == "inner")))) || ((_local4 == "knockout")))) || ((_local4 == "hideObject")))){
_filter[_local4] = _local7[_local4];
} else {
addTween(_filter, _local4, _filter[_local4], _local7[_local4], _local4);
};
};
};
};
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:TweenInfo;
var _local4:Array = _target.filters;
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local3.target[_local3.property] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
if (!(_local4[_index] is _type)){
_index = (_local4.length - 1);
_local2 = (_local4.length - 1);
while (_local2 > -1) {
if ((_local4[_local2] is _type)){
_index = _local2;
break;
};
_local2--;
};
};
_local4[_index] = _filter;
_target.filters = _local4;
}
}
}//package gs.plugins
Section 57
//FramePlugin (gs.plugins.FramePlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class FramePlugin extends TweenPlugin {
protected var _target:MovieClip;
public var frame:int;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function FramePlugin(){
this.propName = "frame";
this.overwriteProps = ["frame"];
this.round = true;
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is MovieClip))) || (isNaN(_arg2)))){
return (false);
};
_target = (_arg1 as MovieClip);
addTween(this, "frame", _target.currentFrame, _arg2, "frame");
return (true);
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.gotoAndStop(this.frame);
}
}
}//package gs.plugins
Section 58
//GlowFilterPlugin (gs.plugins.GlowFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class GlowFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function GlowFilterPlugin(){
this.propName = "glowFilter";
this.overwriteProps = ["glowFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = GlowFilter;
initFilter(_arg2, new GlowFilter(0xFFFFFF, 0, 0, 0, ((_arg2.strength) || (1)), ((_arg2.quality) || (2)), _arg2.inner, _arg2.knockout));
return (true);
}
}
}//package gs.plugins
Section 59
//HexColorsPlugin (gs.plugins.HexColorsPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class HexColorsPlugin extends TweenPlugin {
protected var _colors:Array;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function HexColorsPlugin(){
this.propName = "hexColors";
this.overwriteProps = [];
}
override public function killProps(_arg1:Object):void{
var _local2:int = (_colors.length - 1);
while (_local2 > -1) {
if (_arg1[_colors[_local2][1]] != undefined){
_colors.splice(_local2, 1);
};
_local2--;
};
super.killProps(_arg1);
}
public function initColor(_arg1:Object, _arg2:String, _arg3:uint, _arg4:uint):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg3 != _arg4){
if (_colors == null){
_colors = [];
};
_local5 = (_arg3 >> 16);
_local6 = ((_arg3 >> 8) & 0xFF);
_local7 = (_arg3 & 0xFF);
_colors[_colors.length] = [_arg1, _arg2, _local5, ((_arg4 >> 16) - _local5), _local6, (((_arg4 >> 8) & 0xFF) - _local6), _local7, ((_arg4 & 0xFF) - _local7)];
this.overwriteProps[this.overwriteProps.length] = _arg2;
};
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:Array;
_local2 = (_colors.length - 1);
while (_local2 > -1) {
_local3 = _colors[_local2];
_local3[0][_local3[1]] = ((((_local3[2] + (_arg1 * _local3[3])) << 16) | ((_local3[4] + (_arg1 * _local3[5])) << 8)) | (_local3[6] + (_arg1 * _local3[7])));
_local2--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:String;
for (_local4 in _arg2) {
initColor(_arg1, _local4, uint(_arg1[_local4]), uint(_arg2[_local4]));
};
return (true);
}
}
}//package gs.plugins
Section 60
//RemoveTintPlugin (gs.plugins.RemoveTintPlugin)
package gs.plugins {
public class RemoveTintPlugin extends TintPlugin {
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function RemoveTintPlugin(){
this.propName = "removeTint";
}
}
}//package gs.plugins
Section 61
//RoundPropsPlugin (gs.plugins.RoundPropsPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class RoundPropsPlugin extends TweenPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function RoundPropsPlugin(){
this.propName = "roundProps";
this.overwriteProps = [];
this.round = true;
}
public function add(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number):void{
addTween(_arg1, _arg2, _arg3, (_arg3 + _arg4), _arg2);
this.overwriteProps[this.overwriteProps.length] = _arg2;
}
}
}//package gs.plugins
Section 62
//ShortRotationPlugin (gs.plugins.ShortRotationPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class ShortRotationPlugin extends TweenPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function ShortRotationPlugin(){
this.propName = "shortRotation";
this.overwriteProps = [];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:String;
if (typeof(_arg2) == "number"){
trace("WARNING: You appear to be using the old shortRotation syntax. Instead of passing a number, please pass an object with properties that correspond to the rotations values For example, TweenMax.to(mc, 2, {shortRotation:{rotationX:-170, rotationY:25}})");
return (false);
};
for (_local4 in _arg2) {
initRotation(_arg1, _local4, _arg1[_local4], _arg2[_local4]);
};
return (true);
}
public function initRotation(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number):void{
var _local5:Number = ((_arg4 - _arg3) % 360);
if (((_arg4 - _arg3) % 360) != (_local5 % 180)){
_local5 = ((_local5)<0) ? (_local5 + 360) : (_local5 - 360);
};
addTween(_arg1, _arg2, _arg3, (_arg3 + _local5), _arg2);
this.overwriteProps[this.overwriteProps.length] = _arg2;
}
}
}//package gs.plugins
Section 63
//TintPlugin (gs.plugins.TintPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.geom.*;
import gs.utils.tween.*;
public class TintPlugin extends TweenPlugin {
protected var _target:DisplayObject;
protected var _ct:ColorTransform;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
protected static var _props:Array = ["redMultiplier", "greenMultiplier", "blueMultiplier", "alphaMultiplier", "redOffset", "greenOffset", "blueOffset", "alphaOffset"];
public function TintPlugin(){
this.propName = "tint";
this.overwriteProps = ["tint"];
}
public function init(_arg1:DisplayObject, _arg2:ColorTransform):void{
var _local3:int;
var _local4:String;
_target = _arg1;
_ct = _target.transform.colorTransform;
_local3 = (_props.length - 1);
while (_local3 > -1) {
_local4 = _props[_local3];
if (_ct[_local4] != _arg2[_local4]){
_tweens[_tweens.length] = new TweenInfo(_ct, _local4, _ct[_local4], (_arg2[_local4] - _ct[_local4]), "tint", false);
};
_local3--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!(_arg1 is DisplayObject)){
return (false);
};
var _local4:ColorTransform = new ColorTransform();
if (((!((_arg2 == null))) && (!((_arg3.exposedVars.removeTint == true))))){
_local4.color = uint(_arg2);
};
if (((!((_arg3.exposedVars.alpha == undefined))) || (!((_arg3.exposedVars.autoAlpha == undefined))))){
_local4.alphaMultiplier = ((_arg3.exposedVars.alpha)!=undefined) ? _arg3.exposedVars.alpha : _arg3.exposedVars.autoAlpha;
_arg3.killVars({alpha:1, autoAlpha:1});
} else {
_local4.alphaMultiplier = _arg1.alpha;
};
init((_arg1 as DisplayObject), _local4);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.transform.colorTransform = _ct;
}
}
}//package gs.plugins
Section 64
//TweenPlugin (gs.plugins.TweenPlugin)
package gs.plugins {
import gs.*;
import gs.utils.tween.*;
public class TweenPlugin {
public var overwriteProps:Array;
protected var _tweens:Array;
public var propName:String;
public var onComplete:Function;
public var round:Boolean;
protected var _changeFactor:Number;// = 0
public static const VERSION:Number = 1.03;
public static const API:Number = 1;
public function TweenPlugin(){
_tweens = [];
super();
}
protected function updateTweens(_arg1:Number):void{
var _local2:int;
var _local3:TweenInfo;
var _local4:Number;
var _local5:int;
if (this.round){
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_local5 = ((_local4)<0) ? -1 : 1;
_local3.target[_local3.property] = ((((_local4 % 1) * _local5))>0.5) ? (int(_local4) + _local5) : int(_local4);
_local2--;
};
} else {
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local3.target[_local3.property] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
};
}
public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_changeFactor = _arg1;
}
protected function addTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4, _arg5:String=null):void{
var _local6:Number;
if (_arg4 != null){
_local6 = ((typeof(_arg4))=="number") ? (_arg4 - _arg3) : Number(_arg4);
if (_local6 != 0){
_tweens[_tweens.length] = new TweenInfo(_arg1, _arg2, _arg3, _local6, ((_arg5) || (_arg2)), false);
};
};
}
public function killProps(_arg1:Object):void{
var _local2:int;
_local2 = (this.overwriteProps.length - 1);
while (_local2 > -1) {
if ((this.overwriteProps[_local2] in _arg1)){
this.overwriteProps.splice(_local2, 1);
};
_local2--;
};
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
if ((_tweens[_local2].name in _arg1)){
_tweens.splice(_local2, 1);
};
_local2--;
};
}
public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
addTween(_arg1, this.propName, _arg1[this.propName], _arg2, this.propName);
return (true);
}
public function get changeFactor():Number{
return (_changeFactor);
}
public static function activate(_arg1:Array):Boolean{
var _local2:int;
var _local3:Object;
_local2 = (_arg1.length - 1);
while (_local2 > -1) {
_local3 = new (_arg1[_local2]);
TweenLite.plugins[_local3.propName] = _arg1[_local2];
_local2--;
};
return (true);
}
}
}//package gs.plugins
Section 65
//VisiblePlugin (gs.plugins.VisiblePlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class VisiblePlugin extends TweenPlugin {
protected var _target:Object;
protected var _visible:Boolean;
protected var _tween:TweenLite;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function VisiblePlugin(){
this.propName = "visible";
this.overwriteProps = ["visible"];
this.onComplete = onCompleteTween;
}
public function onCompleteTween():void{
if (((!((_tween.vars.runBackwards == true))) && ((_tween.ease == _tween.vars.ease)))){
_target.visible = _visible;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_tween = _arg3;
_visible = Boolean(_arg2);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
if (_target.visible != true){
_target.visible = true;
};
}
}
}//package gs.plugins
Section 66
//VolumePlugin (gs.plugins.VolumePlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.media.*;
public class VolumePlugin extends TweenPlugin {
protected var _target:Object;
protected var _st:SoundTransform;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function VolumePlugin(){
this.propName = "volume";
this.overwriteProps = ["volume"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((isNaN(_arg2)) || (!(_arg1.hasOwnProperty("soundTransform"))))){
return (false);
};
_target = _arg1;
_st = _target.soundTransform;
addTween(_st, "volume", _st.volume, _arg2, "volume");
return (Boolean(!((_tweens.length == 0))));
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.soundTransform = _st;
}
}
}//package gs.plugins
Section 67
//ArrayTweenInfo (gs.utils.tween.ArrayTweenInfo)
package gs.utils.tween {
public class ArrayTweenInfo {
public var change:Number;
public var start:Number;
public var index:uint;
public function ArrayTweenInfo(_arg1:uint, _arg2:Number, _arg3:Number){
this.index = _arg1;
this.start = _arg2;
this.change = _arg3;
}
}
}//package gs.utils.tween
Section 68
//TweenInfo (gs.utils.tween.TweenInfo)
package gs.utils.tween {
public class TweenInfo {
public var start:Number;
public var name:String;
public var change:Number;
public var target:Object;
public var property:String;
public var isPlugin:Boolean;
public function TweenInfo(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Boolean){
this.target = _arg1;
this.property = _arg2;
this.start = _arg3;
this.change = _arg4;
this.name = _arg5;
this.isPlugin = _arg6;
}
}
}//package gs.utils.tween
Section 69
//OverwriteManager (gs.OverwriteManager)
package gs {
import flash.utils.*;
import gs.utils.tween.*;
import flash.errors.*;
public class OverwriteManager {
public static const ALL:int = 1;
public static const NONE:int = 0;
public static const AUTO:int = 2;
public static const CONCURRENT:int = 3;
public static const version:Number = 3.11;
public static var mode:int;
public static var enabled:Boolean;
public static function killVars(_arg1:Object, _arg2:Object, _arg3:Array):void{
var _local4:int;
var _local5:String;
var _local6:TweenInfo;
_local4 = (_arg3.length - 1);
while (_local4 > -1) {
_local6 = _arg3[_local4];
if ((_local6.name in _arg1)){
_arg3.splice(_local4, 1);
} else {
if (((_local6.isPlugin) && ((_local6.name == "_MULTIPLE_")))){
_local6.target.killProps(_arg1);
if (_local6.target.overwriteProps.length == 0){
_arg3.splice(_local4, 1);
};
};
};
_local4--;
};
for (_local5 in _arg1) {
delete _arg2[_local5];
};
}
public static function manageOverwrites(_arg1:TweenLite, _arg2:Array):void{
var _local7:int;
var _local8:TweenLite;
var _local9:Array;
var _local10:Object;
var _local11:int;
var _local12:TweenInfo;
var _local13:Array;
var _local3:Object = _arg1.vars;
var _local4:int = ((_local3.overwrite)==undefined) ? mode : int(_local3.overwrite);
if ((((_local4 < 2)) || ((_arg2 == null)))){
return;
};
var _local5:Number = _arg1.startTime;
var _local6:Array = [];
_local7 = (_arg2.length - 1);
while (_local7 > -1) {
_local8 = _arg2[_local7];
if (((((!((_local8 == _arg1))) && ((_local8.startTime <= _local5)))) && (((_local8.startTime + ((_local8.duration * 1000) / _local8.combinedTimeScale)) > _local5)))){
_local6[_local6.length] = _local8;
};
_local7--;
};
if ((((_local6.length == 0)) || ((_arg1.tweens.length == 0)))){
return;
};
if (_local4 == AUTO){
_local9 = _arg1.tweens;
_local10 = {};
_local7 = (_local9.length - 1);
while (_local7 > -1) {
_local12 = _local9[_local7];
if (((_local12.isPlugin) && ((_local12.name == "_MULTIPLE_")))){
_local13 = _local12.target.overwriteProps;
_local11 = (_local13.length - 1);
while (_local11 > -1) {
_local10[_local13[_local11]] = true;
_local11--;
};
_local10[_local12.target.propName] = true;
} else {
_local10[_local12.name] = true;
};
_local7--;
};
_local7 = (_local6.length - 1);
while (_local7 > -1) {
killVars(_local10, _local6[_local7].exposedVars, _local6[_local7].tweens);
_local7--;
};
} else {
_local7 = (_local6.length - 1);
while (_local7 > -1) {
_local6[_local7].enabled = false;
_local7--;
};
};
}
public static function init(_arg1:int=2):int{
if (TweenLite.version < 10.04){
trace("TweenLite warning: Your TweenLite class needs to be updated to work with OverwriteManager (or you may need to clear your ASO files). Please download and install the latest version from http://www.tweenlite.com.");
};
TweenLite.overwriteManager = OverwriteManager;
mode = _arg1;
enabled = true;
return (mode);
}
}
}//package gs
Section 70
//TweenLite (gs.TweenLite)
package gs {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import gs.plugins.*;
import gs.utils.tween.*;
public class TweenLite {
public var started:Boolean;
public var delay:Number;
protected var _hasUpdate:Boolean;
protected var _hasPlugins:Boolean;
public var initted:Boolean;
public var active:Boolean;
public var startTime:Number;
public var target:Object;
public var duration:Number;
public var gc:Boolean;
public var tweens:Array;
public var vars:Object;
public var ease:Function;
public var exposedVars:Object;
public var initTime:Number;
public var combinedTimeScale:Number;
public static const version:Number = 10.06;
private static var _timer:Timer = new Timer(2000);
public static var defaultEase:Function = TweenLite.easeOut;
public static var plugins:Object = {};
public static var currentTime:uint;
public static var masterList:Dictionary = new Dictionary(false);
protected static var _reservedProps:Object = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, roundProps:1, onStart:1, onStartParams:1, persist:1, renderOnStart:1, proxiedEase:1, easeParams:1, yoyo:1, loop:1, onCompleteListener:1, onUpdateListener:1, onStartListener:1, orientToBezier:1};
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
public static var timingSprite:Sprite = new Sprite();
public static var overwriteManager:Object;
private static var _tlInitted:Boolean;
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
if (_arg1 == null){
return;
};
if (!_tlInitted){
TweenPlugin.activate([TintPlugin, RemoveTintPlugin, FramePlugin, AutoAlphaPlugin, VisiblePlugin, VolumePlugin, EndArrayPlugin]);
currentTime = getTimer();
timingSprite.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
_timer.addEventListener("timer", killGarbage, false, 0, true);
_timer.start();
_tlInitted = true;
};
this.vars = _arg3;
this.duration = ((_arg2) || (0.001));
this.delay = ((_arg3.delay) || (0));
this.combinedTimeScale = ((_arg3.timeScale) || (1));
this.active = Boolean((((_arg2 == 0)) && ((this.delay == 0))));
this.target = _arg1;
if (typeof(this.vars.ease) != "function"){
this.vars.ease = defaultEase;
};
if (this.vars.easeParams != null){
this.vars.proxiedEase = this.vars.ease;
this.vars.ease = easeProxy;
};
this.ease = this.vars.ease;
this.exposedVars = ((this.vars.isTV)==true) ? this.vars.exposedVars : this.vars;
this.tweens = [];
this.initTime = currentTime;
this.startTime = (this.initTime + (this.delay * 1000));
var _local4:int = ((((_arg3.overwrite == undefined)) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
if (((!((_arg1 in masterList))) || ((_local4 == 1)))){
masterList[_arg1] = [this];
} else {
masterList[_arg1].push(this);
};
if ((((((this.vars.runBackwards == true)) && (!((this.vars.renderOnStart == true))))) || (this.active))){
initTweenVals();
if (this.active){
render((this.startTime + 1));
} else {
render(this.startTime);
};
if (((((!((this.exposedVars.visible == null))) && ((this.vars.runBackwards == true)))) && ((this.target is DisplayObject)))){
this.target.visible = this.exposedVars.visible;
};
};
}
public function get enabled():Boolean{
return ((this.gc) ? false : true);
}
public function set enabled(_arg1:Boolean):void{
var _local2:Array;
var _local3:Boolean;
var _local4:int;
if (_arg1){
if (!(this.target in masterList)){
masterList[this.target] = [this];
} else {
_local2 = masterList[this.target];
_local4 = (_local2.length - 1);
while (_local4 > -1) {
if (_local2[_local4] == this){
_local3 = true;
break;
};
_local4--;
};
if (!_local3){
_local2[_local2.length] = this;
};
};
};
this.gc = (_arg1) ? false : true;
if (this.gc){
this.active = false;
} else {
this.active = this.started;
};
}
public function clear():void{
this.tweens = [];
this.vars = (this.exposedVars = {ease:this.vars.ease});
_hasUpdate = false;
}
public function render(_arg1:uint):void{
var _local3:Number;
var _local4:TweenInfo;
var _local5:int;
var _local2:Number = ((_arg1 - this.startTime) * 0.001);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = ((((this.ease == this.vars.ease)) || ((this.duration == 0.001)))) ? 1 : 0;
} else {
_local3 = this.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4.target[_local4.property] = (_local4.start + (_local3 * _local4.change));
_local5--;
};
if (_hasUpdate){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
public function activate():void{
this.started = (this.active = true);
if (!this.initted){
initTweenVals();
};
if (this.vars.onStart != null){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (this.duration == 0.001){
this.startTime = (this.startTime - 1);
};
}
public function initTweenVals():void{
var _local1:String;
var _local2:int;
var _local3:*;
var _local4:TweenInfo;
for (_local1 in this.exposedVars) {
if ((_local1 in _reservedProps)){
} else {
if ((_local1 in plugins)){
_local3 = new (plugins[_local1]);
if (_local3.onInitTween(this.target, this.exposedVars[_local1], this) == false){
this.tweens[this.tweens.length] = new TweenInfo(this.target, _local1, this.target[_local1], ((typeof(this.exposedVars[_local1]))=="number") ? (this.exposedVars[_local1] - this.target[_local1]) : Number(this.exposedVars[_local1]), _local1, false);
} else {
this.tweens[this.tweens.length] = new TweenInfo(_local3, "changeFactor", 0, 1, ((_local3.overwriteProps.length)==1) ? _local3.overwriteProps[0] : "_MULTIPLE_", true);
_hasPlugins = true;
};
} else {
this.tweens[this.tweens.length] = new TweenInfo(this.target, _local1, this.target[_local1], ((typeof(this.exposedVars[_local1]))=="number") ? (this.exposedVars[_local1] - this.target[_local1]) : Number(this.exposedVars[_local1]), _local1, false);
};
};
};
if (this.vars.runBackwards == true){
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
_local4 = this.tweens[_local2];
this.tweens[_local2].start = (_local4.start + _local4.change);
_local4.change = -(_local4.change);
_local2--;
};
};
if (this.vars.onUpdate != null){
_hasUpdate = true;
};
if (((TweenLite.overwriteManager.enabled) && ((this.target in masterList)))){
overwriteManager.manageOverwrites(this, masterList[this.target]);
};
this.initted = true;
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
public function killVars(_arg1:Object):void{
if (overwriteManager.enabled){
overwriteManager.killVars(_arg1, this.exposedVars, this.tweens);
};
}
public function complete(_arg1:Boolean=false):void{
var _local2:int;
if (!_arg1){
if (!this.initted){
initTweenVals();
};
this.startTime = (currentTime - ((this.duration * 1000) / this.combinedTimeScale));
render(currentTime);
return;
};
if (_hasPlugins){
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
if (((this.tweens[_local2].isPlugin) && (!((this.tweens[_local2].target.onComplete == null))))){
this.tweens[_local2].target.onComplete();
};
_local2--;
};
};
if (this.vars.persist != true){
this.enabled = false;
};
if (this.vars.onComplete != null){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
};
}
public static function updateAll(_arg1:Event=null):void{
var _local4:Array;
var _local5:int;
var _local6:TweenLite;
var _local2:uint = (currentTime = getTimer());
var _local3:Dictionary = masterList;
for each (_local4 in _local3) {
_local5 = (_local4.length - 1);
while (_local5 > -1) {
_local6 = _local4[_local5];
if (_local6.active){
_local6.render(_local2);
} else {
if (_local6.gc){
_local4.splice(_local5, 1);
} else {
if (_local2 >= _local6.startTime){
_local6.activate();
_local6.render(_local2);
};
};
};
_local5--;
};
};
}
public static function removeTween(_arg1:TweenLite, _arg2:Boolean=true):void{
if (_arg1 != null){
if (_arg2){
_arg1.clear();
};
_arg1.enabled = false;
};
}
public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{
var _local3:Array;
var _local4:int;
var _local5:TweenLite;
if (((!((_arg1 == null))) && ((_arg1 in masterList)))){
_local3 = masterList[_arg1];
_local4 = (_local3.length - 1);
while (_local4 > -1) {
_local5 = _local3[_local4];
if (((_arg2) && (!(_local5.gc)))){
_local5.complete(false);
};
_local5.clear();
_local4--;
};
delete masterList[_arg1];
};
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
protected static function killGarbage(_arg1:TimerEvent):void{
var _local3:Object;
var _local2:Dictionary = masterList;
for (_local3 in _local2) {
if (_local2[_local3].length == 0){
delete _local2[_local3];
};
};
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, overwrite:0}));
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 71
//TweenMax (gs.TweenMax)
package gs {
import flash.events.*;
import flash.utils.*;
import gs.plugins.*;
import gs.utils.tween.*;
import gs.events.*;
public class TweenMax extends TweenLite implements IEventDispatcher {
protected var _dispatcher:EventDispatcher;
protected var _callbacks:Object;
public var pauseTime:Number;
protected var _repeatCount:Number;
protected var _timeScale:Number;
public static const version:Number = 10.07;
public static var removeTween:Function = TweenLite.removeTween;
private static var _overwriteMode:int = (OverwriteManager.enabled) ? OverwriteManager.mode : OverwriteManager.init();
;
protected static var _pausedTweens:Dictionary = new Dictionary(false);
protected static var _globalTimeScale:Number = 1;
public static var killTweensOf:Function = TweenLite.killTweensOf;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
private static var _activatedPlugins:Boolean = TweenPlugin.activate([TintPlugin, RemoveTintPlugin, FramePlugin, AutoAlphaPlugin, VisiblePlugin, VolumePlugin, EndArrayPlugin, HexColorsPlugin, BlurFilterPlugin, ColorMatrixFilterPlugin, BevelFilterPlugin, DropShadowFilterPlugin, GlowFilterPlugin, RoundPropsPlugin, BezierPlugin, BezierThroughPlugin, ShortRotationPlugin]);
private static var _versionCheck:Boolean = ((TweenLite.version)<10.06) ? trace("TweenMax error! Please update your TweenLite class or try deleting your ASO files. TweenMax requires a more recent version. Download updates at http://www.TweenMax.com.") : true;
;
public function TweenMax(_arg1:Object, _arg2:Number, _arg3:Object){
super(_arg1, _arg2, _arg3);
if (((!((this.combinedTimeScale == 1))) && ((this.target is TweenMax)))){
_timeScale = 1;
this.combinedTimeScale = _globalTimeScale;
} else {
_timeScale = this.combinedTimeScale;
this.combinedTimeScale = (this.combinedTimeScale * _globalTimeScale);
};
if (((!((this.combinedTimeScale == 1))) && (!((this.delay == 0))))){
this.startTime = (this.initTime + (this.delay * (1000 / this.combinedTimeScale)));
};
if (((((!((this.vars.onCompleteListener == null))) || (!((this.vars.onUpdateListener == null))))) || (!((this.vars.onStartListener == null))))){
initDispatcher();
if ((((_arg2 == 0)) && ((this.delay == 0)))){
onUpdateDispatcher();
onCompleteDispatcher();
};
};
_repeatCount = 0;
if (((!(isNaN(this.vars.yoyo))) || (!(isNaN(this.vars.loop))))){
this.vars.persist = true;
};
}
public function dispatchEvent(_arg1:Event):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.dispatchEvent(_arg1));
}
public function get reversed():Boolean{
return ((this.ease == reverseEase));
}
public function set reversed(_arg1:Boolean):void{
if (this.reversed != _arg1){
reverse();
};
}
public function get progress():Number{
var _local1:Number = (isNaN(this.pauseTime)) ? currentTime : this.pauseTime;
var _local2:Number = (((((_local1 - this.initTime) * 0.001) - (this.delay / this.combinedTimeScale)) / this.duration) * this.combinedTimeScale);
if (_local2 > 1){
return (1);
};
if (_local2 < 0){
return (0);
};
return (_local2);
}
override public function set enabled(_arg1:Boolean):void{
if (!_arg1){
_pausedTweens[this] = null;
delete _pausedTweens[this];
};
super.enabled = _arg1;
if (_arg1){
this.combinedTimeScale = (_timeScale * _globalTimeScale);
};
}
protected function onStartDispatcher(... _args):void{
if (_callbacks.onStart != null){
_callbacks.onStart.apply(null, this.vars.onStartParams);
};
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.START));
}
public function setDestination(_arg1:String, _arg2, _arg3:Boolean=true):void{
var _local5:int;
var _local6:Object;
var _local7:Array;
var _local8:Boolean;
var _local9:Array;
var _local10:Object;
var _local11:int;
var _local12:Array;
var _local4:Number = this.progress;
if (this.initted){
if (((!(_arg3)) && (!((_local4 == 0))))){
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
if (this.tweens[_local5].name == _arg1){
this.tweens[_local5].target[this.tweens[_local5].property] = this.tweens[_local5].start;
};
_local5--;
};
};
_local6 = this.vars;
_local7 = this.tweens;
_local8 = _hasPlugins;
this.tweens = [];
this.vars = (this.exposedVars = {});
this.vars[_arg1] = _arg2;
initTweenVals();
if (((!((this.ease == reverseEase))) && ((_local6.ease is Function)))){
this.ease = _local6.ease;
};
if (((_arg3) && (!((_local4 == 0))))){
adjustStartValues();
};
_local9 = this.tweens;
this.vars = _local6;
this.tweens = _local7;
_local10 = {};
_local5 = (_local9.length - 1);
while (_local5 > -1) {
if (_local9[_local5][4] == "_MULTIPLE_"){
_local12 = _local9[_local5][0].overwriteProps;
_local11 = (_local12.length - 1);
while (_local11 > -1) {
_local10[_local12[_local11]] = true;
_local11--;
};
} else {
_local10[_local9[_local5][4]] = true;
};
_local5--;
};
killVars(_local10);
this.tweens = this.tweens.concat(_local9);
_hasPlugins = Boolean(((_local8) || (_hasPlugins)));
};
this.vars[_arg1] = _arg2;
}
override public function initTweenVals():void{
var _local1:int;
var _local2:int;
var _local3:String;
var _local4:String;
var _local5:Array;
var _local6:Object;
var _local7:TweenInfo;
if (this.exposedVars.startAt != null){
this.exposedVars.startAt.overwrite = 0;
new TweenMax(this.target, 0, this.exposedVars.startAt);
};
super.initTweenVals();
if ((((this.exposedVars.roundProps is Array)) && (!((TweenLite.plugins.roundProps == null))))){
_local5 = this.exposedVars.roundProps;
_local1 = (_local5.length - 1);
while (_local1 > -1) {
_local3 = _local5[_local1];
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
_local7 = this.tweens[_local2];
if (_local7.name == _local3){
if (_local7.isPlugin){
_local7.target.round = true;
} else {
if (_local6 == null){
_local6 = new TweenLite.plugins.roundProps();
_local6.add(_local7.target, _local3, _local7.start, _local7.change);
_hasPlugins = true;
this.tweens[_local2] = new TweenInfo(_local6, "changeFactor", 0, 1, _local3, true);
} else {
_local6.add(_local7.target, _local3, _local7.start, _local7.change);
this.tweens.splice(_local2, 1);
};
};
} else {
if (((((_local7.isPlugin) && ((_local7.name == "_MULTIPLE_")))) && (!(_local7.target.round)))){
_local4 = ((" " + _local7.target.overwriteProps.join(" ")) + " ");
if (_local4.indexOf(((" " + _local3) + " ")) != -1){
_local7.target.round = true;
};
};
};
_local2--;
};
_local1--;
};
};
}
public function restart(_arg1:Boolean=false):void{
if (_arg1){
this.initTime = currentTime;
this.startTime = (currentTime + (this.delay * (1000 / this.combinedTimeScale)));
} else {
this.startTime = currentTime;
this.initTime = (currentTime - (this.delay * (1000 / this.combinedTimeScale)));
};
_repeatCount = 0;
if (this.target != this.vars.onComplete){
render(this.startTime);
};
this.pauseTime = NaN;
_pausedTweens[this] = null;
delete _pausedTweens[this];
this.enabled = true;
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
if (_dispatcher != null){
_dispatcher.removeEventListener(_arg1, _arg2, _arg3);
};
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
if (_dispatcher == null){
initDispatcher();
};
if ((((_arg1 == TweenEvent.UPDATE)) && (!((this.vars.onUpdate == onUpdateDispatcher))))){
this.vars.onUpdate = onUpdateDispatcher;
_hasUpdate = true;
};
_dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
protected function adjustStartValues():void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:TweenInfo;
var _local6:int;
var _local1:Number = this.progress;
if (_local1 != 0){
_local2 = this.ease(_local1, 0, 1, 1);
_local3 = (1 / (1 - _local2));
_local6 = (this.tweens.length - 1);
while (_local6 > -1) {
_local5 = this.tweens[_local6];
_local4 = (_local5.start + _local5.change);
if (_local5.isPlugin){
_local5.change = ((_local4 - _local2) * _local3);
} else {
_local5.change = ((_local4 - _local5.target[_local5.property]) * _local3);
};
_local5.start = (_local4 - _local5.change);
_local6--;
};
};
}
override public function render(_arg1:uint):void{
var _local3:Number;
var _local4:TweenInfo;
var _local5:int;
var _local2:Number = (((_arg1 - this.startTime) * 0.001) * this.combinedTimeScale);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = ((((this.ease == this.vars.ease)) || ((this.duration == 0.001)))) ? 1 : 0;
} else {
_local3 = this.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4.target[_local4.property] = (_local4.start + (_local3 * _local4.change));
_local5--;
};
if (_hasUpdate){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
protected function initDispatcher():void{
var _local1:Object;
var _local2:String;
if (_dispatcher == null){
_dispatcher = new EventDispatcher(this);
_callbacks = {onStart:this.vars.onStart, onUpdate:this.vars.onUpdate, onComplete:this.vars.onComplete};
if (this.vars.isTV == true){
this.vars = this.vars.clone();
} else {
_local1 = {};
for (_local2 in this.vars) {
_local1[_local2] = this.vars[_local2];
};
this.vars = _local1;
};
this.vars.onStart = onStartDispatcher;
this.vars.onComplete = onCompleteDispatcher;
if ((this.vars.onStartListener is Function)){
_dispatcher.addEventListener(TweenEvent.START, this.vars.onStartListener, false, 0, true);
};
if ((this.vars.onUpdateListener is Function)){
_dispatcher.addEventListener(TweenEvent.UPDATE, this.vars.onUpdateListener, false, 0, true);
this.vars.onUpdate = onUpdateDispatcher;
_hasUpdate = true;
};
if ((this.vars.onCompleteListener is Function)){
_dispatcher.addEventListener(TweenEvent.COMPLETE, this.vars.onCompleteListener, false, 0, true);
};
};
}
public function willTrigger(_arg1:String):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.willTrigger(_arg1));
}
public function set progress(_arg1:Number):void{
this.startTime = (currentTime - ((this.duration * _arg1) * 1000));
this.initTime = (this.startTime - (this.delay * (1000 / this.combinedTimeScale)));
if (!this.started){
activate();
};
render(currentTime);
if (!isNaN(this.pauseTime)){
this.pauseTime = currentTime;
this.startTime = 999999999999999;
this.active = false;
};
}
public function reverse(_arg1:Boolean=true, _arg2:Boolean=true):void{
this.ease = ((this.vars.ease)==this.ease) ? reverseEase : this.vars.ease;
var _local3:Number = this.progress;
if (((_arg1) && ((_local3 > 0)))){
this.startTime = (currentTime - ((((1 - _local3) * this.duration) * 1000) / this.combinedTimeScale));
this.initTime = (this.startTime - (this.delay * (1000 / this.combinedTimeScale)));
};
if (_arg2 != false){
if (_local3 < 1){
resume();
} else {
restart();
};
};
}
protected function onUpdateDispatcher(... _args):void{
if (_callbacks.onUpdate != null){
_callbacks.onUpdate.apply(null, this.vars.onUpdateParams);
};
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.UPDATE));
}
public function set paused(_arg1:Boolean):void{
if (_arg1){
pause();
} else {
resume();
};
}
public function resume():void{
this.enabled = true;
if (!isNaN(this.pauseTime)){
this.initTime = (this.initTime + (currentTime - this.pauseTime));
this.startTime = (this.initTime + (this.delay * (1000 / this.combinedTimeScale)));
this.pauseTime = NaN;
if (((!(this.started)) && ((currentTime >= this.startTime)))){
activate();
} else {
this.active = this.started;
};
_pausedTweens[this] = null;
delete _pausedTweens[this];
};
}
public function get paused():Boolean{
return (!(isNaN(this.pauseTime)));
}
public function reverseEase(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.ease((_arg4 - _arg1), _arg2, _arg3, _arg4));
}
public function killProperties(_arg1:Array):void{
var _local3:int;
var _local2:Object = {};
_local3 = (_arg1.length - 1);
while (_local3 > -1) {
_local2[_arg1[_local3]] = true;
_local3--;
};
killVars(_local2);
}
public function hasEventListener(_arg1:String):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.hasEventListener(_arg1));
}
public function pause():void{
if (isNaN(this.pauseTime)){
this.pauseTime = currentTime;
this.startTime = 999999999999999;
this.enabled = false;
_pausedTweens[this] = this;
};
}
override public function complete(_arg1:Boolean=false):void{
if (((((!(isNaN(this.vars.yoyo))) && ((((_repeatCount < this.vars.yoyo)) || ((this.vars.yoyo == 0)))))) || (((!(isNaN(this.vars.loop))) && ((((_repeatCount < this.vars.loop)) || ((this.vars.loop == 0)))))))){
_repeatCount++;
if (!isNaN(this.vars.yoyo)){
this.ease = ((this.vars.ease)==this.ease) ? reverseEase : this.vars.ease;
};
this.startTime = (_arg1) ? (this.startTime + (this.duration * (1000 / this.combinedTimeScale))) : currentTime;
this.initTime = (this.startTime - (this.delay * (1000 / this.combinedTimeScale)));
} else {
if (this.vars.persist == true){
pause();
};
};
super.complete(_arg1);
}
public function set timeScale(_arg1:Number):void{
if (_arg1 < 1E-5){
_arg1 = (_timeScale = 1E-5);
} else {
_timeScale = _arg1;
_arg1 = (_arg1 * _globalTimeScale);
};
this.initTime = ((currentTime - ((((currentTime - this.initTime) - (this.delay * (1000 / this.combinedTimeScale))) * this.combinedTimeScale) * (1 / _arg1))) - (this.delay * (1000 / _arg1)));
if (this.startTime != 999999999999999){
this.startTime = (this.initTime + (this.delay * (1000 / _arg1)));
};
this.combinedTimeScale = _arg1;
}
public function invalidate(_arg1:Boolean=true):void{
var _local2:Number;
if (this.initted){
_local2 = this.progress;
if (((!(_arg1)) && (!((_local2 == 0))))){
this.progress = 0;
};
this.tweens = [];
_hasPlugins = false;
this.exposedVars = ((this.vars.isTV)==true) ? this.vars.exposedProps : this.vars;
initTweenVals();
_timeScale = ((this.vars.timeScale) || (1));
this.combinedTimeScale = (_timeScale * _globalTimeScale);
this.delay = ((this.vars.delay) || (0));
if (isNaN(this.pauseTime)){
this.startTime = (this.initTime + ((this.delay * 1000) / this.combinedTimeScale));
};
if (((((!((this.vars.onCompleteListener == null))) || (!((this.vars.onUpdateListener == null))))) || (!((this.vars.onStartListener == null))))){
if (_dispatcher != null){
this.vars.onStart = _callbacks.onStart;
this.vars.onUpdate = _callbacks.onUpdate;
this.vars.onComplete = _callbacks.onComplete;
_dispatcher = null;
};
initDispatcher();
};
if (_local2 != 0){
if (_arg1){
adjustStartValues();
} else {
this.progress = _local2;
};
};
};
}
public function get timeScale():Number{
return (_timeScale);
}
protected function onCompleteDispatcher(... _args):void{
if (_callbacks.onComplete != null){
_callbacks.onComplete.apply(null, this.vars.onCompleteParams);
};
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
}
public static function set globalTimeScale(_arg1:Number):void{
setGlobalTimeScale(_arg1);
}
public static function pauseAll(_arg1:Boolean=true, _arg2:Boolean=false):void{
changePause(true, _arg1, _arg2);
}
public static function killAllDelayedCalls(_arg1:Boolean=false):void{
killAll(_arg1, false, true);
}
public static function setGlobalTimeScale(_arg1:Number):void{
var _local3:int;
var _local4:Array;
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
var _local2:Dictionary = masterList;
_globalTimeScale = _arg1;
for each (_local4 in _local2) {
_local3 = (_local4.length - 1);
while (_local3 > -1) {
if ((_local4[_local3] is TweenMax)){
_local4[_local3].timeScale = (_local4[_local3].timeScale * 1);
};
_local3--;
};
};
}
public static function get globalTimeScale():Number{
return (_globalTimeScale);
}
public static function getTweensOf(_arg1:Object):Array{
var _local4:TweenLite;
var _local5:int;
var _local2:Array = masterList[_arg1];
var _local3:Array = [];
if (_local2 != null){
_local5 = (_local2.length - 1);
while (_local5 > -1) {
if (!_local2[_local5].gc){
_local3[_local3.length] = _local2[_local5];
};
_local5--;
};
};
for each (_local4 in _pausedTweens) {
if (_local4.target == _arg1){
_local3[_local3.length] = _local4;
};
};
return (_local3);
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4:Boolean=false):TweenMax{
return (new TweenMax(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, persist:_arg4, overwrite:0}));
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:Array = getTweensOf(_arg1);
var _local3:int = (_local2.length - 1);
while (_local3 > -1) {
if (((_local2[_local3].active) && (!(_local2[_local3].gc)))){
return (true);
};
_local3--;
};
return (false);
}
public static function changePause(_arg1:Boolean, _arg2:Boolean=true, _arg3:Boolean=false):void{
var _local5:Boolean;
var _local4:Array = getAllTweens();
var _local6:int = (_local4.length - 1);
while (_local6 > -1) {
_local5 = (_local4[_local6].target == _local4[_local6].vars.onComplete);
if ((((_local4[_local6] is TweenMax)) && ((((_local5 == _arg3)) || (!((_local5 == _arg2))))))){
_local4[_local6].paused = _arg1;
};
_local6--;
};
}
public static function killAllTweens(_arg1:Boolean=false):void{
killAll(_arg1, true, false);
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenMax{
_arg3.runBackwards = true;
return (new TweenMax(_arg1, _arg2, _arg3));
}
public static function killAll(_arg1:Boolean=false, _arg2:Boolean=true, _arg3:Boolean=true):void{
var _local5:Boolean;
var _local6:int;
var _local4:Array = getAllTweens();
_local6 = (_local4.length - 1);
while (_local6 > -1) {
_local5 = (_local4[_local6].target == _local4[_local6].vars.onComplete);
if ((((_local5 == _arg3)) || (!((_local5 == _arg2))))){
if (_arg1){
_local4[_local6].complete(false);
_local4[_local6].clear();
} else {
TweenLite.removeTween(_local4[_local6], true);
};
};
_local6--;
};
}
public static function getAllTweens():Array{
var _local3:Array;
var _local4:int;
var _local5:TweenLite;
var _local1:Dictionary = masterList;
var _local2:Array = [];
for each (_local3 in _local1) {
_local4 = (_local3.length - 1);
while (_local4 > -1) {
if (!_local3[_local4].gc){
_local2[_local2.length] = _local3[_local4];
};
_local4--;
};
};
for each (_local5 in _pausedTweens) {
_local2[_local2.length] = _local5;
};
return (_local2);
}
public static function resumeAll(_arg1:Boolean=true, _arg2:Boolean=false):void{
changePause(false, _arg1, _arg2);
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenMax{
return (new TweenMax(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 72
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.2.0.3958";
}
}//package mx.core
Section 73
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.2.0.3958";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.left = _arg1;
this.top = _arg2;
this.right = _arg3;
this.bottom = _arg4;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 74
//FlexMovieClip (mx.core.FlexMovieClip)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexMovieClip extends MovieClip {
mx_internal static const VERSION:String = "3.2.0.3958";
public function FlexMovieClip(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 75
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.2.0.3958";
}
}//package mx.core
Section 76
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 77
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 78
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 79
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 80
//MovieClipAsset (mx.core.MovieClipAsset)
package mx.core {
public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.2.0.3958";
public function MovieClipAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 81
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject {
protected var initialHeight:Number;// = 0
private var loader:Loader;// = null
private var initialized:Boolean;// = false
protected var initialWidth:Number;// = 0
private var requestedHeight:Number;
private var requestedWidth:Number;
mx_internal static const VERSION:String = "3.2.0.3958";
public function MovieClipLoaderAsset(){
var _local1:LoaderContext = new LoaderContext();
_local1.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
if (("allowLoadBytesCodeExecution" in _local1)){
_local1["allowLoadBytesCodeExecution"] = true;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.loadBytes(movieClipData, _local1);
addChild(loader);
}
override public function get width():Number{
if (!initialized){
return (initialWidth);
};
return (super.width);
}
override public function set width(_arg1:Number):void{
if (!initialized){
requestedWidth = _arg1;
} else {
loader.width = _arg1;
};
}
override public function get measuredHeight():Number{
return (initialHeight);
}
private function completeHandler(_arg1:Event):void{
initialized = true;
initialWidth = loader.width;
initialHeight = loader.height;
if (!isNaN(requestedWidth)){
loader.width = requestedWidth;
};
if (!isNaN(requestedHeight)){
loader.height = requestedHeight;
};
dispatchEvent(_arg1);
}
override public function set height(_arg1:Number):void{
if (!initialized){
requestedHeight = _arg1;
} else {
loader.height = _arg1;
};
}
override public function get measuredWidth():Number{
return (initialWidth);
}
override public function get height():Number{
if (!initialized){
return (initialHeight);
};
return (super.height);
}
public function get movieClipData():ByteArray{
return (null);
}
}
}//package mx.core
Section 82
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 83
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.2.0.3958";
}
}//package mx.core
Section 84
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.2.0.3958";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = _arg1;
try {
o = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
} catch(e:SecurityError) {
};
return (result);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 85
//AI (net.odd1.chromeWars2.AI.AI)
package net.odd1.chromeWars2.AI {
public class AI {
private var m_xml:XML;
private static var s_instance:AI;
public function AI(){
if (s_instance){
throw (new Error("Singleton can only be accessed through Singleton.getInstance()"));
};
}
public function xml_completeHandler(_arg1:XML):void{
m_xml = _arg1;
}
public function setXml(_arg1:XML):void{
m_xml = _arg1;
}
public function chooseAction(_arg1:int, _arg2:String):String{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
_local3 = m_xml.AI.State[_arg1].@nbActions;
_local4 = (Math.random() * 100);
_local5 = 0;
_local6 = 0;
while (_local6 < _local3) {
_local5 = (_local5 + m_xml.AI.State[_arg1].action[_local6].attribute(_arg2));
if (_local4 <= _local5){
return (m_xml.AI.State[_arg1].action[_local6].@name);
};
_local6++;
};
return ("");
}
public static function getInstance():AI{
if (!s_instance){
s_instance = new (AI);
};
return (s_instance);
}
}
}//package net.odd1.chromeWars2.AI
Section 86
//Robot (net.odd1.chromeWars2.characters.Robot)
package net.odd1.chromeWars2.characters {
import net.odd1.minig.managers.*;
import net.odd1.chromeWars2.screens.*;
import flash.display.*;
import net.odd1.minig.animations.*;
import gs.*;
import net.odd1.chromeWars2.AI.*;
import net.odd1.chromeWars2.global.*;
import flash.geom.*;
import gs.easing.*;
import net.odd1.minig.global.*;
import net.odd1.minig.utils.*;
public final class Robot extends Sprite {
private const TRANSITION_TIME:Number = 1;
private var fps:int;
public var power:int;
public var arena:Arena;
public var hp:int;
public var specialMaxRange:int;
public var chargeHits:Number;
public var weapon:int;
public var isFiringRockets:Boolean;
public var hpTotal:int;
public var legs:int;
public var originalPodX:Number;
public var originalPodY:Number;
public var color1:int;
public var color2:int;
public var goPlayIdle:Boolean;
public var shieldLeft:int;
public var repairLeft:int;
public var shieldBonus:Number;
public var specialMaxDamage:int;
public var preciseHits:Number;
public var nitroLeft:int;
public var armor:Number;
private var type:int;
public var agility:int;
public var speed:int;
public var defense:int;
public var podAnimation0:MovieClipAnimation;
public var chargeDamage:Number;
public var eyeAnimation:MovieClipAnimation;
private var weapon0Animation:MovieClipAnimation;
public var podAnimation1:MovieClipAnimation;
public var grit:int;
public var gold:int;
public var minDamage:int;
public var wheelAnimation:MovieClipAnimation;
public var boss:Boolean;
public var usedNitro:int;
private var robot:Sprite;
public var chrome:int;
public var bruteDamage:Number;
public var precision:int;
public var critics:Number;
public var animation:MovieClipAnimation;
public var enemy:Robot;
private var weapon1Animation:MovieClipAnimation;
public var shoulder:int;
public var container:MovieClip;
public var body:int;
public var preciseDamage:Number;
public var usedShield:int;
public var bruteHits:Number;
public var specialMinDamage:int;
public var usedRepair:int;
public var fullName:String;
public var isFiringLasers:Boolean;
public var reloadXML:XML;
public var isPerformingAction:Boolean;
public var rocketsLeft:int;
public var nitroBonus:Number;
public var needReload:Boolean;
public var armorRef:Number;
public var ignore:int;
public var head:int;
public var inArena:Boolean;
public var remainingSpecial:int;
public var specialMinRange:int;
public var specials:int;
public var maxDamage:int;
public var endTurn:Boolean;
public static const ACTION_TAUNT:String = "taunt";
public static const ACTION_SHIELD:String = "shield";
public static const MIN_DIST:int = 90;
public static const DIR_LEFT:int = -1;
public static const SHIELD_USEMAX:int = 1;
public static const ACTION_MOVE_FORWARD:String = "move_forward";
public static const BOSS_OFFSET:int = 15;
public static const DIR_RIGHT:int = 1;
public static const ACTION_NITRO:String = "nitro";
public static const STATE_LONG_RANGE:int = 0;
public static const SHIELD_BONUS_CONST:Number = 1;
public static const ACTION_REPAIR:String = "repair";
public static const STATE_CLOSE_RANGE:int = 3;
public static const ACTION_MOVE_RIGHT:String = "move_right";
public static const NITRO_BONUS_CONST:Number = 1;
public static const ACTION_MOVE_BACKWARD:String = "move_backward";
public static const STATE_WEAPON_RANGE:int = 1;
public static const ACTION_FLAME:String = "flame";
public static const ACTION_RANGE:String = "range";
public static const ACTION_CHARGE:String = "charge";
public static const ACTION_WAIT:String = "wait";
public static const STATE_CHARGE_RANGE:int = 2;
public static const ACTION_LASER:String = "laser";
public static const NITRO_USEMAX:int = 1;
public static const STATE_DAMAGED:int = 4;
public static const ACTION_MOVE_LEFT:String = "move_left";
public static const ACTION_BRUTE:String = "brute";
public static const REPAIR_USEMAX:int = 1;
public static const ACTION_ATTACK:String = "attack";
public static const ACTION_ROCKET:String = "rocket";
public static const ITEM_USEONLYONE:Boolean = true;
public function Robot(){
head = -1;
weapon = -1;
legs = -1;
body = -1;
shoulder = -1;
specials = -1;
rocketsLeft = 0;
type = -1;
isPerformingAction = false;
isFiringRockets = false;
endTurn = false;
needReload = false;
RessourceManager.getInstance().loadSWF(Ressources.ROBOT_CLASS, Ressources.ROBOT_PATH, robotLoaded);
}
public function rocketFireAnimation_completeHandler(_arg1:Animation):void{
isFiringRockets = false;
}
private function robotLoaded(_arg1:MovieClip):void{
robot = (new ((_arg1.loaderInfo.applicationDomain.getDefinition("Robot") as Class)) as Sprite);
robot.getChildByName("robotShape0").visible = false;
robot.getChildByName("robotShape1").visible = false;
fps = _arg1.loaderInfo.frameRate;
addChild(robot);
if (goPlayIdle){
animation.playLabel("idle", true, null, true);
goPlayIdle = false;
};
}
public function updateData(_arg1:XML):void{
power = _arg1.@power;
agility = _arg1.@agility;
speed = _arg1.@speed;
precision = _arg1.@precision;
defense = _arg1.@defense;
grit = _arg1.@grit;
chrome = _arg1.@chrome;
fullName = String(_arg1.@name).toUpperCase();
gold = _arg1.@credits;
boss = (((_arg1.@boss) && ((_arg1.@boss == "true")))) ? true : false;
color1 = _arg1.@color1;
color2 = _arg1.@color2;
repairLeft = _arg1.@repair;
nitroLeft = _arg1.@nitro;
shieldLeft = _arg1.@shield;
nitroBonus = 0;
shieldBonus = 0;
if (!boss){
if (needReload){
RessourceManager.getInstance().loadSWF(Ressources.ROBOT_CLASS, Ressources.ROBOT_PATH, robotReloaded);
reloadXML = _arg1;
} else {
changeBody(int(_arg1.@body));
changeShoulder(int(_arg1.@shoulder));
changeHead(int(_arg1.@head));
changeWeapon(int(_arg1.@weapon));
changeLegs(int(_arg1.@legs));
changeSpecial(int(_arg1.@specials));
updateStats(boss);
updateColors(color1, color2);
};
} else {
loadBoss();
};
if (eyeAnimation){
eyeAnimation.playLabel("idle", true);
};
}
public function repair_completeHandler(_arg1:Animation):void{
var _local2:int;
_local2 = (0.25 * hpTotal);
hp = (hp + _local2);
hp = Math.min(hp, hpTotal);
SoundPlayer.getInstance().playRepair();
arena.displayMessage((_local2 + " repaired !"));
arena.updateRepairCount(this);
endOfAction();
}
public function lastAnimation_completeHandler(_arg1:Animation):void{
endOfTurn();
}
public function flamerAnimation_completeHandler(_arg1:Animation):void{
var _local2:Number;
var _local3:Number;
_local2 = ((preciseDamage * (specialMinDamage + int(((specialMaxDamage - specialMinDamage) * Math.random())))) * (1 + nitroBonus));
_local3 = (((critics + (0.01 * agility)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility));
if ((enemy.armor - ignore) > 0){
_local2 = (_local2 - (_local2 * (enemy.armor - ignore)));
};
if (_local2 <= 0){
_local2 = 1;
};
if (Math.random() < _local3){
_local2 = (_local2 * 2);
arena.displayMessage((int(_local2) + " critical !"));
SoundPlayer.getInstance().playCrowdFight();
SoundPlayer.getInstance().playCritic();
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_CRIT, _local2);
};
} else {
arena.displayMessage((int(_local2) + " damage !"));
SoundPlayer.getInstance().playAttack();
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_HIT, _local2);
};
};
enemy.hp = (enemy.hp - int(_local2));
if (enemy.hp <= 0){
enemy.hp = 0;
enemy.animation.playLabel("defeat", false, defeat_completeHandler);
if (enemy.eyeAnimation){
enemy.eyeAnimation.playLabel("death", false);
};
} else {
enemy.animation.playLabel("damage", false, lastAnimation_completeHandler);
};
endOfTurn();
}
public function itemAnimation_completeHandler(_arg1:Animation):void{
endOfAction();
}
public function setEnemy(_arg1:Robot):void{
if (_arg1){
enemy = _arg1;
};
}
public function update_armor():void{
armor = (armorRef * (1 + (shieldBonus * 250)));
}
public function updateStats(_arg1:Boolean):void{
var _local2:XML;
var _local3:Array;
var _local4:XMLList;
var _local5:XML;
var _local6:XMLList;
var _local7:int;
var _local8:XML;
var _local9:XML;
var _local10:int;
_local2 = GlobalVariables.data;
critics = Number(_local2.game.character.@critics);
preciseHits = Number(_local2.game.character.@preciseHits);
preciseDamage = Number(_local2.game.character.@preciseDamage);
bruteDamage = Number(_local2.game.character.@bruteDamage);
bruteHits = Number(_local2.game.character.@bruteHits);
chargeHits = Number(_local2.game.character.@chargeHits);
chargeDamage = Number(_local2.game.character.@chargeDamage);
ignore = 0;
armor = 0;
minDamage = 0;
maxDamage = 0;
specialMinDamage = 0;
specialMaxDamage = 0;
_local4 = _local2.game.armors;
if (!_arg1){
_local3 = [_local4.legs.leg[legs], _local4.chests.chest[body], _local4.heads.head[head], _local4.shoulders.shoulder[shoulder], _local2.game.weapons.weapon[weapon]];
} else {
_local10 = (BOSS_OFFSET + ChromeWars2.currentArena);
_local3 = [_local4.legs.leg[_local10], _local4.chests.chest[_local10], _local4.heads.head[_local10], _local4.shoulders.shoulder[_local10], _local2.game.weapons.weapon[_local10]];
};
for each (_local5 in _local3) {
_local6 = _local5.stats;
minDamage = (minDamage + int(_local6.@minDamage));
maxDamage = (maxDamage + int(_local6.@maxDamage));
armor = (armor + Number(_local6.@armor));
power = (power + int(_local6.@power));
agility = (agility + int(_local6.@agility));
speed = (speed + int(_local6.@speed));
precision = (precision + int(_local6.@precision));
defense = (defense + int(_local6.@defense));
grit = (grit + int(_local6.@grit));
chrome = (chrome + int(_local6.@chrome));
chargeDamage = (chargeDamage + Number(_local6.@charge));
critics = (critics + Number(_local6.@critical));
ignore = (ignore + int(_local6.@ignore));
};
_local8 = _local2.game.specials.special[specials];
_local6 = _local8.stats;
armor = (armor + Number(_local6.@armor));
power = (power + int(_local6.@power));
agility = (agility + int(_local6.@agility));
speed = (speed + int(_local6.@speed));
precision = (precision + int(_local6.@precision));
defense = (defense + int(_local6.@defense));
grit = (grit + int(_local6.@grit));
chrome = (chrome + int(_local6.@chrome));
chargeDamage = (chargeDamage + Number(_local6.@charge));
critics = (critics + Number(_local6.@critical));
ignore = (ignore + int(_local6.@ignore));
specialMinDamage = (specialMinDamage + int(_local6.@minDamage));
specialMaxDamage = (specialMaxDamage + int(_local6.@maxDamage));
specialMinRange = int(_local6.@rangeMin);
specialMaxRange = int(_local6.@rangeMax);
specialMinDamage = (specialMinDamage + (power * int(_local2.game.@powerAdd)));
specialMaxDamage = (specialMaxDamage + (power * int(_local2.game.@powerAdd)));
minDamage = (minDamage + (power * int(_local2.game.@powerAdd)));
maxDamage = (maxDamage + (power * int(_local2.game.@powerAdd)));
hp = (grit * 75);
hpTotal = hp;
if (this == ChromeWars2.enemy){
repairLeft = 3;
nitroLeft = 0;
shieldLeft = 0;
} else {
if (arena){
arena.hud_setItems();
};
};
switch (specials){
case 0:
remainingSpecial = 0;
break;
case 1:
case 2:
case 3:
remainingSpecial = 3;
break;
case 4:
case 5:
case 6:
remainingSpecial = 5;
break;
};
if (_arg1){
};
armorRef = armor;
}
public function laserPodFire_completeHandler(_arg1:MovieClipAnimation):void{
TweenMax.to(container.laserPod, 1, {y:originalPodY, ease:Cubic.easeInOut, onComplete:laserPodReturnTweenComplete});
if (specials == 1){
podAnimation0.playLabel("idle");
} else {
if (specials == 4){
podAnimation1.playLabel("idle");
};
};
}
public function rollAI():void{
var _local1:int;
var _local2:Number;
var _local3:String;
var _local4:Number;
if ((((((hp < hpTotal)) && ((repairLeft > 0)))) && ((usedRepair < REPAIR_USEMAX)))){
_local4 = ((hp / hpTotal) * 100);
_local3 = ((_local4 >= 80)) ? "80" : ((_local4 >= 50)) ? "50" : ((_local4 >= 25)) ? "25" : "0";
if (AI.getInstance().chooseAction(STATE_DAMAGED, _local3) == ACTION_REPAIR){
performAction(ACTION_REPAIR);
return;
};
};
_local2 = Math.abs((x - enemy.x));
if ((((((((remainingSpecial > 0)) && ((specialMaxRange > 0)))) && ((_local2 > specialMinRange)))) && ((_local2 < ((arena.forwardMin + (speed * arena.forwardPixels)) + specialMaxRange))))){
_local1 = STATE_WEAPON_RANGE;
} else {
if (_local2 < arena.attackRange){
_local1 = STATE_CLOSE_RANGE;
} else {
if (_local2 < ((arena.forwardMin + (speed * arena.forwardPixels)) + arena.attackRange)){
_local1 = STATE_CHARGE_RANGE;
} else {
_local1 = STATE_LONG_RANGE;
};
};
};
performAction(AI.getInstance().chooseAction(_local1, "value"));
}
public function laserPodTweenComplete():void{
if (specials == 1){
podAnimation0.playLabel("attack", false, laserPodAttack_completeHandler);
} else {
if (specials == 4){
podAnimation1.playLabel("attack", false, laserPodAttack_completeHandler);
};
};
}
public function laserAllHit_completeHandler():void{
var _local1:Number;
var _local2:Number;
_local1 = ((preciseDamage * (specialMinDamage + int(((specialMaxDamage - specialMinDamage) * Math.random())))) * (1 + nitroBonus));
_local2 = (((critics + (0.01 * agility)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility));
if ((enemy.armor - ignore) > 0){
_local1 = (_local1 - (_local1 * (enemy.armor - ignore)));
};
if (_local1 <= 0){
_local1 = 1;
};
if (Math.random() < _local2){
_local1 = (_local1 * 2);
arena.displayMessage((int(_local1) + " critical !"));
SoundPlayer.getInstance().playCrowdFight();
SoundPlayer.getInstance().playCritic();
} else {
arena.displayMessage((int(_local1) + " damage !"));
SoundPlayer.getInstance().playAttack();
};
enemy.hp = (enemy.hp - int(_local1));
if (enemy.hp <= 0){
enemy.hp = 0;
enemy.animation.playLabel("defeat", false, defeat_completeHandler);
if (enemy.eyeAnimation){
enemy.eyeAnimation.playLabel("death", false);
};
} else {
enemy.animation.playLabel("damage", false, lastAnimation_completeHandler);
};
}
public function changeShoulder(_arg1:int, _arg2:Boolean=false):void{
var _part = _arg1;
var force = _arg2;
if (((container) && (((!((shoulder == _part))) || (force))))){
shoulder = _part;
container.s1.gotoAndStop((shoulder + 1));
container.s1.addFrameScript(shoulder, function ():void{
container.s1.addFrameScript((container.s1.currentFrame - 1), null);
Utils.changeColor(container.s1, color1, color2);
Utils.changeChrome(container.s1, chrome);
});
container.s2.gotoAndStop((shoulder + 1));
container.s2.addFrameScript(shoulder, function ():void{
container.s2.addFrameScript((container.s2.currentFrame - 1), null);
Utils.changeColor(container.s2, color1, color2);
Utils.changeChrome(container.s2, chrome);
});
};
}
public function changeBody(_arg1:int):void{
var _part = _arg1;
if (_part <= 8){
switchType(0);
} else {
switchType(1);
};
if (_part != body){
body = _part;
if (body <= 8){
container.chest.gotoAndStop((body + 1));
container.chest.addFrameScript(body, function ():void{
container.chest.addFrameScript((container.chest.currentFrame - 1), null);
Utils.changeColor(container.chest, color1, color2);
Utils.changeChrome(container.chest, chrome);
});
} else {
container.chest.gotoAndStop(((body + 1) - 9));
container.chest.addFrameScript((body - 9), function ():void{
container.chest.addFrameScript((container.chest.currentFrame - 1), null);
Utils.changeColor(container.chest, color1, color2);
Utils.changeChrome(container.chest, chrome);
});
};
};
}
public function loadBoss():void{
RessourceManager.getInstance().loadSWF(Ressources[(("BOSS" + ChromeWars2.currentArena) + "_CLASS")], Ressources[(("BOSS" + ChromeWars2.currentArena) + "_PATH")], bossLoaded);
}
public function update_hud():void{
if (this == ChromeWars2.enemy){
arena.hud.P2_repairCount = repairLeft;
arena.hud.P2_nitroCount = nitroLeft;
arena.hud.P2_shieldCount = shieldLeft;
arena.hud.P2_specialCount = remainingSpecial;
arena.hud.setCounters("P2", arena.hud.P2_repairCount, arena.hud.P2_nitroCount, arena.hud.P2_shieldCount, arena.hud.P2_specialCount);
};
if (this == ChromeWars2.player){
arena.hud.P1_repairCount = repairLeft;
arena.hud.P1_nitroCount = nitroLeft;
arena.hud.P1_shieldCount = shieldLeft;
arena.hud.P1_specialCount = remainingSpecial;
arena.hud.setCounters("P1", arena.hud.P1_repairCount, arena.hud.P1_nitroCount, arena.hud.P1_shieldCount, arena.hud.P1_specialCount);
arena.hud_setItems();
};
}
private function robotReloaded(_arg1:MovieClip):void{
var _local2:XML;
if (robot.parent){
robot.parent.removeChild(robot);
};
robot = (new ((_arg1.loaderInfo.applicationDomain.getDefinition("Robot") as Class)) as Sprite);
robot.getChildByName("robotShape0").visible = false;
robot.getChildByName("robotShape1").visible = false;
type = -1;
fps = _arg1.loaderInfo.frameRate;
addChild(robot);
changeBody(int(reloadXML.@body));
changeShoulder(int(reloadXML.@shoulder), true);
changeHead(int(reloadXML.@head), true);
changeWeapon(int(reloadXML.@weapon), true);
changeLegs(int(reloadXML.@legs), true);
changeSpecial(int(reloadXML.@specials), true);
updateStats(boss);
updateColors(color1, color2);
needReload = false;
reloadXML = null;
}
public function repelled(_arg1:Number):void{
var _local2:Number = (x + ((((_arg1 * arena.forwardPixels) + arena.forwardMin) * scaleX) * -1));
_local2 = Math.max(_local2, -575);
_local2 = Math.min(_local2, 655);
TweenMax.to(this, 1, {x:_local2});
}
public function laserAnimation_completeHandler(_arg1:Animation):void{
endOfTurn();
}
public function isMovingForward(_arg1:int):Boolean{
return ((((((_arg1 == DIR_RIGHT)) && ((x < enemy.x)))) || ((((_arg1 == DIR_LEFT)) && ((x > enemy.x))))));
}
private function switchType(_arg1:int):void{
if (type != _arg1){
type = _arg1;
killContainer();
container = (robot.getChildByName(("robotShape" + type)) as MovieClip);
container.visible = true;
animation = new MovieClipAnimation(container, MovieClipUtil.getAnimationData(container), fps, false);
changeHead(head, true);
changeShoulder(shoulder, true);
changeWeapon(weapon, true);
changeLegs(legs, true);
changeSpecial((specials - 1), true);
podAnimation0 = new MovieClipAnimation(container.laserPod.anim0, MovieClipUtil.getAnimationData(container.laserPod.anim0), fps, false);
podAnimation1 = new MovieClipAnimation(container.laserPod.anim1, MovieClipUtil.getAnimationData(container.laserPod.anim1), fps, false);
};
}
public function render(_arg1:Number):void{
var _local2:MovieClip;
var _local3:Point;
if (container){
animation.render(_arg1);
if (specials == 1){
podAnimation0.render(_arg1);
} else {
if (specials == 4){
podAnimation1.render(_arg1);
};
};
if (weapon0Animation){
weapon0Animation.render(_arg1);
};
if (weapon1Animation){
weapon1Animation.render(_arg1);
};
if (wheelAnimation){
wheelAnimation.render(_arg1);
};
if (eyeAnimation){
eyeAnimation.render(_arg1);
};
if (arena){
if (isFiringRockets){
_local2 = container.chest.rocket;
while (rocketsLeft > 0) {
_local3 = arena.content.stageMC.globalToLocal(_local2.localToGlobal(new Point(_local2[("rocket" + rocketsLeft)].x, _local2[("rocket" + rocketsLeft)].y)));
arena.projectilesHolder.fire_missile(this, _local3.x, _local3.y, enemy.x, (enemy.y - 150));
rocketsLeft--;
};
isFiringRockets = false;
};
if (isFiringLasers){
if ((scaleX > 0)){
arena.projectilesHolder.fire_laser(this, 60, 0, (enemy.x - 20), 0);
} else {
arena.projectilesHolder.fire_laser(this, -60, 0, (enemy.x + 20), 0);
};
isFiringLasers = false;
};
};
};
}
public function updateColors(_arg1:int, _arg2:int):void{
Utils.changeColor(container, _arg1, _arg2);
Utils.changeChrome(container, chrome);
}
public function laserPodReturnTweenComplete():void{
endOfTurn();
}
public function rocketAnimation_completeHandler(_arg1:Animation):void{
if (specials == 3){
rocketsLeft = 9;
} else {
if (specials == 6){
rocketsLeft = 13;
};
};
isFiringRockets = true;
animation.playLabel("rocket_fire", false, rocketFireAnimation_completeHandler);
}
public function chargeMouvement_completeHandler():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
_local1 = (((chargeHits + (0.02 * precision)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility));
if (Math.random() < _local1){
_local3 = (((chargeDamage * (minDamage + int(((maxDamage - minDamage) * Math.random())))) + (speed * 5)) * (1 + nitroBonus));
_local2 = (((critics + (0.01 * agility)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility));
if ((enemy.armor - ignore) > 0){
_local3 = (_local3 - (_local3 * (enemy.armor - ignore)));
};
if (_local3 <= 0){
_local3 = 1;
};
if (Math.random() < _local2){
_local3 = (_local3 * 2);
arena.displayMessage((int(_local3) + " critical !"));
SoundPlayer.getInstance().playCritic();
SoundPlayer.getInstance().playCrowdFight();
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_CRIT, _local3);
};
if ((power - enemy.power) > 0){
enemy.repelled((power - enemy.power));
};
} else {
arena.displayMessage((int(_local3) + " damage !"));
SoundPlayer.getInstance().playAttack();
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_HIT, _local3);
};
};
enemy.hp = (enemy.hp - int(_local3));
if (enemy.hp <= 0){
enemy.hp = 0;
enemy.animation.playLabel("defeat", false, defeat_completeHandler);
if (enemy.eyeAnimation){
enemy.eyeAnimation.playLabel("death", false);
};
} else {
enemy.animation.playLabel("damage", false);
};
animation.playLabel("charge2", false, lastAnimation_completeHandler);
} else {
SoundPlayer.getInstance().playMiss();
enemy.animation.playLabel("block", false);
arena.displayMessage("Miss !");
animation.playLabel("charge2", false, lastAnimation_completeHandler);
};
}
public function endOfTurn():void{
isPerformingAction = false;
endTurn = true;
if (((wheelAnimation) && ((legs <= 5)))){
wheelAnimation.stopAnim();
};
animation.playLabel("idle");
}
public function changeHead(_arg1:int, _arg2:Boolean=false):void{
var _part = _arg1;
var force = _arg2;
if (((container) && (((!((head == _part))) || (force))))){
head = _part;
container.head.gotoAndStop((head + 1));
container.head.addFrameScript(head, function ():void{
container.head.addFrameScript((container.head.currentFrame - 1), null);
if (eyeAnimation){
eyeAnimation.destroy();
};
var _local1:MovieClip = (container.head.getChildAt(0) as MovieClip);
_local1 = (_local1.getChildAt((_local1.numChildren - 1)) as MovieClip);
if (_local1){
eyeAnimation = new MovieClipAnimation(_local1, MovieClipUtil.getAnimationData(_local1), 30, true);
eyeAnimation.playLabel("idle", true);
};
Utils.changeColor(container.head, color1, color2);
Utils.changeChrome(container.head, chrome);
});
};
}
public function charge(_arg1:int):void{
var _local2:Number;
var _local3:Number;
_local2 = (enemy.x + (MIN_DIST * ((_arg1 == DIR_RIGHT)) ? -1 : 1));
_local2 = Math.max(_local2, -575);
_local2 = Math.min(_local2, 655);
_local3 = Math.abs((x - _local2));
TweenMax.to(this, (_local3 / 200), {x:_local2, ease:Cubic.easeIn, onComplete:chargeMouvement_completeHandler});
}
public function rocketAllHit_completeHandler():void{
var _local1:Number;
var _local2:Number;
_local1 = ((preciseDamage * (specialMinDamage + int(((specialMaxDamage - specialMinDamage) * Math.random())))) * (1 + nitroBonus));
_local2 = (((critics + (0.01 * agility)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility));
if ((enemy.armor - ignore) > 0){
_local1 = (_local1 - (_local1 * (enemy.armor - ignore)));
};
if (_local1 <= 0){
_local1 = 1;
};
if (Math.random() < _local2){
_local1 = (_local1 * 2);
arena.displayMessage((int(_local1) + " critical !"));
SoundPlayer.getInstance().playCrowdFight();
SoundPlayer.getInstance().playCritic();
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_CRIT, _local1);
};
} else {
arena.displayMessage((int(_local1) + " damage !"));
SoundPlayer.getInstance().playAttack();
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_HIT, _local1);
};
};
enemy.hp = (enemy.hp - int(_local1));
if (enemy.hp <= 0){
enemy.hp = 0;
enemy.animation.playLabel("defeat", false, defeat_completeHandler);
if (enemy.eyeAnimation){
enemy.eyeAnimation.playLabel("death", false);
};
} else {
enemy.animation.playLabel("damage", false, lastAnimation_completeHandler);
};
endOfTurn();
}
public function chargeAnimation_completeHandler(_arg1:Animation):void{
animation.playLabel("charge1");
charge(((x < enemy.x)) ? DIR_RIGHT : DIR_LEFT);
}
private function killContainer():void{
if (container){
container.visible = false;
animation.destroy();
};
}
public function setArena(_arg1:Arena):void{
if (_arg1){
arena = _arg1;
Utils.changeScale(this, power);
if (this == ChromeWars2.player){
arena.hud.hud.options.y = (480 - (scaleY * 500));
};
};
}
public function defeat_completeHandler(_arg1:Animation):void{
enemy.animation.playLabel("defeatLoop");
}
public function move(_arg1:int):void{
var _local2:Number;
var _local3:Number;
_local2 = (x + (_arg1 * (arena.forwardMin + (speed * arena.forwardPixels))));
if (Math.abs((_local2 - enemy.x)) < MIN_DIST){
if ((((((x < enemy.x)) && ((_local2 < enemy.x)))) || ((((x > enemy.x)) && ((_local2 > enemy.x)))))){
_local2 = (enemy.x - (MIN_DIST * _arg1));
} else {
_local2 = (enemy.x + (MIN_DIST * _arg1));
};
};
_local2 = Math.max(_local2, -575);
_local2 = Math.min(_local2, 655);
if (wheelAnimation){
wheelAnimation.playLabel("", true);
};
TweenMax.to(this, 1, {x:_local2, onComplete:endOfTurn});
}
private function bossLoaded(_arg1:MovieClip):void{
if (robot.parent){
robot.parent.removeChild(robot);
};
robot = _arg1.boss;
robot.y = 0;
robot.x = 0;
killContainer();
container = (robot as MovieClip);
container.visible = true;
fps = _arg1.loaderInfo.frameRate;
animation = new MovieClipAnimation(container, MovieClipUtil.getAnimationData(container), fps, false);
addChild(robot);
specials = (ChromeWars2.currentArena + 1);
if (container.laserPod){
if (container.laserPod.anim0){
podAnimation0 = new MovieClipAnimation(container.laserPod.anim0, MovieClipUtil.getAnimationData(container.laserPod.anim0), fps, false);
podAnimation0.playLabel("idle");
};
if (container.laserPod.anim1){
podAnimation1 = new MovieClipAnimation(container.laserPod.anim1, MovieClipUtil.getAnimationData(container.laserPod.anim1), fps, false);
podAnimation1.playLabel("idle");
};
};
updateStats(true);
needReload = true;
}
public function attack_completeHandler(_arg1:Animation):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = (((preciseHits + (0.02 * precision)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility));
if (Math.random() < _local2){
_local3 = ((preciseDamage * (minDamage + int(((maxDamage - minDamage) * Math.random())))) * (1 + nitroBonus));
_local4 = (((critics + (0.01 * agility)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility));
if ((enemy.armor - ignore) > 0){
_local3 = (_local3 - (_local3 * (enemy.armor - ignore)));
};
if (_local3 <= 0){
_local3 = 1;
};
if (Math.random() < _local4){
_local3 = (_local3 * 2);
arena.displayMessage((int(_local3) + " critical !"));
SoundPlayer.getInstance().playCrowdFight();
SoundPlayer.getInstance().playCritic();
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_CRIT, _local3);
};
SoundPlayer.getInstance().playCritic();
} else {
arena.displayMessage((int(_local3) + " damage !"));
SoundPlayer.getInstance().playAttack();
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_HIT, _local3);
};
SoundPlayer.getInstance().playAttack();
};
enemy.hp = (enemy.hp - int(_local3));
if (enemy.hp <= 0){
enemy.hp = 0;
enemy.animation.playLabel("defeat", false, defeat_completeHandler);
if (enemy.eyeAnimation){
enemy.eyeAnimation.playLabel("death", false);
};
} else {
enemy.animation.playLabel("damage", false);
};
animation.playLabel("attack0_hit", false, lastAnimation_completeHandler);
} else {
SoundPlayer.getInstance().playMiss();
enemy.animation.playLabel("block", false);
arena.displayMessage("Miss !");
animation.playLabel("attack0_miss", false, lastAnimation_completeHandler);
};
}
public function brute_completeHandler(_arg1:Animation):void{
var _local2:Number;
var _local3:Number;
var _local4:int;
_local2 = (((bruteHits + (0.02 * precision)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility));
if (Math.random() < _local2){
_local4 = ((bruteDamage * (minDamage + int(((maxDamage - minDamage) * Math.random())))) * (1 + nitroBonus));
_local3 = (((critics + (0.01 * agility)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility));
if ((enemy.armor - ignore) > 0){
_local4 = (_local4 - (_local4 * (enemy.armor - ignore)));
};
if (_local4 <= 0){
_local4 = 1;
};
if (Math.random() < _local3){
_local4 = (_local4 * 2);
arena.displayMessage((int(_local4) + " critical !"));
SoundPlayer.getInstance().playCrowdFight();
SoundPlayer.getInstance().playCritic();
if ((power - enemy.power) > 0){
enemy.repelled((power - enemy.power));
};
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_CRIT, _local4);
};
} else {
arena.displayMessage((int(_local4) + " damage !"));
SoundPlayer.getInstance().playAttack();
if (this == ChromeWars2.player){
Utils.updateHighScore(Utils.HS_HIT, _local4);
};
};
enemy.hp = (enemy.hp - int(_local4));
if (enemy.hp <= 0){
enemy.hp = 0;
enemy.animation.playLabel("defeat", false, defeat_completeHandler);
if (enemy.eyeAnimation){
enemy.eyeAnimation.playLabel("death", false);
};
} else {
enemy.animation.playLabel("damage", false);
};
animation.playLabel("attack1_hit", false, lastAnimation_completeHandler);
} else {
SoundPlayer.getInstance().playMiss();
enemy.animation.playLabel("block", false);
arena.displayMessage("Miss !");
animation.playLabel("attack1_miss", false, lastAnimation_completeHandler);
};
}
public function changeWeapon(_arg1:int, _arg2:Boolean=false):void{
var _part = _arg1;
var force = _arg2;
if (((container) && (((!((weapon == _part))) || (force))))){
weapon = _part;
container.weapon0.gotoAndStop((weapon + 1));
container.weapon0.addFrameScript(weapon, function ():void{
container.weapon0.addFrameScript((container.weapon0.currentFrame - 1), null);
Utils.changeColor(container.weapon0, color1, color2);
Utils.changeChrome(container.weapon0, chrome);
if (weapon0Animation){
weapon0Animation.destroy();
};
weapon0Animation = new MovieClipAnimation(container.weapon0.getChildAt(0), MovieClipUtil.getAnimationData(container.weapon0.getChildAt(0)), 30, true);
weapon0Animation.playLabel("", true);
});
container.weapon1.gotoAndStop((weapon + 1));
container.weapon1.addFrameScript(weapon, function ():void{
container.weapon1.addFrameScript((container.weapon1.currentFrame - 1), null);
Utils.changeColor(container.weapon1, color1, color2);
Utils.changeChrome(container.weapon1, chrome);
if (weapon1Animation){
weapon1Animation.destroy();
};
weapon1Animation = new MovieClipAnimation(container.weapon1.getChildAt(0), MovieClipUtil.getAnimationData(container.weapon1.getChildAt(0)), 30, true);
weapon1Animation.playLabel("", true);
});
};
}
public function endOfAction():void{
isPerformingAction = false;
animation.playLabel("idle");
arena.hud_setItems();
if (((wheelAnimation) && ((legs <= 5)))){
wheelAnimation.stopAnim();
};
}
public function changeSpecial(_arg1:int, _arg2:Boolean=false):void{
var _part = _arg1;
var force = _arg2;
_part = (_part + 1);
if (((container) && (((!((specials == _part))) || (force))))){
specials = _part;
container.podShadow.visible = false;
container.laserPod.visible = false;
container.weapon0.flamer.visible = false;
container.weapon1.flamer.visible = false;
container.chest.rocket.visible = false;
switch (specials){
case 2:
container.weapon0.flamer.visible = true;
break;
case 5:
container.weapon0.flamer.visible = true;
break;
case 1:
container.podShadow.visible = true;
container.laserPod.visible = true;
container.laserPod.anim0.visible = true;
container.laserPod.anim1.visible = false;
podAnimation0.playLabel("idle");
break;
case 4:
container.podShadow.visible = true;
container.laserPod.visible = true;
container.laserPod.anim1.visible = true;
container.laserPod.anim0.visible = false;
podAnimation1.playLabel("idle");
break;
case 3:
container.chest.rocket.gotoAndStop(1);
container.chest.rocket.addFrameScript(0, function ():void{
container.chest.rocket.addFrameScript(0, null);
Utils.changeColor(container.chest.rocket, color1, color2);
Utils.changeChrome(container.chest.rocket, chrome);
});
container.chest.rocket.visible = true;
break;
case 6:
container.chest.rocket.gotoAndStop(2);
container.chest.rocket.addFrameScript(1, function ():void{
container.chest.rocket.addFrameScript(1, null);
Utils.changeColor(container.chest.rocket, color1, color2);
Utils.changeChrome(container.chest.rocket, chrome);
});
container.chest.rocket.visible = true;
break;
};
};
}
public function laserPodAttack_completeHandler(_arg1:MovieClipAnimation):void{
isFiringLasers = true;
if (specials == 1){
podAnimation0.playLabel("laser_fire", false, laserPodFire_completeHandler);
} else {
if (specials == 4){
podAnimation1.playLabel("laser_fire", false, laserPodFire_completeHandler);
};
};
}
public function changeLegs(_arg1:int, _arg2:Boolean=false):void{
var _part = _arg1;
var force = _arg2;
if (((container) && (((!((legs == _part))) || (force))))){
legs = _part;
if (legs <= 8){
container.legA2.visible = false;
container.leg2.visible = false;
container.legA1.visible = false;
container.leg1.visible = false;
container.wheels.visible = true;
container.wheels.addFrameScript(legs, function ():void{
container.wheels.addFrameScript((container.wheels.currentFrame - 1), null);
Utils.changeColor(container.wheels, color1, color2);
Utils.changeChrome(container.wheels, chrome);
if (wheelAnimation){
wheelAnimation.destroy();
};
wheelAnimation = new MovieClipAnimation(container.wheels.getChildAt(0), MovieClipUtil.getAnimationData(container.wheels.getChildAt(0)), 30, true);
wheelAnimation.playLabel("", true);
if (legs <= 5){
wheelAnimation.stopAnim();
};
});
container.wheels.gotoAndStop((legs + 1));
} else {
container.legA2.visible = true;
container.legA2.gotoAndStop(((legs + 1) - 9));
container.legA2.addFrameScript((legs - 9), function ():void{
container.legA2.addFrameScript((container.legA2.currentFrame - 1), null);
Utils.changeColor(container.legA2, color1, color2);
Utils.changeChrome(container.legA2, chrome);
});
container.leg2.visible = true;
container.leg2.gotoAndStop(((legs + 1) - 9));
container.leg2.addFrameScript((legs - 9), function ():void{
container.leg2.addFrameScript((container.leg2.currentFrame - 1), null);
Utils.changeColor(container.leg2, color1, color2);
Utils.changeChrome(container.leg2, chrome);
});
container.legA1.visible = true;
container.legA1.gotoAndStop(((legs + 1) - 9));
container.legA1.addFrameScript((legs - 9), function ():void{
container.legA1.addFrameScript((container.legA1.currentFrame - 1), null);
Utils.changeColor(container.legA1, color1, color2);
Utils.changeChrome(container.legA1, chrome);
});
container.leg1.visible = true;
container.leg1.gotoAndStop(((legs + 1) - 9));
container.leg1.addFrameScript((legs - 9), function ():void{
container.leg1.addFrameScript((container.leg1.currentFrame - 1), null);
Utils.changeColor(container.leg1, color1, color2);
Utils.changeChrome(container.leg1, chrome);
});
container.wheels.visible = false;
};
};
}
public function performAction(_arg1:String):void{
var _local2:Number;
var _local3:Number;
isPerformingAction = true;
switch (_arg1){
case ACTION_MOVE_FORWARD:
performAction(((x < enemy.x)) ? ACTION_MOVE_RIGHT : ACTION_MOVE_LEFT);
break;
case ACTION_MOVE_BACKWARD:
performAction(((x < enemy.x)) ? ACTION_MOVE_LEFT : ACTION_MOVE_RIGHT);
break;
case ACTION_MOVE_RIGHT:
move(DIR_RIGHT);
if (isMovingForward(DIR_RIGHT)){
animation.playLabel("walk");
} else {
animation.playLabel("backwards");
};
break;
case ACTION_MOVE_LEFT:
move(DIR_LEFT);
if (isMovingForward(DIR_LEFT)){
animation.playLabel("walk");
} else {
animation.playLabel("backwards");
};
break;
case ACTION_WAIT:
animation.playLabel("taunt", false, lastAnimation_completeHandler);
break;
case ACTION_ATTACK:
animation.playLabel("attack0", false, attack_completeHandler);
break;
case ACTION_BRUTE:
animation.playLabel("attack1", false, brute_completeHandler);
break;
case ACTION_CHARGE:
if (wheelAnimation){
wheelAnimation.playLabel("", true);
};
animation.playLabel("charge0", false, chargeAnimation_completeHandler);
break;
case ACTION_REPAIR:
animation.playLabel("repair", false, repair_completeHandler);
SoundPlayer.getInstance().playRepair();
repairLeft--;
usedRepair++;
update_hud();
break;
case ACTION_TAUNT:
animation.playLabel("taunt", false, lastAnimation_completeHandler);
break;
case ACTION_NITRO:
usedNitro++;
nitroLeft--;
nitroBonus = (nitroBonus + NITRO_BONUS_CONST);
animation.playLabel("nitro", false, itemAnimation_completeHandler);
update_hud();
break;
case ACTION_SHIELD:
usedShield++;
shieldLeft--;
shieldBonus = (shieldBonus + SHIELD_BONUS_CONST);
animation.playLabel("shield", false, itemAnimation_completeHandler);
update_hud();
break;
case ACTION_FLAME:
animation.playLabel("flamer", false, flamerAnimation_completeHandler);
arena.projectilesHolder.create_flame(this, x, enemy.x);
remainingSpecial--;
update_hud();
break;
case ACTION_LASER:
originalPodY = container.laserPod.y;
originalPodX = container.laserPod.x;
_local2 = container.podEnd.y;
_local3 = container.podEnd.x;
TweenMax.to(container.laserPod, 1, {y:_local2, x:_local3, ease:Cubic.easeInOut, onComplete:laserPodTweenComplete});
remainingSpecial--;
update_hud();
break;
case ACTION_ROCKET:
animation.playLabel("rocket", false, rocketAnimation_completeHandler);
remainingSpecial--;
update_hud();
break;
case ACTION_RANGE:
if ((((specials == 2)) || ((specials == 5)))){
performAction(ACTION_FLAME);
} else {
if ((((specials == 1)) || ((specials == 4)))){
performAction(ACTION_LASER);
} else {
if ((((specials == 3)) || ((specials == 6)))){
performAction(ACTION_ROCKET);
};
};
};
break;
};
}
}
}//package net.odd1.chromeWars2.characters
Section 87
//SplashEvent (net.odd1.chromeWars2.events.SplashEvent)
package net.odd1.chromeWars2.events {
import flash.events.*;
public final class SplashEvent extends Event {
public static const END:String = "splashEnd";
public function SplashEvent(_arg1:String){
super(_arg1);
}
}
}//package net.odd1.chromeWars2.events
Section 88
//FontDefault (net.odd1.chromeWars2.fonts.FontDefault)
package net.odd1.chromeWars2.fonts {
import mx.core.*;
public class FontDefault extends FontAsset {
}
}//package net.odd1.chromeWars2.fonts
Section 89
//FontEurostile (net.odd1.chromeWars2.fonts.FontEurostile)
package net.odd1.chromeWars2.fonts {
import mx.core.*;
public class FontEurostile extends FontAsset {
}
}//package net.odd1.chromeWars2.fonts
Section 90
//FontHappyKiller (net.odd1.chromeWars2.fonts.FontHappyKiller)
package net.odd1.chromeWars2.fonts {
import mx.core.*;
public class FontHappyKiller extends FontAsset {
}
}//package net.odd1.chromeWars2.fonts
Section 91
//FontSpinCycle (net.odd1.chromeWars2.fonts.FontSpinCycle)
package net.odd1.chromeWars2.fonts {
import mx.core.*;
public class FontSpinCycle extends FontAsset {
}
}//package net.odd1.chromeWars2.fonts
Section 92
//Ressources (net.odd1.chromeWars2.global.Ressources)
package net.odd1.chromeWars2.global {
import flash.media.*;
public final class Ressources {
public static const BOTSHOP_PATH:String = "./assets/movieclips/screens/BotShop.swf";
public static const STAGE3_PATH:String = "./assets/movieclips/stages/Stage3.swf";
public static const LOBBY_PATH:String = "./assets/movieclips/screens/Lobby.swf";
public static const BOSS1_PATH:String = "./assets/movieclips/characters/boss1.swf";
public static const STAGE0_PATH:String = "./assets/movieclips/stages/Stage0.swf";
public static const STAGE5_PATH:String = "./assets/movieclips/stages/Stage5.swf";
public static const CHOOSEROBOT_PATH:String = "./assets/movieclips/screens/ChooseRobot.swf";
public static const BOSS3_PATH:String = "./assets/movieclips/characters/boss3.swf";
public static const MAINMENU_PATH:String = "./assets/movieclips/screens/MainMenu.swf";
public static const STAGE2_PATH:String = "./assets/movieclips/stages/Stage2.swf";
public static const BOSS0_PATH:String = "./assets/movieclips/characters/boss0.swf";
public static const HUD_PATH:String = "./assets/movieclips/hud/hud.swf";
public static const THEEND_PATH:String = "./assets/movieclips/screens/TheEnd.swf";
public static const BOSS5_PATH:String = "./assets/movieclips/characters/boss5.swf";
public static const AI_XML_PATH:String = "./assets/data/AI.xml";
public static const STAGE4_PATH:String = "./assets/movieclips/stages/Stage4.swf";
public static const PROJECTILES_PATH:String = "./assets/movieclips/characters/projectiles.swf";
public static const TOURNAMENT_PATH:String = "./assets/movieclips/screens/Tournament.swf";
public static const BOSS2_PATH:String = "./assets/movieclips/characters/boss2.swf";
public static const ENEMIES_PATH:String = "./assets/data/enemies.xml";
public static const STAGE1_PATH:String = "./assets/movieclips/stages/Stage1.swf";
public static const STATS_PATH:String = "./assets/movieclips/screens/Stats.swf";
public static const VERSUS_PATH:String = "./assets/movieclips/screens/Versus.swf";
public static const ROBOT_PATH:String = "./assets/movieclips/characters/Robot.swf";
public static const BOSS4_PATH:String = "./assets/movieclips/characters/boss4.swf";
public static var sound_musicMenu:Sound = new Ressources.MUSICMENU_CLASS();
public static var SOUND_BUTTON1_CLASS:Class = Ressources_SOUND_BUTTON1_CLASS;
public static var SOUND_ATTACK0_CLASS:Class = Ressources_SOUND_ATTACK0_CLASS;
public static var SOUND_CRITICAL1_CLASS:Class = Ressources_SOUND_CRITICAL1_CLASS;
public static var sound_button1:Sound = new Ressources.SOUND_BUTTON1_CLASS();
public static var sound_musicFight:Sound = new Ressources.MUSICFIGHT_CLASS();
public static var sound_button0:Sound = new Ressources.SOUND_BUTTON0_CLASS();
public static var ROBOT_CLASS:Class = Ressources_ROBOT_CLASS;
public static var MUSICFIGHT_CLASS:Class = Ressources_MUSICFIGHT_CLASS;
public static var STAGE1_CLASS:Class = Ressources_STAGE1_CLASS;
public static var sound_miss:Sound = new Ressources.SOUND_MISS_CLASS();
public static var STAGE5_CLASS:Class = Ressources_STAGE5_CLASS;
public static var SOUND_ATTACK1_CLASS:Class = Ressources_SOUND_ATTACK1_CLASS;
public static var MUSICMENU_CLASS:Class = Ressources_MUSICMENU_CLASS;
public static var BOSS3_CLASS:Class = Ressources_BOSS3_CLASS;
public static var sound_critical0:Sound = new Ressources.SOUND_CRITICAL0_CLASS();
public static var sound_critical1:Sound = new Ressources.SOUND_CRITICAL1_CLASS();
public static var sound_crowd0:Sound = new Ressources.SOUND_CROWD0_CLASS();
public static var sound_crowd1:Sound = new Ressources.SOUND_CROWD1_CLASS();
public static var PROJECTILES_CLASS:Class = Ressources_PROJECTILES_CLASS;
public static var STAGE2_CLASS:Class = Ressources_STAGE2_CLASS;
public static var SOUND_REPAIR_CLASS:Class = Ressources_SOUND_REPAIR_CLASS;
public static var BOSS4_CLASS:Class = Ressources_BOSS4_CLASS;
public static var TOURNAMENT_CLASS:Class = Ressources_TOURNAMENT_CLASS;
public static var BOSS0_CLASS:Class = Ressources_BOSS0_CLASS;
public static var SOUND_ATTACK2_CLASS:Class = Ressources_SOUND_ATTACK2_CLASS;
public static var LOBBY_CLASS:Class = Ressources_LOBBY_CLASS;
public static var STATS_CLASS:Class = Ressources_STATS_CLASS;
public static var THEEND_CLASS:Class = Ressources_THEEND_CLASS;
public static var SOUND_MISS_CLASS:Class = Ressources_SOUND_MISS_CLASS;
public static var VERSUS_CLASS:Class = Ressources_VERSUS_CLASS;
public static var CHOOSEROBOT_CLASS:Class = Ressources_CHOOSEROBOT_CLASS;
public static var STAGE3_CLASS:Class = Ressources_STAGE3_CLASS;
public static var SOUND_ATTACK3_CLASS:Class = Ressources_SOUND_ATTACK3_CLASS;
public static var BOTSHOP_CLASS:Class = Ressources_BOTSHOP_CLASS;
public static var sound_attack0:Sound = new Ressources.SOUND_ATTACK0_CLASS();
public static var AI_XML_CLASS:Class = Ressources_AI_XML_CLASS;
public static var BOSS1_CLASS:Class = Ressources_BOSS1_CLASS;
public static var BOSS5_CLASS:Class = Ressources_BOSS5_CLASS;
public static var sound_attack3:Sound = new Ressources.SOUND_ATTACK3_CLASS();
public static var sound_repair:Sound = new Ressources.SOUND_REPAIR_CLASS();
public static var SOUND_BUTTON0_CLASS:Class = Ressources_SOUND_BUTTON0_CLASS;
public static var sound_attack1:Sound = new Ressources.SOUND_ATTACK1_CLASS();
public static var sound_attack2:Sound = new Ressources.SOUND_ATTACK2_CLASS();
public static var SOUND_CROWD0_CLASS:Class = Ressources_SOUND_CROWD0_CLASS;
public static var SOUND_CRITICAL0_CLASS:Class = Ressources_SOUND_CRITICAL0_CLASS;
public static var ENEMIES_CLASS:Class = Ressources_ENEMIES_CLASS;
public static var STAGE0_CLASS:Class = Ressources_STAGE0_CLASS;
public static var SOUND_CROWD1_CLASS:Class = Ressources_SOUND_CROWD1_CLASS;
public static var STAGE4_CLASS:Class = Ressources_STAGE4_CLASS;
public static var HUD_CLASS:Class = Ressources_HUD_CLASS;
public static var MAINMENU_CLASS:Class = Ressources_MAINMENU_CLASS;
public static var BOSS2_CLASS:Class = Ressources_BOSS2_CLASS;
}
}//package net.odd1.chromeWars2.global
Section 93
//Ressources_AI_XML_CLASS (net.odd1.chromeWars2.global.Ressources_AI_XML_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_AI_XML_CLASS extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 94
//Ressources_BOSS0_CLASS (net.odd1.chromeWars2.global.Ressources_BOSS0_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_BOSS0_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_BOSS0_CLASS(){
dataClass = Ressources_BOSS0_CLASS_dataClass;
super();
initialWidth = (16000 / 20);
initialHeight = (12000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 95
//Ressources_BOSS0_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_BOSS0_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_BOSS0_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 96
//Ressources_BOSS1_CLASS (net.odd1.chromeWars2.global.Ressources_BOSS1_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_BOSS1_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_BOSS1_CLASS(){
dataClass = Ressources_BOSS1_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (15000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 97
//Ressources_BOSS1_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_BOSS1_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_BOSS1_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 98
//Ressources_BOSS2_CLASS (net.odd1.chromeWars2.global.Ressources_BOSS2_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_BOSS2_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_BOSS2_CLASS(){
dataClass = Ressources_BOSS2_CLASS_dataClass;
super();
initialWidth = (16000 / 20);
initialHeight = (12000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 99
//Ressources_BOSS2_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_BOSS2_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_BOSS2_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 100
//Ressources_BOSS3_CLASS (net.odd1.chromeWars2.global.Ressources_BOSS3_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_BOSS3_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_BOSS3_CLASS(){
dataClass = Ressources_BOSS3_CLASS_dataClass;
super();
initialWidth = (16000 / 20);
initialHeight = (12000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 101
//Ressources_BOSS3_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_BOSS3_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_BOSS3_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 102
//Ressources_BOSS4_CLASS (net.odd1.chromeWars2.global.Ressources_BOSS4_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_BOSS4_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_BOSS4_CLASS(){
dataClass = Ressources_BOSS4_CLASS_dataClass;
super();
initialWidth = (16000 / 20);
initialHeight = (16000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 103
//Ressources_BOSS4_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_BOSS4_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_BOSS4_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 104
//Ressources_BOSS5_CLASS (net.odd1.chromeWars2.global.Ressources_BOSS5_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_BOSS5_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_BOSS5_CLASS(){
dataClass = Ressources_BOSS5_CLASS_dataClass;
super();
initialWidth = (16000 / 20);
initialHeight = (16000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 105
//Ressources_BOSS5_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_BOSS5_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_BOSS5_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 106
//Ressources_BOTSHOP_CLASS (net.odd1.chromeWars2.global.Ressources_BOTSHOP_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_BOTSHOP_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_BOTSHOP_CLASS(){
dataClass = Ressources_BOTSHOP_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 107
//Ressources_BOTSHOP_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_BOTSHOP_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_BOTSHOP_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 108
//Ressources_CHOOSEROBOT_CLASS (net.odd1.chromeWars2.global.Ressources_CHOOSEROBOT_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_CHOOSEROBOT_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_CHOOSEROBOT_CLASS(){
dataClass = Ressources_CHOOSEROBOT_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 109
//Ressources_CHOOSEROBOT_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_CHOOSEROBOT_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_CHOOSEROBOT_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 110
//Ressources_ENEMIES_CLASS (net.odd1.chromeWars2.global.Ressources_ENEMIES_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_ENEMIES_CLASS extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 111
//Ressources_HUD_CLASS (net.odd1.chromeWars2.global.Ressources_HUD_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_HUD_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_HUD_CLASS(){
dataClass = Ressources_HUD_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 112
//Ressources_HUD_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_HUD_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_HUD_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 113
//Ressources_LOBBY_CLASS (net.odd1.chromeWars2.global.Ressources_LOBBY_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_LOBBY_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_LOBBY_CLASS(){
dataClass = Ressources_LOBBY_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 114
//Ressources_LOBBY_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_LOBBY_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_LOBBY_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 115
//Ressources_MAINMENU_CLASS (net.odd1.chromeWars2.global.Ressources_MAINMENU_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_MAINMENU_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_MAINMENU_CLASS(){
dataClass = Ressources_MAINMENU_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 116
//Ressources_MAINMENU_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_MAINMENU_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_MAINMENU_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 117
//Ressources_MUSICFIGHT_CLASS (net.odd1.chromeWars2.global.Ressources_MUSICFIGHT_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_MUSICFIGHT_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 118
//Ressources_MUSICMENU_CLASS (net.odd1.chromeWars2.global.Ressources_MUSICMENU_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_MUSICMENU_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 119
//Ressources_PROJECTILES_CLASS (net.odd1.chromeWars2.global.Ressources_PROJECTILES_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_PROJECTILES_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_PROJECTILES_CLASS(){
dataClass = Ressources_PROJECTILES_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 120
//Ressources_PROJECTILES_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_PROJECTILES_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_PROJECTILES_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 121
//Ressources_ROBOT_CLASS (net.odd1.chromeWars2.global.Ressources_ROBOT_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_ROBOT_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_ROBOT_CLASS(){
dataClass = Ressources_ROBOT_CLASS_dataClass;
super();
initialWidth = (11000 / 20);
initialHeight = (8000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 122
//Ressources_ROBOT_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_ROBOT_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_ROBOT_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 123
//Ressources_SOUND_ATTACK0_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_ATTACK0_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_ATTACK0_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 124
//Ressources_SOUND_ATTACK1_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_ATTACK1_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_ATTACK1_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 125
//Ressources_SOUND_ATTACK2_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_ATTACK2_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_ATTACK2_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 126
//Ressources_SOUND_ATTACK3_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_ATTACK3_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_ATTACK3_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 127
//Ressources_SOUND_BUTTON0_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_BUTTON0_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_BUTTON0_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 128
//Ressources_SOUND_BUTTON1_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_BUTTON1_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_BUTTON1_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 129
//Ressources_SOUND_CRITICAL0_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_CRITICAL0_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_CRITICAL0_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 130
//Ressources_SOUND_CRITICAL1_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_CRITICAL1_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_CRITICAL1_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 131
//Ressources_SOUND_CROWD0_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_CROWD0_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_CROWD0_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 132
//Ressources_SOUND_CROWD1_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_CROWD1_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_CROWD1_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 133
//Ressources_SOUND_MISS_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_MISS_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_MISS_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 134
//Ressources_SOUND_REPAIR_CLASS (net.odd1.chromeWars2.global.Ressources_SOUND_REPAIR_CLASS)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_SOUND_REPAIR_CLASS extends SoundAsset {
}
}//package net.odd1.chromeWars2.global
Section 135
//Ressources_STAGE0_CLASS (net.odd1.chromeWars2.global.Ressources_STAGE0_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_STAGE0_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_STAGE0_CLASS(){
dataClass = Ressources_STAGE0_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 136
//Ressources_STAGE0_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_STAGE0_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_STAGE0_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 137
//Ressources_STAGE1_CLASS (net.odd1.chromeWars2.global.Ressources_STAGE1_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_STAGE1_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_STAGE1_CLASS(){
dataClass = Ressources_STAGE1_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 138
//Ressources_STAGE1_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_STAGE1_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_STAGE1_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 139
//Ressources_STAGE2_CLASS (net.odd1.chromeWars2.global.Ressources_STAGE2_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_STAGE2_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_STAGE2_CLASS(){
dataClass = Ressources_STAGE2_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 140
//Ressources_STAGE2_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_STAGE2_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_STAGE2_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 141
//Ressources_STAGE3_CLASS (net.odd1.chromeWars2.global.Ressources_STAGE3_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_STAGE3_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_STAGE3_CLASS(){
dataClass = Ressources_STAGE3_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 142
//Ressources_STAGE3_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_STAGE3_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_STAGE3_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 143
//Ressources_STAGE4_CLASS (net.odd1.chromeWars2.global.Ressources_STAGE4_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_STAGE4_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_STAGE4_CLASS(){
dataClass = Ressources_STAGE4_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 144
//Ressources_STAGE4_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_STAGE4_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_STAGE4_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 145
//Ressources_STAGE5_CLASS (net.odd1.chromeWars2.global.Ressources_STAGE5_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_STAGE5_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_STAGE5_CLASS(){
dataClass = Ressources_STAGE5_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 146
//Ressources_STAGE5_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_STAGE5_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_STAGE5_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 147
//Ressources_STATS_CLASS (net.odd1.chromeWars2.global.Ressources_STATS_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_STATS_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_STATS_CLASS(){
dataClass = Ressources_STATS_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 148
//Ressources_STATS_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_STATS_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_STATS_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 149
//Ressources_THEEND_CLASS (net.odd1.chromeWars2.global.Ressources_THEEND_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_THEEND_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_THEEND_CLASS(){
dataClass = Ressources_THEEND_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 150
//Ressources_THEEND_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_THEEND_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_THEEND_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 151
//Ressources_TOURNAMENT_CLASS (net.odd1.chromeWars2.global.Ressources_TOURNAMENT_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_TOURNAMENT_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_TOURNAMENT_CLASS(){
dataClass = Ressources_TOURNAMENT_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 152
//Ressources_TOURNAMENT_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_TOURNAMENT_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_TOURNAMENT_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 153
//Ressources_VERSUS_CLASS (net.odd1.chromeWars2.global.Ressources_VERSUS_CLASS)
package net.odd1.chromeWars2.global {
import flash.utils.*;
import mx.core.*;
public class Ressources_VERSUS_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Ressources_VERSUS_CLASS(){
dataClass = Ressources_VERSUS_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.global
Section 154
//Ressources_VERSUS_CLASS_dataClass (net.odd1.chromeWars2.global.Ressources_VERSUS_CLASS_dataClass)
package net.odd1.chromeWars2.global {
import mx.core.*;
public class Ressources_VERSUS_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.global
Section 155
//SoundPlayer (net.odd1.chromeWars2.global.SoundPlayer)
package net.odd1.chromeWars2.global {
import net.odd1.minig.managers.*;
import flash.display.*;
import flash.events.*;
public class SoundPlayer {
private var content:MovieClip;
private static var s_instance:SoundPlayer;
public function SoundPlayer(){
if (s_instance){
throw (new Error("Singleton can only be accessed through Singleton.getInstance()"));
};
}
public function playMiss():void{
SoundManager.getInstance().playSound(Ressources.sound_miss);
}
public function playRepair():void{
SoundManager.getInstance().playSound(Ressources.sound_repair);
}
public function playCrowdFight():void{
SoundManager.getInstance().playSound(Ressources.sound_crowd0);
}
public function playCritic():void{
switch (int((Math.random() * 2))){
case 0:
SoundManager.getInstance().playSound(Ressources.sound_critical0);
break;
case 1:
SoundManager.getInstance().playSound(Ressources.sound_critical1);
break;
};
}
public function updateIconsStates():void{
content.btnMusic.featureOff.visible = (SoundManager.getInstance().isMuteMusic) ? true : false;
content.btnSounds.featureOff.visible = (SoundManager.getInstance().isMuteSound) ? true : false;
}
public function playAttack():void{
switch (int((Math.random() * 4))){
case 0:
SoundManager.getInstance().playSound(Ressources.sound_attack0);
break;
case 1:
SoundManager.getInstance().playSound(Ressources.sound_attack1);
break;
case 2:
SoundManager.getInstance().playSound(Ressources.sound_attack2);
break;
case 3:
SoundManager.getInstance().playSound(Ressources.sound_attack3);
break;
};
}
public function setSoundIcons(_arg1:MovieClip):void{
content = _arg1;
ButtonManager.getInstance().addButton(content.btnMusic, btnMusic_clickHandler);
ButtonManager.getInstance().addButton(content.btnSounds, btnSound_clickHandler);
updateIconsStates();
}
public function btnSound_clickHandler(_arg1:MouseEvent):void{
SoundManager.getInstance().muteSound();
updateIconsStates();
}
public function btnMusic_clickHandler(_arg1:MouseEvent):void{
SoundManager.getInstance().muteMusic();
updateIconsStates();
}
public static function getInstance():SoundPlayer{
if (!s_instance){
s_instance = new (SoundPlayer);
};
return (s_instance);
}
}
}//package net.odd1.chromeWars2.global
Section 156
//Utils (net.odd1.chromeWars2.global.Utils)
package net.odd1.chromeWars2.global {
import net.odd1.chromeWars2.characters.*;
import flash.display.*;
import flash.geom.*;
import net.odd1.minig.global.*;
public class Utils {
public static var trans2:ColorTransform = new ColorTransform();
public static var HS_WINS:int = 3;
public static var trans1:ColorTransform = new ColorTransform();
public static var HS_STREAK:int = 2;
public static var HS_CRIT:int = 1;
public static var HS_LOSS:int = 4;
public static var HS_HIT:int = 0;
public static function getRankString(_arg1:int):String{
var _local2:String;
_local2 = " TH";
switch ((_arg1 % 10)){
case 1:
_local2 = " ST";
break;
case 2:
_local2 = " ND";
break;
case 3:
_local2 = " RD";
break;
};
return ((_arg1 + _local2));
}
public static function updateHighScore(_arg1:int, _arg2:int):void{
var _local3:XML;
var _local4:int;
_local3 = GlobalVariables.save.saves.save[ChromeWars2.currentSave].highScore[0];
switch (_arg1){
case HS_HIT:
_local4 = _local3.@hit;
if (_arg2 > _local4){
_local3.@hit = _arg2;
};
break;
case HS_CRIT:
_local4 = _local3.@crit;
if (_arg2 > _local4){
_local3.@crit = _arg2;
};
break;
case HS_STREAK:
if (_arg2 == 1){
_local4 = _local3.@winStreak;
_local3.@winStreak = (_local4 + 1);
} else {
_local3.@winStreak = 0;
};
break;
case HS_WINS:
_local4 = _local3.@wins;
_local4 = (_local4 + _arg2);
_local3.@wins = _local4;
break;
case HS_LOSS:
_local4 = _local3.@loss;
_local4 = (_local4 + _arg2);
_local3.@loss = _local4;
break;
};
_local3.@highScore = Math.max(0, ((((int(_local3.@hit) + int(_local3.crit)) + getWinStreakPoint(int(_local3.@winStreak))) + int((_local3.@wins * 100))) - int((_local3.@loss * 100))));
}
public static function getPlayerHS():Array{
var _local1:XML;
var _local2:Array;
_local1 = GlobalVariables.save.saves.save[ChromeWars2.currentSave].highScore[0];
_local2 = [int(_local1.@hit), int(_local1.@crit), int(_local1.@winStreak), String(((_local1.@wins + "/") + _local1.@loss)), int(_local1.@highScore)];
return (_local2);
}
public static function getWinStreakPoint(_arg1:int):int{
var _local2:int;
var _local3:int;
_local3 = 0;
_local2 = _arg1;
while (_local2 > 0) {
_local3 = (_local3 + (_local2 * 100));
_local2--;
};
return (_local3);
}
public static function changeChrome(_arg1:MovieClip, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:MovieClip;
var _local6:Number;
_local6 = (_arg2 / 30);
_local6 = Math.min(_local6, 1);
_local4 = _arg1.numChildren;
_local3 = 0;
while (_local3 < _local4) {
_local5 = (_arg1.getChildAt(_local3) as MovieClip);
if (_local5){
if (_local5.chrome){
_local5.chrome.alpha = _local6;
};
if (_local5.numChildren > 0){
changeChrome(_local5, _arg2);
};
};
_local3++;
};
}
public static function changeColor(_arg1:MovieClip, _arg2:int, _arg3:int):void{
var _local4:int;
var _local5:int;
var _local6:MovieClip;
trans1.color = _arg2;
trans2.color = _arg3;
_local5 = _arg1.numChildren;
_local4 = 0;
while (_local4 < _local5) {
_local6 = (_arg1.getChildAt(_local4) as MovieClip);
if (_local6){
if (_local6.colorA){
_local6.colorA.transform.colorTransform = trans1;
};
if (_local6.colorB){
_local6.colorB.transform.colorTransform = trans2;
};
if (_local6.numChildren > 0){
changeColor(_local6, _arg2, _arg3);
};
};
_local4++;
};
}
public static function changeScale(_arg1:Robot, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:MovieClip;
var _local6:Number;
var _local7:int;
_local7 = ((_arg1.scaleX > 0)) ? 1 : -1;
_local6 = (0.4 + (_arg2 / 340));
if (_local6 > 0.6){
_local6 = 0.6;
};
_arg1.scaleX = (_local6 * _local7);
_arg1.scaleY = _local6;
}
public static function setPlayerStats(_arg1:MovieClip):void{
_arg1.yourStats.stat_power.text = ChromeWars2.player.power;
_arg1.yourStats.stat_agility.text = ChromeWars2.player.agility;
_arg1.yourStats.stat_speed.text = ChromeWars2.player.speed;
_arg1.yourStats.stat_precision.text = ChromeWars2.player.precision;
_arg1.yourStats.stat_defense.text = ChromeWars2.player.defense;
_arg1.yourStats.stat_grit.text = ChromeWars2.player.grit;
_arg1.yourStats.stat_chrome.text = ChromeWars2.player.chrome;
_arg1.yourStats.stat_damage.text = ((ChromeWars2.player.minDamage + " - ") + ChromeWars2.player.maxDamage);
_arg1.yourStats.stat_armor.text = (int((ChromeWars2.player.armor * 100)) + "%");
_arg1.yourStats.stat_critBonus.text = (ChromeWars2.player.agility + "%");
_arg1.yourStats.stat_hitBonus.text = ((2 * ChromeWars2.player.precision) + "%");
_arg1.yourStats.stat_hitChance.text = (("-" + ((2 * ChromeWars2.player.defense) + ChromeWars2.player.agility)) + "%");
_arg1.yourStats.stat_gritChance.text = (("-" + ((2 * ChromeWars2.player.defense) + ChromeWars2.player.agility)) + "%");
_arg1.yourStats.stat_wins.text = getRankString((51 - ChromeWars2.currentLevel));
_arg1.yourStats.stats_credits.text = ChromeWars2.player.gold;
}
public static function getGeneralHS():Array{
var _local1:XML;
var _local2:Array;
var _local3:XML;
_local1 = GlobalVariables.save.highscores[0];
_local2 = new Array();
for each (_local3 in _local1.highscore) {
_local2.push(_local3.@robotName);
_local2.push(_local3.@score);
};
return (_local2);
}
}
}//package net.odd1.chromeWars2.global
Section 157
//Version (net.odd1.chromeWars2.global.Version)
package net.odd1.chromeWars2.global {
public final class Version {
public static var BUILD_AUTHOR:String = "jdboivin";
public static var BUILD_NUMBER:String = "4821";
public static var BUILD_TIME:String = "05.01.2010 17:51";
}
}//package net.odd1.chromeWars2.global
Section 158
//Projectile (net.odd1.chromeWars2.projectiles.Projectile)
package net.odd1.chromeWars2.projectiles {
import net.odd1.chromeWars2.characters.*;
import flash.display.*;
import net.odd1.minig.animations.*;
import gs.*;
import flash.geom.*;
import gs.easing.*;
import net.odd1.minig.utils.*;
public class Projectile extends Sprite {
private var acc:Number;
private var display:MovieClip;
public var isAlive:Boolean;
private var callingPlayer:Robot;
private var speed:Number;
private var scale:Number;// = 0.5
private var animation:MovieClipAnimation;
private var angle:Number;
private var xCurve:Number;
private var playerContent:MovieClip;
private var ys:Number;
private var flameScale:Number;
private var type:int;
private var xs:Number;
private var yCurve:Number;
public function Projectile(_arg1:Robot, _arg2:MovieClip, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:int, _arg8:int){
var _local11:Number;
var _local13:Point;
var _local14:Number;
super();
this.callingPlayer = _arg1;
isAlive = true;
addChild(_arg2);
this.display = _arg2;
_arg6 = (_arg6 + (Math.random() * 70));
x = _arg3;
y = _arg4;
var _local9:Number = Math.abs((_arg5 - _arg3));
var _local10:Number = Math.abs((_arg6 - _arg4));
if (_arg3 < _arg5){
_local11 = (_arg3 + (_local9 / 2));
} else {
_local11 = (_arg3 - (_local9 / 2));
};
var _local12:Number = (_arg4 + (_local10 / 2));
xCurve = (_local11 + ((0.5 - Math.random()) * (_local9 / 3)));
yCurve = (_local12 + ((0.5 - Math.random()) * (_local9 / 3)));
switch (_arg8){
case 1:
TweenMax.to(this, (1 * (_local9 / 500)), {bezierThrough:[{x:xCurve, y:yCurve}, {x:_arg5, y:_arg6}], orientToBezier:true, ease:Cubic.easeIn, onComplete:missileTweenComplete});
animation = new MovieClipAnimation(this.display, MovieClipUtil.getAnimationData(this.display), _arg7);
animation.playLabel("missile");
scaleX = scale;
scaleY = scale;
break;
case 2:
playerContent = _arg1.container;
_local13 = _arg1.arena.content.stageMC.globalToLocal(playerContent.localToGlobal(new Point((playerContent.podEnd.x + _arg3), playerContent.podEnd.y)));
x = (_local13.x + _arg3);
y = _local13.y;
scale = 0.8;
TweenMax.to(this, 0.2, {x:_arg5, y:this.y, ease:Linear.easeNone, onComplete:laserTweenComplete});
animation = new MovieClipAnimation(this.display, MovieClipUtil.getAnimationData(this.display), _arg7);
animation.playLabel("laser");
scaleX = scale;
scaleY = scale;
break;
case 3:
animation = new MovieClipAnimation(this.display.anim, MovieClipUtil.getAnimationData(this.display.anim), _arg7);
animation.playLabel("flame", false, flamerComplete);
playerContent = _arg1.container;
_local14 = Math.abs((_arg3 - _arg5));
flameScale = (_local14 / 290);
flameScale = Math.max(0.7, flameScale);
scaleX = flameScale;
if ((_arg3 > _arg5)){
scaleY = (-(scaleX) / 1.2);
} else {
scaleY = (scaleX / 1.2);
};
break;
};
this.type = _arg8;
}
public function destroy():void{
TweenMax.killAll();
}
public function render(_arg1:Number):void{
var _local2:Point;
var _local3:Point;
var _local4:Number;
animation.render(_arg1);
if (type == 3){
_local2 = callingPlayer.arena.content.stageMC.globalToLocal(playerContent.localToGlobal(new Point(playerContent.flamerOrigin1.x, playerContent.flamerOrigin1.y)));
_local3 = callingPlayer.arena.content.stageMC.globalToLocal(playerContent.localToGlobal(new Point(playerContent.flamerOrigin0.x, playerContent.flamerOrigin0.y)));
x = _local2.x;
y = _local2.y;
_local4 = (Math.atan2((_local2.y - _local3.y), (_local2.x - _local3.x)) / (Math.PI / 180));
rotation = _local4;
};
}
public function missileDead(_arg1:Animation):void{
isAlive = false;
}
public function flamerComplete(_arg1:Animation):void{
isAlive = false;
}
public function laserTweenComplete():void{
isAlive = false;
}
public function missileTweenComplete():void{
rotation = 0;
callingPlayer.enemy.animation.playLabel("damage", false);
animation.playLabel("explosion", false, missileDead);
}
}
}//package net.odd1.chromeWars2.projectiles
Section 159
//ProjectilesClass (net.odd1.chromeWars2.projectiles.ProjectilesClass)
package net.odd1.chromeWars2.projectiles {
import net.odd1.minig.managers.*;
import net.odd1.chromeWars2.characters.*;
import flash.display.*;
import net.odd1.chromeWars2.global.*;
public class ProjectilesClass extends MovieClip {
public var assets:MovieClip;
public var projectiles:Array;
public var missilesOnStage:Boolean;
public var lastPlayer:Robot;
public var laserOnStage:Boolean;
public function ProjectilesClass(){
missilesOnStage = false;
RessourceManager.getInstance().loadSWF(Ressources.PROJECTILES_CLASS, Ressources.PROJECTILES_PATH, assetsLoaded);
projectiles = new Array();
}
public function fire_laser(_arg1:Robot, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:Class = (assets.loaderInfo.applicationDomain.getDefinition("laser") as Class);
var _local7:int = assets.loaderInfo.frameRate;
var _local8:Projectile = new Projectile(_arg1, new (_local6), _arg2, _arg3, _arg4, _arg5, _local7, 2);
addChild(_local8);
projectiles.push(_local8);
laserOnStage = true;
lastPlayer = _arg1;
}
public function assetsLoaded(_arg1:MovieClip):void{
assets = _arg1;
}
public function create_flame(_arg1:Robot, _arg2:Number, _arg3:Number):void{
var _local4:Class = (assets.loaderInfo.applicationDomain.getDefinition("flame") as Class);
var _local5:int = assets.loaderInfo.frameRate;
var _local6:Projectile = new Projectile(_arg1, new (_local4), _arg2, 0, _arg3, 0, _local5, 3);
addChild(_local6);
projectiles.push(_local6);
lastPlayer = _arg1;
}
public function render(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:Projectile;
var _local5:Array;
_local5 = new Array();
_local3 = projectiles.length;
_local2 = 0;
while (_local2 < _local3) {
_local4 = projectiles[_local2];
if (!_local4.isAlive){
_local4.destroy();
removeChild(_local4);
_local5.push(_local4);
} else {
_local4.render(_arg1);
};
_local2++;
};
_local3 = _local5.length;
_local2 = 0;
while (_local2 < _local3) {
projectiles.splice(projectiles.indexOf(_local5[_local2]), 1);
_local2++;
};
if (((laserOnStage) && ((projectiles.length == 0)))){
lastPlayer.laserAllHit_completeHandler();
laserOnStage = false;
};
if (((missilesOnStage) && ((projectiles.length == 0)))){
lastPlayer.rocketAllHit_completeHandler();
missilesOnStage = false;
};
}
public function fire_missile(_arg1:Robot, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:Class = (assets.loaderInfo.applicationDomain.getDefinition("missile") as Class);
var _local7:int = assets.loaderInfo.frameRate;
var _local8:Projectile = new Projectile(_arg1, new (_local6), _arg2, _arg3, _arg4, _arg5, _local7, 1);
addChild(_local8);
projectiles.push(_local8);
missilesOnStage = true;
lastPlayer = _arg1;
}
}
}//package net.odd1.chromeWars2.projectiles
Section 160
//Arena (net.odd1.chromeWars2.screens.Arena)
package net.odd1.chromeWars2.screens {
import net.odd1.minig.managers.*;
import net.odd1.chromeWars2.characters.*;
import flash.display.*;
import net.odd1.minig.animations.*;
import flash.events.*;
import gs.*;
import net.odd1.chromeWars2.AI.*;
import net.odd1.chromeWars2.global.*;
import net.odd1.minig.screens.*;
import gs.easing.*;
import net.odd1.chromeWars2.projectiles.*;
import net.odd1.minig.global.*;
import net.odd1.minig.utils.*;
import net.odd1.chromeWars2.utils.*;
import flash.net.*;
import net.odd1.minig.events.*;
import net.odd1.minig.transitions.*;
public final class Arena extends Screen implements IScreen {
private const TRANSITION_TIME:Number = 1;
public var projectilesHolder:ProjectilesClass;
private var enemy:Robot;
public var ref:MovieClipAnimation;
public var forwardMin:Number;
public var forwardPixels:Number;
public var attackRange:Number;
private var player:Robot;
public var hud:MovieClip;
private var turn:int;
public function localiseButton():void{
hud.btn_games.loc.gotoAndStop(JaludoUtil.Goto);
}
public function killGames():void{
hud.btn_games.removeEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
hud.btn_games.removeEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
hud.btn_games.removeEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
hud.btn_kiba.removeEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
hud.btn_kiba.removeEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
hud.btn_kiba.removeEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
}
public function updateHud():void{
var _local1:String;
_local1 = player.hp.toString();
if (_local1 != hud.hud.hpPlayer.text){
hud.hud.hpPlayer.text = _local1;
};
hud.hud.playerHP.scaleX = (player.hp / player.hpTotal);
_local1 = enemy.hp.toString();
if (_local1 != hud.hud.hpEnemy.text){
hud.hud.hpEnemy.text = _local1;
};
hud.hud.enemyHP.scaleX = (enemy.hp / enemy.hpTotal);
}
public function initMenu():void{
var _local1:Number;
hud.enableClose = false;
hud.enableCharge = false;
hud.enableRange = false;
_local1 = Math.abs((player.x - enemy.x));
if (_local1 < attackRange){
hud.enableClose = true;
};
if ((((_local1 > attackRange)) && ((_local1 < ((forwardMin + (player.speed * forwardPixels)) + attackRange))))){
hud.enableCharge = true;
};
if (player.specialMaxRange > 0){
if ((((_local1 > player.specialMinRange)) && ((_local1 < ((forwardMin + (player.speed * forwardPixels)) + player.specialMaxRange))))){
hud.enableRange = true;
} else {
hud.enableRange = false;
};
};
if ((((((player.scaleX < 0)) && ((hud.hud.options.scaleX > 0)))) || ((((player.scaleX > 0)) && ((hud.hud.options.scaleX < 0)))))){
hud.hud.options.scaleX = (hud.hud.options.scaleX * -1);
hud.hud.options.btnMove.scaleX = (hud.hud.options.btnMove.scaleX * -1);
hud.hud.options.btnAttack.scaleX = (hud.hud.options.btnAttack.scaleX * -1);
hud.hud.options.btnStrategy.scaleX = (hud.hud.options.btnStrategy.scaleX * -1);
hud.hud.options.btnSpecial.scaleX = (hud.hud.options.btnSpecial.scaleX * -1);
hud.hud.options.action0.scaleX = (hud.hud.options.action0.scaleX * -1);
hud.hud.options.action1.scaleX = (hud.hud.options.action1.scaleX * -1);
hud.hud.options.action2.scaleX = (hud.hud.options.action2.scaleX * -1);
hud.hud.options.x = ((hud.hud.options.scaleX > 0)) ? 160 : (GlobalVariables.stageWidth - 160);
};
hud.showMenu(0);
hud_setItems();
}
public function init():void{
SoundManager.getInstance().playSong(Ressources.sound_musicFight);
switch (ChromeWars2.currentArena){
case 0:
loadSWF(Ressources.STAGE0_CLASS, Ressources.STAGE0_PATH, completeHandler);
break;
case 1:
loadSWF(Ressources.STAGE1_CLASS, Ressources.STAGE1_PATH, completeHandler);
break;
case 2:
loadSWF(Ressources.STAGE2_CLASS, Ressources.STAGE2_PATH, completeHandler);
break;
case 3:
loadSWF(Ressources.STAGE3_CLASS, Ressources.STAGE3_PATH, completeHandler);
break;
case 4:
loadSWF(Ressources.STAGE4_CLASS, Ressources.STAGE4_PATH, completeHandler);
break;
case 5:
loadSWF(Ressources.STAGE5_CLASS, Ressources.STAGE5_PATH, completeHandler);
break;
default:
loadSWF(Ressources.STAGE2_CLASS, Ressources.STAGE2_PATH, completeHandler);
break;
};
}
public function initGames():void{
hud.btn_kiba.visible = JaludoUtil.KIBA_VERSION;
localiseButton();
hud.btn_games.addEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
hud.btn_games.addEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
hud.btn_games.addEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
hud.btn_kiba.addEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
hud.btn_kiba.addEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
hud.btn_kiba.addEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
hud.btn_games.buttonMode = true;
hud.btn_games.useHandCursor = true;
hud.btn_kiba.buttonMode = true;
hud.btn_kiba.useHandCursor = true;
}
private function hud_completeHandler(_arg1:MovieClip):void{
isLoaded = true;
player = ChromeWars2.player;
player.x = content.stageMC.p1.x;
player.y = content.stageMC.p1.y;
player.scaleX = 0.4;
player.scaleY = 0.4;
player.inArena = true;
player.cacheAsBitmap = true;
player.animation.playLabel("idle", true, null, true);
content.stageMC.addChildAt(player, content.stageMC.getChildIndex(content.stageMC.p1));
enemy = ChromeWars2.enemy;
enemy.x = content.stageMC.p2.x;
enemy.y = content.stageMC.p2.y;
enemy.scaleX = -0.4;
enemy.scaleY = 0.4;
enemy.inArena = true;
enemy.cacheAsBitmap = true;
enemy.animation.playLabel("idle", true, null, true);
content.stageMC.addChildAt(enemy, content.stageMC.getChildIndex(content.stageMC.p2));
projectilesHolder = new ProjectilesClass();
content.stageMC.addChild(projectilesHolder);
hud = _arg1;
addChild(hud);
hud.showMenu(0);
player.setEnemy(enemy);
enemy.setEnemy(player);
player.setArena(this);
enemy.setArena(this);
turn = 0;
player.endTurn = false;
enemy.endTurn = false;
hud.hud.hud.player.text = player.fullName;
hud.hud.hud.enemy.text = enemy.fullName;
hud.hud.hpPlayerTotal.text = (" / " + player.hpTotal);
hud.hud.hpEnemyTotal.text = (" / " + enemy.hpTotal);
hud.P2_specialCount = enemy.remainingSpecial;
hud.P2_repairCount = enemy.repairLeft;
hud.P2_nitroCount = enemy.nitroLeft;
hud.P2_shieldCount = enemy.shieldLeft;
hud.setCounters("P2", hud.P2_repairCount, hud.P2_nitroCount, hud.P2_shieldCount, hud.P2_specialCount);
hud.P1_specialCount = player.remainingSpecial;
hud.P1_repairCount = player.repairLeft;
hud.P1_nitroCount = player.nitroLeft;
hud.P1_shieldCount = player.shieldLeft;
hud.setCounters("P1", hud.P1_repairCount, hud.P1_nitroCount, hud.P1_shieldCount, hud.P1_specialCount);
hud.enableP1Special = -1;
hud.enableP2Special = -1;
player.usedNitro = 0;
player.usedRepair = 0;
player.usedShield = 0;
enemy.usedRepair = 0;
player.nitroBonus = 0;
player.shieldBonus = 0;
switch (player.specials){
case 0:
hud.enableP1Special = -1;
break;
case 1:
case 4:
hud.enableP1Special = 0;
break;
case 2:
case 5:
hud.enableP1Special = 1;
break;
case 3:
case 6:
hud.enableP1Special = 2;
break;
};
switch (enemy.specials){
case 0:
hud.enableP2Special = -1;
break;
case 1:
case 4:
hud.enableP2Special = 0;
break;
case 2:
case 5:
hud.enableP2Special = 1;
break;
case 3:
case 6:
hud.enableP2Special = 2;
break;
};
var _local2:Array = [int(((((player.preciseHits + (0.02 * player.precision)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility)) * 100)), int((player.preciseDamage * player.minDamage)), int((player.preciseDamage * player.maxDamage)), int(((((player.bruteHits + (0.02 * player.precision)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility)) * 100)), int((player.bruteDamage * player.minDamage)), int((player.bruteDamage * player.maxDamage)), int(((((player.chargeHits + (0.02 * player.precision)) - (0.02 * enemy.defense)) - (0.01 * enemy.agility)) * 100)), int(((player.chargeDamage * player.minDamage) + (player.speed * 5))), int(((player.chargeDamage * player.maxDamage) + (player.speed * 5))), 100, int((player.preciseDamage * player.specialMinDamage)), int((player.preciseDamage * player.specialMaxDamage))];
hud.toolTipStats(_local2);
hud_setItems();
hud.insertData();
_local2 = null;
hud.marqueeBox.colors.gotoAndStop(ChromeWars2.currentArena);
initPlayMoreGamesButton();
initGames();
}
public function reload():void{
}
public function render(_arg1:Number):void{
player.render(_arg1);
enemy.render(_arg1);
ref.render(_arg1);
projectilesHolder.render(_arg1);
if ((((turn == 0)) && (hud.messageDone))){
if (player.endTurn){
switchTurn();
} else {
if (!player.isPerformingAction){
if (hud.hud.options.alpha == 0){
initMenu();
};
checkInput();
};
};
} else {
if ((((turn == 1)) && (hud.messageDone))){
if (enemy.endTurn){
switchTurn();
} else {
if (!enemy.isPerformingAction){
enemy.rollAI();
};
};
};
};
updateCamera();
updateHud();
}
public function checkInput():void{
switch (hud.selectedAction){
case "btnForward":
player.performAction(Robot.ACTION_MOVE_RIGHT);
break;
case "btnBackwards":
player.performAction(Robot.ACTION_MOVE_LEFT);
break;
case "btnWait":
player.performAction(Robot.ACTION_WAIT);
break;
case "btnAttack0":
player.performAction(Robot.ACTION_ATTACK);
break;
case "btnAttack1":
player.performAction(Robot.ACTION_BRUTE);
break;
case "btnCharge":
player.performAction(Robot.ACTION_CHARGE);
break;
case "btnRepair":
player.performAction(Robot.ACTION_REPAIR);
break;
case "btnTaunt":
player.performAction(Robot.ACTION_TAUNT);
break;
case "btnNitro":
player.performAction(Robot.ACTION_NITRO);
break;
case "btnFlamer":
player.performAction(Robot.ACTION_FLAME);
break;
case "btnLaser":
player.performAction(Robot.ACTION_LASER);
break;
case "btnRocket":
player.performAction(Robot.ACTION_ROCKET);
break;
case "btnShield":
player.performAction(Robot.ACTION_SHIELD);
break;
};
}
private function btnGamesOver_Handler(_arg1:MouseEvent):void{
hud.btn_games.gotoAndStop("on");
localiseButton();
}
public function mouseUp():void{
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
}
private function btnGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.BETWEEN_LEVELS);
}
private function btnGamesOut_Handler(_arg1:MouseEvent):void{
hud.btn_games.gotoAndStop("off");
localiseButton();
}
private function btnPlayMoreGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.BETWEEN_LEVELS);
}
private function AI_completeHandler(_arg1:XML):void{
AI.getInstance().setXml(_arg1);
RessourceManager.getInstance().loadSWF(Ressources.HUD_CLASS, Ressources.HUD_PATH, hud_completeHandler);
}
public function setGameData():void{
var _local1:XMLList;
_local1 = GlobalVariables.data.game;
forwardPixels = Number(_local1.@forwardPixels);
forwardMin = Number(_local1.@forwardMin);
attackRange = Number(_local1.@attackRange);
}
private function initPlayMoreGamesButton():void{
ButtonManager.getInstance().addButton(hud.btnPlayMoreGames, btnPlayMoreGamesClick_Handler);
}
public function hud_setItems():void{
if (player.usedNitro >= Robot.NITRO_USEMAX){
hud.enableItemNitro = false;
} else {
if (player.nitroLeft == 0){
hud.enableItemNitro = false;
} else {
hud.enableItemNitro = true;
};
};
if (player.usedShield >= Robot.SHIELD_USEMAX){
hud.enableItemShield = false;
} else {
if (player.shieldLeft == 0){
hud.enableItemShield = false;
} else {
hud.enableItemShield = true;
};
};
if (player.usedRepair >= Robot.REPAIR_USEMAX){
hud.enableItemRepair = false;
} else {
if (player.repairLeft == 0){
hud.enableItemRepair = false;
} else {
hud.enableItemRepair = true;
};
};
if (Robot.ITEM_USEONLYONE){
hud.enableItems = true;
if ((((((player.usedRepair > 0)) || ((player.usedNitro > 0)))) || ((player.usedShield > 0)))){
hud.enableItems = false;
};
} else {
if (((((hud.enableItemRepair) || (hud.enableItemShield))) || (hud.enableItemNitro))){
hud.enableItems = true;
} else {
hud.enableItems = false;
};
};
hud.updateActions();
}
public function updateCamera():void{
var _local1:Number;
var _local2:Boolean;
_local2 = (player.x < enemy.x);
_local1 = (player.x - (_local2) ? 160 : (GlobalVariables.stageWidth - 160));
TweenLite.to(content.stageMC, 0.75, {x:-(_local1), ease:Linear.easeNone});
}
public function switchTurn():void{
if (enemy.hp <= 0){
player.animation.playLabel("victory", false, gameOver_completeHandler);
if (player.x < enemy.x){
ref.playLabel("left", false);
} else {
ref.playLabel("right", false);
};
turn = -1;
Tournament.won = true;
} else {
if (player.hp <= 0){
enemy.animation.playLabel("victory", false, gameOver_completeHandler);
if (player.x < enemy.x){
ref.playLabel("right", false);
} else {
ref.playLabel("left", false);
};
turn = -1;
Tournament.won = false;
} else {
turn = ((turn + 1) % 2);
player.endTurn = false;
enemy.endTurn = false;
player.usedNitro = 0;
player.usedRepair = 0;
player.usedShield = 0;
enemy.usedRepair = 0;
if (turn == 0){
player.nitroBonus = 0;
player.shieldBonus = 0;
};
player.update_armor();
if ((((((player.scaleX < 0)) && ((player.x < enemy.x)))) || ((((player.scaleX > 0)) && ((player.x > enemy.x)))))){
player.scaleX = (player.scaleX * -1);
enemy.scaleX = (enemy.scaleX * -1);
};
player.animation.playLabel("idle");
enemy.animation.playLabel("idle");
};
};
}
private function completeHandler():void{
isLoaded = false;
ref = new MovieClipAnimation(content.stageMC.ref, MovieClipUtil.getAnimationData(content.stageMC.ref), content.loaderInfo.frameRate, false);
setGameData();
RessourceManager.getInstance().loadXML(Ressources.AI_XML_CLASS, Ressources.AI_XML_PATH, AI_completeHandler);
}
private function btnKibaClick_Handler(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://www.kibagames.com");
navigateToURL(_local2);
}
private function btnKibaOut_Handler(_arg1:MouseEvent):void{
hud.btn_kiba.gotoAndStop("off");
}
public function displayMessage(_arg1:String):void{
hud.marqueeMessage = _arg1;
hud.showMarquee();
}
public function mouseDown():void{
}
private function btnKibaOver_Handler(_arg1:MouseEvent):void{
hud.btn_kiba.gotoAndStop("on");
}
public function updateRepairCount(_arg1:Robot):void{
var _local2:int;
if (_arg1 != ChromeWars2.player){
};
}
public function destroy():void{
killGames();
content.stageMC.removeChild(player);
player.arena = null;
player = null;
content.stageMC.removeChild(enemy);
enemy.arena = null;
enemy = null;
hud.destroy();
removeChild(hud);
hud = null;
ref.destroy();
ref = null;
content.stageMC.removeChild(projectilesHolder);
projectilesHolder = null;
ButtonManager.getInstance().clear();
TweenMax.killAll();
}
public function deactivate():void{
}
public function gameOver_completeHandler(_arg1:Animation):void{
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, new Tournament(), new Fadeout(1)));
}
}
}//package net.odd1.chromeWars2.screens
Section 161
//BotShop (net.odd1.chromeWars2.screens.BotShop)
package net.odd1.chromeWars2.screens {
import net.odd1.minig.managers.*;
import net.odd1.chromeWars2.characters.*;
import flash.events.*;
import gs.*;
import net.odd1.chromeWars2.global.*;
import net.odd1.minig.screens.*;
import gs.plugins.*;
import net.odd1.minig.global.*;
import net.odd1.chromeWars2.utils.*;
import net.odd1.minig.events.*;
import net.odd1.minig.transitions.*;
public final class BotShop extends Screen implements IScreen {
private const TRANSITION_TIME:Number = 1;
private var cost:int;
private var sellGold:int;
private var statsFilled:Boolean;
private var robot:Robot;
public function ownsPart(_arg1:String, _arg2:int):Boolean{
var _local3:XML;
var _local4:XML;
_local3 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
for each (_local4 in _local3[_arg1].attributes()) {
if (_arg2 == int(_local4.toString())){
return (true);
};
};
return (false);
}
private function sellNo(_arg1:MouseEvent):void{
content.popUp.visible = false;
content.clickBlockerState(1);
}
private function initPlayMoreGamesButton():void{
ButtonManager.getInstance().addButton(content.btnPlayMoreGames, btnPlayMoreGamesClick_Handler);
}
private function buy_clickHandler(_arg1:MouseEvent):void{
var _local2:Boolean;
var _local3:int;
var _local4:XML;
content.clickBlockerState(0);
if (content.selectedPartName == "powers"){
_local2 = false;
switch (int(content.currentPart)){
case 0:
_local3 = robot.repairLeft;
break;
case 1:
_local3 = robot.nitroLeft;
break;
case 2:
_local3 = robot.shieldLeft;
break;
};
if (_local3 >= 9){
return;
};
} else {
_local2 = ownsPart(content.selectedPartName, content.currentPart);
};
if (((_local2) || ((cost <= robot.gold)))){
switch (content.selectedPartName){
case "torso":
robot.changeBody(int(content.currentPart));
break;
case "head":
robot.changeHead(int(content.currentPart));
break;
case "shoulder":
robot.changeShoulder(int(content.currentPart));
break;
case "legs":
robot.changeLegs(int(content.currentPart));
break;
case "weapon":
robot.changeWeapon(int(content.currentPart));
break;
case "specials":
robot.changeSpecial(int(content.currentPart));
break;
};
if (_local2){
content.equipPart();
} else {
robot.gold = (robot.gold - cost);
content.setUpHUD("regular", robot.gold.toString(), "LOBBY", "");
_local4 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
if (content.selectedPartName == "powers"){
updateBonus(int(content.currentPart));
} else {
_local4[content.selectedPartName].@[(content.selectedPartName + _local4[content.selectedPartName].attributes().length())] = content.currentPart.toString();
};
if (content.selectedPartName != "powers"){
content.buyInfo_thanks();
} else {
content.equipPart();
};
};
robot.updateColors(robot.color1, robot.color2);
} else {
content.buyInfo_sorry();
};
}
public function init():void{
loadSWF(Ressources.BOTSHOP_CLASS, Ressources.BOTSHOP_PATH, completeHandler);
}
private function completeHandler():void{
robot = ChromeWars2.player;
robot.x = content.origin.x;
robot.y = content.origin.y;
robot.scaleX = 0.51;
robot.scaleY = 0.51;
robot.inArena = false;
robot.animation.playLabel("idle", true, null, true);
ButtonManager.getInstance().addButton(content.HUD.label_btn1, lobby_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.gridInfo.btnBuy, buy_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.gridInfo.btnSell, sell_clickHandler, Ressources.sound_button0);
content.addChildAt(robot, content.getChildIndex(content.origin));
statsFilled = false;
content.setUpHUD("regular", robot.gold.toString(), "LOBBY", "");
SoundPlayer.getInstance().setSoundIcons(content.miniHUD);
Utils.setPlayerStats(content);
ButtonManager.getInstance().addButton(content.miniHUD.btnSounds, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.miniHUD.btnMusic, null, Ressources.sound_button0);
var _local1:int;
while (_local1 <= 3) {
ButtonManager.getInstance().addButton(content.statsPanel.grid_powers[(("mOver" + ((_local1 > 9)) ? "" : "0") + _local1)], null, Ressources.sound_button0);
_local1++;
};
var _local2:int;
while (_local2 <= 4) {
ButtonManager.getInstance().addButton(content.statsPanel.grid_specials[(("mOver" + ((_local2 > 9)) ? "" : "0") + _local2)], null, Ressources.sound_button0);
_local2++;
};
var _local3:int;
while (_local3 <= 14) {
ButtonManager.getInstance().addButton(content.statsPanel.grid_head[(("mOver" + ((_local3 > 9)) ? "" : "0") + _local3)], null, Ressources.sound_button0);
_local3++;
};
_local3 = 0;
while (_local3 <= 14) {
ButtonManager.getInstance().addButton(content.statsPanel.grid_torso[(("mOver" + ((_local3 > 9)) ? "" : "0") + _local3)], null, Ressources.sound_button0);
_local3++;
};
_local3 = 0;
while (_local3 <= 14) {
ButtonManager.getInstance().addButton(content.statsPanel.grid_shoulder[(("mOver" + ((_local3 > 9)) ? "" : "0") + _local3)], null, Ressources.sound_button0);
_local3++;
};
_local3 = 0;
while (_local3 <= 14) {
ButtonManager.getInstance().addButton(content.statsPanel.grid_weapon[(("mOver" + ((_local3 > 9)) ? "" : "0") + _local3)], null, Ressources.sound_button0);
_local3++;
};
_local3 = 0;
while (_local3 <= 14) {
ButtonManager.getInstance().addButton(content.statsPanel.grid_legs[(("mOver" + ((_local3 > 9)) ? "" : "0") + _local3)], null, Ressources.sound_button0);
_local3++;
};
ButtonManager.getInstance().addButton(content.statsPanel.robotChart.btnHead, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.robotChart.btnShoulder, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.robotChart.btnWeapon, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.robotChart.btnTorso, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.robotChart.btnLegs, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.robotChart.btnMisc, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.robotChart.btnPower, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.gridInfo.btnBack, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.returnChart, null, Ressources.sound_button0);
content.popUp.visible = false;
ButtonManager.getInstance().addButton(content.popUp.btnYES, sellYes, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.popUp.btnNO, sellNo, Ressources.sound_button0);
initPlayMoreGamesButton();
}
public function updateBonus(_arg1:int):void{
switch (_arg1){
case 0:
robot.repairLeft++;
break;
case 1:
robot.nitroLeft++;
break;
case 2:
robot.shieldLeft++;
break;
};
}
public function reload():void{
}
public function mouseUp():void{
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
}
public function render(_arg1:Number):void{
robot.render(_arg1);
if (content.updateItemStatus){
updatePartsStatus();
};
if (content.shopBuy){
updatePartInfo();
};
if (((!(content.shopBuy)) && (statsFilled))){
statsFilled = false;
};
}
public function mouseDown():void{
}
public function updatePartsStatus():void{
var _local1:int;
var _local2:int;
var _local3:XML;
var _local4:String;
var _local5:XML;
var _local6:int;
var _local7:XML;
_local3 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
_local2 = 15;
_local4 = content.selectedPartName;
switch (content.selectedPartName){
case "torso":
_local4 = "body";
break;
case "weapon":
break;
case "specials":
_local2 = 5;
break;
case "powers":
_local2 = 3;
content.statsPanel[("grid_" + content.selectedPartName)].repairCount.text = String((robot.repairLeft + "/5"));
content.statsPanel[("grid_" + content.selectedPartName)].nitroCount.text = String((robot.nitroLeft + "/5"));
content.statsPanel[("grid_" + content.selectedPartName)].shieldCount.text = String((robot.shieldLeft + "/5"));
break;
};
_local1 = 0;
while (_local1 < _local2) {
if (content.selectedPartName == "specials"){
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].gotoAndStop("locked");
content.statsPanel[("grid_" + content.selectedPartName)][(("mOver" + ((_local1 < 10)) ? "0" : "") + _local1)].removeEventListener(MouseEvent.CLICK, content.infoPart);
} else {
if (content.selectedPartName == "powers"){
switch (_local1){
case 0:
if (robot.repairLeft >= 5){
content.statsPanel[("grid_" + content.selectedPartName)][(("mOver" + ((_local1 < 10)) ? "0" : "") + _local1)].removeEventListener(MouseEvent.CLICK, content.infoPart);
TweenMax.to(content.statsPanel[("grid_" + content.selectedPartName)][(("icon" + ((_local1 < 10)) ? "0" : "") + _local1)], 0, {colorMatrixFilter:{brightness:0.05}});
};
break;
case 1:
if (robot.nitroLeft >= 5){
content.statsPanel[("grid_" + content.selectedPartName)][(("mOver" + ((_local1 < 10)) ? "0" : "") + _local1)].removeEventListener(MouseEvent.CLICK, content.infoPart);
TweenMax.to(content.statsPanel[("grid_" + content.selectedPartName)][(("icon" + ((_local1 < 10)) ? "0" : "") + _local1)], 0, {colorMatrixFilter:{brightness:0.05}});
};
break;
case 2:
if (robot.shieldLeft >= 5){
content.statsPanel[("grid_" + content.selectedPartName)][(("mOver" + ((_local1 < 10)) ? "0" : "") + _local1)].removeEventListener(MouseEvent.CLICK, content.infoPart);
TweenMax.to(content.statsPanel[("grid_" + content.selectedPartName)][(("icon" + ((_local1 < 10)) ? "0" : "") + _local1)], 0, {colorMatrixFilter:{brightness:0.05}});
};
break;
};
} else {
TweenMax.to(content.statsPanel[("grid_" + content.selectedPartName)][(("icon" + ((_local1 < 10)) ? "0" : "") + _local1)], 0, {colorMatrixFilter:{brightness:0.05}});
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].gotoAndStop("avail");
};
};
_local1++;
};
_local1 = 0;
while (_local1 < _local2) {
switch (content.selectedPartName){
case "torso":
_local5 = GlobalVariables.data.game.armors.chests.chest[int(_local1)];
break;
case "head":
_local5 = GlobalVariables.data.game.armors.heads.head[int(_local1)];
break;
case "shoulder":
_local5 = GlobalVariables.data.game.armors.shoulders.shoulder[int(_local1)];
break;
case "legs":
_local5 = GlobalVariables.data.game.armors.legs.leg[int(_local1)];
break;
case "weapon":
_local5 = GlobalVariables.data.game.weapons.weapon[int(_local1)];
break;
case "specials":
_local5 = GlobalVariables.data.game.specials.special[(int(_local1) + 1)];
break;
case "powers":
_local5 = GlobalVariables.data.game.items.item[int(_local1)];
break;
};
_local6 = _local5.@cost;
if (_local6 > ChromeWars2.player.gold){
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].affordable.gotoAndStop("off");
} else {
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].affordable.gotoAndStop("on");
};
if (content.selectedPartName != "specials"){
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].affordable.visible = true;
} else {
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].affordable.visible = false;
};
_local1++;
};
for each (_local7 in _local3[content.selectedPartName].attributes()) {
_local1 = int(_local7.toString());
if (content.selectedPartName == "specials"){
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].gotoAndStop(((_local1 == (ChromeWars2.player[_local4] - 1))) ? "equipped" : "avail");
content.statsPanel[("grid_" + content.selectedPartName)][(("mOver" + ((_local1 < 10)) ? "0" : "") + _local1)].addEventListener(MouseEvent.CLICK, content.infoPart);
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].affordable.visible = false;
} else {
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].gotoAndStop(((_local1 == ChromeWars2.player[_local4])) ? "equipped" : "avail");
content.statsPanel[("grid_" + content.selectedPartName)][(("status" + ((_local1 < 10)) ? "0" : "") + _local1)].affordable.visible = false;
TweenMax.to(content.statsPanel[("grid_" + content.selectedPartName)][(("icon" + ((_local1 < 10)) ? "0" : "") + _local1)], 0, {colorMatrixFilter:{brightness:1}});
};
};
content.updateItemStatus = false;
}
public function updatePartInfo():void{
var _local1:XML;
var _local2:XML;
var _local3:String;
content.statsPanel.gridInfo.btnBuy.btnTxt.text = (ownsPart(content.selectedPartName, content.currentPart)) ? "EQUIP" : "BUY";
content.statsPanel.gridInfo.btnSell.btnTxt.text = "SELL";
content.statsPanel.gridInfo.btnSell.visible = (ownsPart(content.selectedPartName, content.currentPart)) ? true : false;
if (content.currentPart == 0){
content.statsPanel.gridInfo.btnSell.visible = false;
};
switch (content.selectedPartName){
case "torso":
_local2 = LocaleManager.getInstance().xml.chests.chest[int(content.currentPart)];
_local1 = GlobalVariables.data.game.armors.chests.chest[int(content.currentPart)];
break;
case "head":
_local2 = LocaleManager.getInstance().xml.heads.head[int(content.currentPart)];
_local1 = GlobalVariables.data.game.armors.heads.head[int(content.currentPart)];
break;
case "shoulder":
_local2 = LocaleManager.getInstance().xml.shoulders.shoulder[int(content.currentPart)];
_local1 = GlobalVariables.data.game.armors.shoulders.shoulder[int(content.currentPart)];
break;
case "legs":
_local2 = LocaleManager.getInstance().xml.legs.leg[int(content.currentPart)];
_local1 = GlobalVariables.data.game.armors.legs.leg[int(content.currentPart)];
break;
case "weapon":
_local2 = LocaleManager.getInstance().xml.weapons.weapon[int(content.currentPart)];
_local1 = GlobalVariables.data.game.weapons.weapon[int(content.currentPart)];
break;
case "specials":
_local2 = LocaleManager.getInstance().xml.specials.special[(int(content.currentPart) + 1)];
_local1 = GlobalVariables.data.game.specials.special[(int(content.currentPart) + 1)];
content.statsPanel.gridInfo.btnSell.visible = false;
break;
case "powers":
_local2 = LocaleManager.getInstance().xml.items.item[int(content.currentPart)];
_local1 = GlobalVariables.data.game.items.item[int(content.currentPart)];
content.statsPanel.gridInfo.btnSell.visible = false;
break;
};
_local3 = _local1.@stats;
while (_local3.search(", ") != -1) {
_local3 = _local3.replace(", ", "\n");
};
content.statsPanel.gridInfo.part_name.text = _local2.@name;
content.statsPanel.gridInfo.part_desc.text = _local2.@description;
content.statsPanel.gridInfo.part_stats.text = _local3;
content.statsPanel.gridInfo.part_price.text = _local1.@cost;
cost = _local1.@cost;
statsFilled = false;
content.clickBlockerState(1);
content.shopBuy = false;
}
private function lobby_clickHandler(_arg1:MouseEvent):void{
var _local2:XML;
_local2 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
_local2.@body = robot.body;
_local2.@shoulder = robot.shoulder;
_local2.@head = robot.head;
_local2.@weapon = robot.weapon;
_local2.@legs = robot.legs;
_local2.@credits = robot.gold;
_local2.@specials = (robot.specials - 1);
_local2.@repair = robot.repairLeft;
_local2.@nitro = robot.nitroLeft;
_local2.@shield = robot.shieldLeft;
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new Lobby() as IScreen), new Fadeout(TRANSITION_TIME)));
}
public function deactivate():void{
}
private function sell_clickHandler(_arg1:MouseEvent):void{
var _local2:XML;
var _local3:XML;
content.clickBlockerState(0);
content.popUp.visible = true;
switch (content.selectedPartName){
case "torso":
_local3 = LocaleManager.getInstance().xml.chests.chest[int(content.currentPart)];
_local2 = GlobalVariables.data.game.armors.chests.chest[int(content.currentPart)];
break;
case "head":
_local3 = LocaleManager.getInstance().xml.heads.head[int(content.currentPart)];
_local2 = GlobalVariables.data.game.armors.heads.head[int(content.currentPart)];
break;
case "shoulder":
_local3 = LocaleManager.getInstance().xml.shoulders.shoulder[int(content.currentPart)];
_local2 = GlobalVariables.data.game.armors.shoulders.shoulder[int(content.currentPart)];
break;
case "legs":
_local3 = LocaleManager.getInstance().xml.legs.leg[int(content.currentPart)];
_local2 = GlobalVariables.data.game.armors.legs.leg[int(content.currentPart)];
break;
case "weapon":
_local3 = LocaleManager.getInstance().xml.weapons.weapon[int(content.currentPart)];
_local2 = GlobalVariables.data.game.weapons.weapon[int(content.currentPart)];
break;
case "specials":
_local3 = LocaleManager.getInstance().xml.specials.special[(int(content.currentPart) + 1)];
_local2 = GlobalVariables.data.game.specials.special[(int(content.currentPart) + 1)];
break;
case "powers":
_local3 = LocaleManager.getInstance().xml.items.item[int(content.currentPart)];
_local2 = GlobalVariables.data.game.items.item[int(content.currentPart)];
break;
};
sellGold = Math.round((int(_local2.@cost) / 2));
content.popUp.popUpText.text = (((("SELL " + _local3.@name) + " FOR ") + sellGold) + " CREDITS?").toUpperCase();
}
public function destroy():void{
content.removeChild(robot);
robot = null;
ButtonManager.getInstance().clear();
TweenMax.killAll();
}
private function sellYes(_arg1:MouseEvent):void{
var _local3:XML;
var _local4:XMLList;
var _local5:int;
content.popUp.visible = false;
var _local2:XML = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
var _local6:int;
var _local7:int;
_local4 = _local2[content.selectedPartName].attributes();
for each (_local3 in _local4) {
if (int(_local3.toXMLString()) == int(content.currentPart)){
_local7 = _local6;
};
_local6++;
};
switch (content.selectedPartName){
case "torso":
if (robot.body == int(content.currentPart)){
robot.changeBody(0);
};
break;
case "head":
if (robot.head == int(content.currentPart)){
robot.changeHead(0);
};
break;
case "shoulder":
if (robot.shoulder == int(content.currentPart)){
robot.changeShoulder(0);
};
break;
case "legs":
if (robot.legs == int(content.currentPart)){
robot.changeLegs(0);
};
break;
case "weapon":
if (robot.weapon == int(content.currentPart)){
robot.changeWeapon(0);
};
break;
};
delete _local4[_local7];
robot.gold = (robot.gold + sellGold);
content.equipPart();
content.HUD.label_btn0.btnTxt.text = robot.gold.toString();
}
private function btnPlayMoreGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.SHOP);
}
}
}//package net.odd1.chromeWars2.screens
Section 162
//ChooseRobot (net.odd1.chromeWars2.screens.ChooseRobot)
package net.odd1.chromeWars2.screens {
import net.odd1.minig.managers.*;
import net.odd1.chromeWars2.characters.*;
import flash.display.*;
import flash.events.*;
import gs.*;
import net.odd1.chromeWars2.global.*;
import net.odd1.minig.screens.*;
import net.odd1.minig.global.*;
import net.odd1.minig.events.*;
import net.odd1.minig.transitions.*;
public final class ChooseRobot extends Screen implements IScreen {
private const TRANSITION_TIME:Number = 1;
private var enemiesColor:Sprite;
private var color2:int;
private var colorBitmap:BitmapData;
private var robot:Robot;
private var pickingColor2:Boolean;
private var color1:int;
private var pickingColor1:Boolean;
public function destroy():void{
content.removeChild(robot);
ButtonManager.getInstance().clear();
robot = null;
colorBitmap.dispose();
colorBitmap = null;
content.robotNew.picker01.removeEventListener(MouseEvent.MOUSE_DOWN, color1_mouseDownHandler);
content.robotNew.picker02.removeEventListener(MouseEvent.MOUSE_DOWN, color2_mouseDownHandler);
TweenMax.killAll();
}
private function color2_mouseDownHandler(_arg1:MouseEvent):void{
pickingColor2 = true;
}
public function clearHistory(_arg1:XML):void{
var _local2:XML;
var _local3:XMLList;
var _local4:int;
var _local5:int;
for each (_local2 in _arg1.children()) {
_local3 = _local2.@*;
_local5 = (_local3.length() - 1);
while (_local5 >= 0) {
delete _local3[_local5];
_local5--;
};
if ((((_local4 > 0)) && ((_local4 < 6)))){
_local2.@["part0"] = 0;
};
_local4++;
};
}
public function displayRobot():void{
var _local1:XML;
_local1 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
if (_local1.@power == 0){
content.robotStats.visible = false;
content.robotNew.visible = true;
randomizeColor(_local1);
content.robotNew.stat_name.text = (((ChromeWars2.currentSave + 1) + ". ") + _local1.@name);
ChromeWars2.player.updateData(_local1);
} else {
ChromeWars2.player.updateData(_local1);
content.robotStats.visible = true;
content.robotNew.visible = false;
content.robotStats.stat_name.text = (((ChromeWars2.currentSave + 1) + ". ") + _local1.@name);
content.robotStats.stat_power.text = ChromeWars2.player.power;
content.robotStats.stat_agility.text = ChromeWars2.player.agility;
content.robotStats.stat_speed.text = ChromeWars2.player.speed;
content.robotStats.stat_precision.text = ChromeWars2.player.precision;
content.robotStats.stat_defense.text = ChromeWars2.player.defense;
content.robotStats.stat_grit.text = ChromeWars2.player.grit;
content.robotStats.stat_chrome.text = ChromeWars2.player.chrome;
content.robotStats.stat_damage.text = ((ChromeWars2.player.minDamage + " - ") + ChromeWars2.player.maxDamage);
content.robotStats.stat_armor.text = (int((ChromeWars2.player.armor * 100)) + "%");
content.robotStats.stat_critBonus.text = (ChromeWars2.player.agility + "%");
content.robotStats.stat_hitBonus.text = ((2 * ChromeWars2.player.precision) + "%");
content.robotStats.stat_hitChance.text = (("-" + ((2 * ChromeWars2.player.defense) + ChromeWars2.player.agility)) + "%");
content.robotStats.stat_gritChance.text = (("-" + ((2 * ChromeWars2.player.defense) + ChromeWars2.player.agility)) + "%");
content.robotStats.stat_wins.text = Utils.getRankString((51 - _local1.@level));
content.robotStats.stats_credits.text = ChromeWars2.player.gold;
};
ChromeWars2.currentLevel = _local1.@level;
if (ChromeWars2.currentLevel == 50){
content.retired.visible = true;
} else {
content.retired.visible = false;
};
}
private function mainMenu_clickHandler(_arg1:MouseEvent):void{
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new MainMenu() as IScreen), new Fadeout(TRANSITION_TIME)));
}
private function choose_clickHandler(_arg1:MouseEvent):void{
var _local2:XML;
_local2 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
ChromeWars2.currentLevel = _local2.@level;
ChromeWars2.currentArena = _local2.@stage;
if (ChromeWars2.currentLevel != 50){
if (_local2.@power == 0){
startRobot();
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new Stats() as IScreen), new Fadeout(TRANSITION_TIME)));
} else {
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new Lobby() as IScreen), new Fadeout(TRANSITION_TIME)));
};
};
}
public function init():void{
loadSWF(Ressources.CHOOSEROBOT_CLASS, Ressources.CHOOSEROBOT_PATH, completeHandler);
}
private function completeHandler():void{
var _local1:Shape = content.robotNew.colors.getChildAt(0);
colorBitmap = new BitmapData(_local1.width, _local1.height, true, 0);
colorBitmap.draw(_local1);
content.robotStats.visible = false;
content.robotNew.visible = false;
content.retired.visible = false;
pickingColor1 = false;
pickingColor2 = false;
displayRobot();
robot = ChromeWars2.player;
robot.x = content.origin.x;
robot.y = content.origin.y;
robot.scaleX = 0.5;
robot.scaleY = 0.5;
robot.inArena = false;
robot.animation.playLabel("idle", true, null, true);
content.addChildAt(robot, content.getChildIndex(content.origin));
ButtonManager.getInstance().addButton(content.HUD.label_btn0, mainMenu_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.HUD.label_btn1, choose_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.popUp.btnYES, delete_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.btnNext, btnNext_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.btnPrev, btnPrev_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.robotNew.btnRandomize, btnRandomize_clickHandler, Ressources.sound_button0);
content.robotNew.picker01.addEventListener(MouseEvent.MOUSE_DOWN, color1_mouseDownHandler);
content.robotNew.picker02.addEventListener(MouseEvent.MOUSE_DOWN, color2_mouseDownHandler);
GlobalVariables.stage.frameRate = 1000;
SoundPlayer.getInstance().setSoundIcons(content.miniHUD);
ButtonManager.getInstance().addButton(content.popUp.btnNO, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.miniHUD.btnSounds, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.miniHUD.btnMusic, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.HUD.label_btn2, null, Ressources.sound_button0);
}
private function btnPrev_clickHandler(_arg1:MouseEvent):void{
if (--ChromeWars2.currentSave < 0){
ChromeWars2.currentSave = 3;
};
displayRobot();
}
public function reload():void{
}
private function color1_mouseDownHandler(_arg1:MouseEvent):void{
pickingColor1 = true;
}
public function render(_arg1:Number):void{
var _local2:MovieClip;
robot.render(_arg1);
if (((pickingColor1) || (pickingColor2))){
_local2 = (pickingColor1) ? content.robotNew.picker01 : content.robotNew.picker02;
_local2.x = (mouseX - content.robotNew.x);
_local2.x = Math.max(_local2.x, content.robotNew.colors.x);
_local2.x = Math.min(_local2.x, ((content.robotNew.colors.x + content.robotNew.colors.width) - 1));
_local2.y = (mouseY - content.robotNew.y);
_local2.y = Math.max(_local2.y, content.robotNew.colors.y);
_local2.y = Math.min(_local2.y, ((content.robotNew.colors.y + content.robotNew.colors.height) - 1));
};
}
public function mouseUp():void{
if (((pickingColor1) || (pickingColor2))){
pickingColor1 = false;
pickingColor2 = false;
color1 = colorBitmap.getPixel((content.robotNew.picker01.x - content.robotNew.colors.x), (content.robotNew.picker01.y - content.robotNew.colors.y));
color2 = colorBitmap.getPixel((content.robotNew.picker02.x - content.robotNew.colors.x), (content.robotNew.picker02.y - content.robotNew.colors.y));
ChromeWars2.player.updateColors(color1, color2);
};
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
}
public function mouseDown():void{
}
public function startRobot():void{
var _local1:XML;
_local1 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
_local1.@name = content.robotNew.input_name.text;
_local1.@color1 = color1;
_local1.@color2 = color2;
_local1.@power = 1;
_local1.@agility = 1;
_local1.@speed = 1;
_local1.@precision = 1;
_local1.@defense = 1;
_local1.@grit = 1;
_local1.@chrome = 1;
_local1.@credits = 0;
_local1.@level = 0;
_local1.@stage = 0;
_local1.@specials = -1;
_local1.@repair = 5;
_local1.@shield = 0;
_local1.@nitro = 0;
clearHistory(_local1);
}
private function btnRandomize_clickHandler(_arg1:MouseEvent):void{
var _local2:XML;
_local2 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
randomizeColor(_local2);
ChromeWars2.player.updateData(_local2);
}
public function randomizeColor(_arg1:XML):void{
var _local2:MovieClip;
_local2 = content.robotNew.picker01;
_local2.x = (content.robotNew.colors.x + (Math.random() * (content.robotNew.colors.width - 1)));
_local2.y = (content.robotNew.colors.y + (Math.random() * (content.robotNew.colors.height - 1)));
_local2 = content.robotNew.picker02;
_local2.x = (content.robotNew.colors.x + (Math.random() * (content.robotNew.colors.width - 1)));
_local2.y = (content.robotNew.colors.y + (Math.random() * (content.robotNew.colors.height - 1)));
color1 = colorBitmap.getPixel((content.robotNew.picker01.x - content.robotNew.colors.x), (content.robotNew.picker01.y - content.robotNew.colors.y));
color2 = colorBitmap.getPixel((content.robotNew.picker02.x - content.robotNew.colors.x), (content.robotNew.picker02.y - content.robotNew.colors.y));
_arg1.@color1 = color1;
_arg1.@color2 = color2;
}
public function deactivate():void{
}
private function delete_clickHandler(_arg1:MouseEvent):void{
deleteRobot();
displayRobot();
content.closePopUp();
}
private function btnNext_clickHandler(_arg1:MouseEvent):void{
ChromeWars2.currentSave = ((ChromeWars2.currentSave + 1) % 4);
displayRobot();
}
public function deleteRobot():void{
var _local1:XML;
_local1 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
_local1.@shoulder = 0;
_local1.@head = 0;
_local1.@body = 0;
_local1.@weapon = 0;
_local1.@legs = 0;
_local1.@power = 0;
_local1.@agility = 0;
_local1.@speed = 0;
_local1.@precision = 0;
_local1.@defense = 0;
_local1.@grit = 0;
_local1.@chrome = 0;
_local1.@name = "Empty Slot";
_local1.@color1 = 0;
_local1.@color2 = 0;
_local1.@credits = 0;
_local1.@level = 0;
_local1.@stage = 0;
_local1.@specials = -1;
_local1.@repair = 5;
_local1.@shield = 0;
_local1.@nitro = 0;
clearHistory(_local1);
GlobalVariables.sharedObject.data.save2 = GlobalVariables.save.toXMLString();
}
}
}//package net.odd1.chromeWars2.screens
Section 163
//Lobby (net.odd1.chromeWars2.screens.Lobby)
package net.odd1.chromeWars2.screens {
import net.odd1.minig.managers.*;
import flash.events.*;
import gs.*;
import net.odd1.chromeWars2.global.*;
import net.odd1.minig.screens.*;
import net.odd1.minig.global.*;
import net.odd1.chromeWars2.utils.*;
import flash.net.*;
import net.odd1.minig.events.*;
import net.odd1.minig.transitions.*;
public final class Lobby extends Screen implements IScreen {
private const TRANSITION_TIME:Number = 1;
public var isVersus:Boolean;
public function destroy():void{
content.vs.v0.removeChild(ChromeWars2.player);
content.vs.v1.removeChild(ChromeWars2.enemy);
ButtonManager.getInstance().clear();
TweenMax.killAll();
killGames();
}
public function localiseButton():void{
content.btn_games.loc.gotoAndStop(JaludoUtil.Goto);
}
public function killGames():void{
content.btn_games.removeEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
content.btn_games.removeEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
content.btn_games.removeEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
content.btn_kiba.removeEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
content.btn_kiba.removeEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
content.btn_kiba.removeEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
}
private function btnFight_clickHandler(_arg1:MouseEvent):void{
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new Arena() as IScreen), new Fadeout(TRANSITION_TIME)));
}
private function btnShop_clickHandler(_arg1:MouseEvent):void{
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new BotShop() as IScreen), new Fadeout(TRANSITION_TIME)));
}
public function init():void{
loadSWF(Ressources.LOBBY_CLASS, Ressources.LOBBY_PATH, completeHandler);
}
public function initGames():void{
content.btn_kiba.visible = JaludoUtil.KIBA_VERSION;
localiseButton();
content.btn_games.addEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
content.btn_games.addEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
content.btn_games.addEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
content.btn_kiba.addEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
content.btn_kiba.addEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
content.btn_kiba.addEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
content.btn_games.buttonMode = true;
content.btn_games.useHandCursor = true;
content.btn_kiba.buttonMode = true;
content.btn_kiba.useHandCursor = true;
}
private function completeHandler():void{
ButtonManager.getInstance().addButton(content.HUD.label_btn0, btnBackMM_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.HUD.label_btn1, btnFight_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.btnShop, btnShop_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.btnArena, btnArena_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.btnProgress, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.progression.btnClose, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.yourStats.popUpClose, null, Ressources.sound_button0);
RessourceManager.getInstance().loadXML(Ressources.ENEMIES_CLASS, Ressources.ENEMIES_PATH, enemies_completeHandler);
initGames();
initPlayMoreGamesButton();
}
public function reload():void{
}
private function btnKibaClick_Handler(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://www.kibagames.com");
navigateToURL(_local2);
}
public function render(_arg1:Number):void{
if (isVersus){
ChromeWars2.player.render(_arg1);
ChromeWars2.enemy.render(_arg1);
};
}
public function setUpVersusScreen():void{
ChromeWars2.player.x = content.vs.v0.origin.x;
ChromeWars2.player.y = content.vs.v0.origin.y;
ChromeWars2.player.scaleX = 0.882;
ChromeWars2.player.scaleY = 0.882;
ChromeWars2.player.animation.playLabel("idle", true, null, true);
content.vs.v0.addChildAt(ChromeWars2.player, content.vs.v0.getChildIndex(content.vs.v0.origin));
content.vs.playerBox.playerName.text = ChromeWars2.player.fullName.toUpperCase();
content.vs.playerBox.stat_power.text = ChromeWars2.player.power;
content.vs.playerBox.stat_agility.text = ChromeWars2.player.agility;
content.vs.playerBox.stat_speed.text = ChromeWars2.player.speed;
content.vs.playerBox.stat_precision.text = ChromeWars2.player.precision;
content.vs.playerBox.stat_defense.text = ChromeWars2.player.defense;
content.vs.playerBox.stat_grit.text = ChromeWars2.player.grit;
content.vs.playerBox.stat_chrome.text = ChromeWars2.player.chrome;
ChromeWars2.enemy.x = content.vs.v0.origin.x;
ChromeWars2.enemy.y = content.vs.v0.origin.y;
ChromeWars2.enemy.scaleX = 0.882;
ChromeWars2.enemy.scaleY = 0.882;
if (ChromeWars2.enemy.animation){
ChromeWars2.enemy.animation.playLabel("idle", true, null, true);
} else {
ChromeWars2.enemy.goPlayIdle = true;
};
content.vs.v1.addChildAt(ChromeWars2.enemy, content.vs.v1.getChildIndex(content.vs.v1.origin));
content.vs.cpuBox.playerName.text = ChromeWars2.enemy.fullName.toUpperCase();
content.vs.cpuBox.stat_power.text = ChromeWars2.enemy.power;
content.vs.cpuBox.stat_agility.text = ChromeWars2.enemy.agility;
content.vs.cpuBox.stat_speed.text = ChromeWars2.enemy.speed;
content.vs.cpuBox.stat_precision.text = ChromeWars2.enemy.precision;
content.vs.cpuBox.stat_defense.text = ChromeWars2.enemy.defense;
content.vs.cpuBox.stat_grit.text = ChromeWars2.enemy.grit;
content.vs.cpuBox.stat_chrome.text = ChromeWars2.enemy.chrome;
}
private function btnKibaOut_Handler(_arg1:MouseEvent):void{
content.btn_kiba.gotoAndStop("off");
}
private function btnGamesOver_Handler(_arg1:MouseEvent):void{
content.btn_games.gotoAndStop("on");
localiseButton();
}
private function btnArena_clickHandler(_arg1:MouseEvent):void{
content.activateVersus();
isVersus = true;
}
public function mouseDown():void{
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
}
public function setTournamentLadder(_arg1:XML):void{
var node:XML;
var stage:int;
var i:int;
var xml = _arg1;
stage = 0;
for each (node in xml.enemies.enemy) {
if (ChromeWars2.currentArena == stage){
if (i == ChromeWars2.currentLevel){
ChromeWars2.enemy.updateData(node);
content.currentContestantName = node.@name;
content.arenaPreview.snapArena.arenaNumber.text = ("ARENA " + (ChromeWars2.currentArena + 1));
content.arenaPreview.snapOpponent.opponent.text = node.@name;
if (node.@boss == "true"){
content.arenaPreview.snapOpponent.head.visible = false;
} else {
content.arenaPreview.snapOpponent.head.visible = true;
content.arenaPreview.snapOpponent.head.gotoAndStop((int(node.@head) + 1));
content.arenaPreview.snapOpponent.head.addFrameScript(int(node.@head), function ():void{
Utils.changeColor(content.arenaPreview.snapOpponent.head, node.@color1, node.@color2);
Utils.changeChrome(content.arenaPreview.snapOpponent.head, node.@chrome);
});
};
};
};
if (node.@boss == "true"){
content[("bossNameLevel" + stage)] = node.@name;
stage = (stage + 1);
};
i = (i + 1);
};
content.currentLevel = ChromeWars2.currentArena;
content.setUpProgression();
}
public function mouseUp():void{
}
private function btnGamesOut_Handler(_arg1:MouseEvent):void{
content.btn_games.gotoAndStop("off");
localiseButton();
}
private function btnGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.BETWEEN_LEVELS);
}
private function btnBackMM_clickHandler(_arg1:MouseEvent):void{
if (isVersus){
content.hideVersus();
isVersus = false;
} else {
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new MainMenu() as IScreen), new Fadeout(TRANSITION_TIME)));
};
}
private function btnKibaOver_Handler(_arg1:MouseEvent):void{
content.btn_kiba.gotoAndStop("on");
}
private function initPlayMoreGamesButton():void{
ButtonManager.getInstance().addButton(content.btnPlayMoreGames, btnPlayMoreGamesClick_Handler);
}
public function deactivate():void{
}
private function btnPlayMoreGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.BETWEEN_LEVELS);
}
public function enemies_completeHandler(_arg1:XML):void{
var _local2:XML;
setTournamentLadder(_arg1);
_local2 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
_local2.@stage = ChromeWars2.currentArena;
_local2.@credits = ChromeWars2.player.gold;
_local2.@level = ChromeWars2.currentLevel;
_local2.@repair = ChromeWars2.player.repairLeft;
_local2.@nitro = ChromeWars2.player.nitroLeft;
_local2.@shield = ChromeWars2.player.shieldLeft;
GlobalVariables.sharedObject.data.save2 = GlobalVariables.save.toXMLString();
ChromeWars2.player.updateData(_local2);
content.setDomeLevel(ChromeWars2.currentArena, 0);
content.btnArena.arenaNumber.text = (ChromeWars2.currentArena + 1).toString();
setUpVersusScreen();
SoundPlayer.getInstance().setSoundIcons(content.miniHUD);
Utils.setPlayerStats(content);
}
}
}//package net.odd1.chromeWars2.screens
Section 164
//MainMenu (net.odd1.chromeWars2.screens.MainMenu)
package net.odd1.chromeWars2.screens {
import net.odd1.minig.managers.*;
import flash.events.*;
import gs.*;
import net.odd1.chromeWars2.global.*;
import flash.filters.*;
import net.odd1.minig.screens.*;
import net.odd1.chromeWars2.utils.*;
import flash.net.*;
import net.odd1.minig.events.*;
import net.odd1.minig.transitions.*;
public final class MainMenu extends Screen implements IScreen {
private const TRANSITION_TIME:Number = 1;
public function MainMenu(){
SoundManager.getInstance().playSong(Ressources.sound_musicMenu);
ChromeWars2.currentLevel = 0;
ChromeWars2.currentArena = 0;
ChromeWars2.currentSave = 0;
super();
}
public function localiseButton():void{
content.btn_games.loc.gotoAndStop(JaludoUtil.Goto);
}
public function killGames():void{
content.menu.iphoneAd.removeEventListener(MouseEvent.MOUSE_OVER, iphoneOverHandler);
content.menu.iphoneAd.removeEventListener(MouseEvent.MOUSE_OUT, iphoneOutHandler);
content.btn_games.removeEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
content.btn_games.removeEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
content.btn_games.removeEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
content.menu.iphoneAd.removeEventListener(MouseEvent.CLICK, iphoneClickHandler);
content.btn_kiba.removeEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
content.btn_kiba.removeEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
content.btn_kiba.removeEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
}
public function init():void{
loadSWF(Ressources.MAINMENU_CLASS, Ressources.MAINMENU_PATH, completeHandler);
}
public function initGames():void{
trace(JaludoUtil.KIBA_VERSION);
content.btn_kiba.visible = JaludoUtil.KIBA_VERSION;
localiseButton();
content.menu.iphoneAd.useHandButton = true;
content.menu.iphoneAd.buttonMode = true;
content.menu.iphoneAd.addEventListener(MouseEvent.CLICK, iphoneClickHandler);
content.menu.iphoneAd.addEventListener(MouseEvent.MOUSE_OVER, iphoneOverHandler);
content.menu.iphoneAd.addEventListener(MouseEvent.MOUSE_OUT, iphoneOutHandler);
content.btn_games.addEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
content.btn_games.addEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
content.btn_games.addEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
content.btn_kiba.addEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
content.btn_kiba.addEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
content.btn_kiba.addEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
content.btn_games.buttonMode = true;
content.btn_games.useHandCursor = true;
content.btn_kiba.buttonMode = true;
content.btn_kiba.useHandCursor = true;
}
private function btnPlay_clickHandler(_arg1:MouseEvent):void{
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new ChooseRobot() as IScreen), new Fadeout(TRANSITION_TIME)));
}
public function reload():void{
}
private function btnKibaClick_Handler(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://www.kibagames.com");
navigateToURL(_local2);
}
public function render(_arg1:Number):void{
if (content.playMoreGames){
content.playMoreGames = false;
trace("open play more games");
JaludoUtil.openLink(JaludoUtil.START_MENU);
};
}
private function btnKibaOut_Handler(_arg1:MouseEvent):void{
content.btn_kiba.gotoAndStop("off");
}
private function iphoneOutHandler(_arg1:MouseEvent):void{
content.menu.iphoneAd.filters = [];
}
private function btnGamesOver_Handler(_arg1:MouseEvent):void{
content.btn_games.gotoAndStop("on");
localiseButton();
}
public function iphoneClickHandler(_arg1:MouseEvent):void{
content.menu.iphoneAd.filters = [];
navigateToURL(new URLRequest("http://itunes.apple.com/ca/app/chrome-wars-arena/id348757652?mt=8"), "_blank");
}
private function completeHandler():void{
ButtonManager.getInstance().addButton(content.menu.btnPlay, btnPlay_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.menu.btnScore, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.menu.btnTut, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.menu.btnCredits, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.boxTut0.btnReturnMenu, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.boxTut0.btnTutoNext, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.boxTut1.btnReturnMenu, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.boxTut1.btnTutoNext, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.boxHighscores.btnReturnMenu, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.boxCredits.btnReturnMenu, null, Ressources.sound_button0);
content.insertStats(Utils.getGeneralHS());
SoundPlayer.getInstance().setSoundIcons(content.menu);
initGames();
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
if (_arg2){
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new ChooseRobot() as IScreen), new Fadeout(TRANSITION_TIME)));
};
}
public function mouseDown():void{
}
public function mouseUp():void{
}
private function iphoneOverHandler(_arg1:MouseEvent):void{
content.menu.iphoneAd.filters = [new GlowFilter(0xFFFFFF, 1, 4, 4, 2, 2)];
}
private function btnGamesOut_Handler(_arg1:MouseEvent):void{
content.btn_games.gotoAndStop("off");
localiseButton();
}
private function btnKibaOver_Handler(_arg1:MouseEvent):void{
content.btn_kiba.gotoAndStop("on");
}
public function destroy():void{
killGames();
content.destroy();
ButtonManager.getInstance().clear();
TweenMax.killAll();
}
public function deactivate():void{
}
private function btnGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.START_MENU);
}
}
}//package net.odd1.chromeWars2.screens
Section 165
//Preloader (net.odd1.chromeWars2.screens.Preloader)
package net.odd1.chromeWars2.screens {
import net.odd1.minig.managers.*;
import net.odd1.minig.screens.*;
import net.odd1.minig.transitions.*;
import net.odd1.minig.events.*;
import net.odd1.minig.global.*;
import net.odd1.chromeWars2.events.*;
import net.odd1.chromeWars2.utils.*;
public final class Preloader extends Screen implements IScreen {
private const TRANSITION_TIME:Number = 1;
public static const PRELOADER_PATH:String = "./assets/movieclips/screens/preloaderJaludo.swf";
public static var PRELOADER_CLASS:Class = Preloader_PRELOADER_CLASS;
public function reload():void{
}
private function splashEnd(_arg1:SplashEvent):void{
JaludoUtil.openLink = content.open_link;
JaludoUtil.sendHighscore = content.send_highscore;
JaludoUtil.Goto = content.Goto;
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new GlobalVariables.nextScreen() as IScreen), new Fadeout(TRANSITION_TIME)));
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
}
public function mouseDown():void{
}
public function mouseUp():void{
}
public function init():void{
loadSWF(PRELOADER_CLASS, PRELOADER_PATH, completeHandler);
}
private function completeHandler():void{
content.addEventListener(SplashEvent.END, splashEnd);
}
public function deactivate():void{
}
public function destroy():void{
ButtonManager.getInstance().clear();
}
public function render(_arg1:Number):void{
}
}
}//package net.odd1.chromeWars2.screens
Section 166
//Preloader_PRELOADER_CLASS (net.odd1.chromeWars2.screens.Preloader_PRELOADER_CLASS)
package net.odd1.chromeWars2.screens {
import mx.core.*;
import flash.utils.*;
public class Preloader_PRELOADER_CLASS extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Preloader_PRELOADER_CLASS(){
dataClass = Preloader_PRELOADER_CLASS_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package net.odd1.chromeWars2.screens
Section 167
//Preloader_PRELOADER_CLASS_dataClass (net.odd1.chromeWars2.screens.Preloader_PRELOADER_CLASS_dataClass)
package net.odd1.chromeWars2.screens {
import mx.core.*;
public class Preloader_PRELOADER_CLASS_dataClass extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2.screens
Section 168
//Stats (net.odd1.chromeWars2.screens.Stats)
package net.odd1.chromeWars2.screens {
import net.odd1.minig.managers.*;
import net.odd1.chromeWars2.characters.*;
import flash.events.*;
import gs.*;
import net.odd1.chromeWars2.global.*;
import net.odd1.minig.screens.*;
import net.odd1.minig.global.*;
import net.odd1.chromeWars2.utils.*;
import net.odd1.minig.events.*;
import net.odd1.minig.transitions.*;
public final class Stats extends Screen implements IScreen {
private const TRANSITION_TIME:Number = 1;
private var robot:Robot;
private function confirm_clickHandler(_arg1:MouseEvent):void{
if (content.remainingStats != 0){
content.popUpWarning();
} else {
saveStats();
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new Lobby() as IScreen), new Fadeout(TRANSITION_TIME)));
};
}
private function initPlayMoreGamesButton():void{
ButtonManager.getInstance().addButton(content.btnPlayMoreGames, btnPlayMoreGamesClick_Handler);
}
public function init():void{
loadSWF(Ressources.STATS_CLASS, Ressources.STATS_PATH, completeHandler);
}
private function completeHandler():void{
robot = ChromeWars2.player;
robot.x = content.origin.x;
robot.y = content.origin.y;
robot.scaleX = -0.51;
robot.scaleY = 0.51;
robot.animation.playLabel("idle", true, null, true);
if (ChromeWars2.currentLevel == 0){
content.setUpHUD("regular", "MAIN MENU", "CONFIRM", "");
ButtonManager.getInstance().addButton(content.HUD.label_btn0, mainMenu_clickHandler, Ressources.sound_button0);
} else {
content.setUpHUD("monoR", "", "CONFIRM", "");
};
ButtonManager.getInstance().addButton(content.HUD.label_btn1, confirm_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.btnRandomize, random_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.miniHUD.btnSounds, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.miniHUD.btnMusic, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.HUD.label_btn2, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.up_0, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.down_0, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.up_1, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.down_1, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.up_2, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.down_2, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.up_3, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.down_3, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.up_4, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.down_4, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.up_5, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.down_5, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.up_6, null, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.statsPanel.down_6, null, Ressources.sound_button0);
content.addChildAt(robot, content.getChildIndex(content.origin));
content.remainingStats = ((ChromeWars2.currentLevel == 0)) ? GlobalVariables.data.game.@startValue : GlobalVariables.data.game.@levelPoints;
content.statsPanel.pts_remain.text = content.remainingStats;
loadStats();
SoundPlayer.getInstance().setSoundIcons(content.miniHUD);
Utils.setPlayerStats(content);
initPlayMoreGamesButton();
}
private function mainMenu_clickHandler(_arg1:MouseEvent):void{
deleteStats();
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new MainMenu() as IScreen), new Fadeout(TRANSITION_TIME)));
}
public function reload():void{
}
public function render(_arg1:Number):void{
robot.render(_arg1);
}
public function random_clickHandler(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
loadStats();
content.remainingStats = ((ChromeWars2.currentLevel == 0)) ? GlobalVariables.data.game.@startValue : GlobalVariables.data.game.@levelPoints;
content.statsPanel.pts_remain.text = content.remainingStats;
_local2 = 0;
while (_local2 < content.remainingStats) {
_local3 = int((Math.random() * 7));
_local4 = int(content.statsPanel[("pts_" + _local3)].text);
content.statsPanel[("pts_" + _local3)].text = (_local4 + 1);
_local2++;
};
content.remainingStats = 0;
content.statsPanel.pts_remain.text = content.remainingStats;
}
public function loadStats():void{
var _local1:XML;
_local1 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
content.statsPanel.pts_0.text = _local1.@power;
content.statsPanel.pts_1.text = _local1.@agility;
content.statsPanel.pts_2.text = _local1.@speed;
content.statsPanel.pts_3.text = _local1.@precision;
content.statsPanel.pts_4.text = _local1.@defense;
content.statsPanel.pts_5.text = _local1.@grit;
content.statsPanel.pts_6.text = _local1.@chrome;
content.minStat0 = _local1.@power;
content.minStat1 = _local1.@agility;
content.minStat2 = _local1.@speed;
content.minStat3 = _local1.@precision;
content.minStat4 = _local1.@defense;
content.minStat5 = _local1.@grit;
content.minStat6 = _local1.@chrome;
}
public function saveStats():void{
var _local1:XML;
_local1 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
_local1.@power = int(content.statsPanel.pts_0.text);
_local1.@agility = int(content.statsPanel.pts_1.text);
_local1.@speed = int(content.statsPanel.pts_2.text);
_local1.@precision = int(content.statsPanel.pts_3.text);
_local1.@defense = int(content.statsPanel.pts_4.text);
_local1.@grit = int(content.statsPanel.pts_5.text);
_local1.@chrome = int(content.statsPanel.pts_6.text);
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
}
public function mouseDown():void{
}
public function mouseUp():void{
}
public function deleteStats():void{
var _local1:XML;
_local1 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
_local1.@power = 0;
_local1.@agility = 0;
_local1.@speed = 0;
_local1.@precision = 0;
_local1.@defense = 0;
_local1.@grit = 0;
_local1.@chrome = 0;
_local1.@name = "Empty Slot";
_local1.@credits = 0;
_local1.@level = 0;
_local1.@stage = 0;
}
public function destroy():void{
content.removeChild(robot);
robot = null;
ButtonManager.getInstance().clear();
TweenMax.killAll();
}
public function deactivate():void{
}
private function btnPlayMoreGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.BETWEEN_LEVELS);
}
}
}//package net.odd1.chromeWars2.screens
Section 169
//TheEnd (net.odd1.chromeWars2.screens.TheEnd)
package net.odd1.chromeWars2.screens {
import net.odd1.minig.managers.*;
import flash.events.*;
import gs.*;
import net.odd1.chromeWars2.global.*;
import net.odd1.minig.screens.*;
import net.odd1.minig.global.*;
import net.odd1.chromeWars2.utils.*;
import flash.net.*;
import net.odd1.minig.events.*;
import net.odd1.minig.transitions.*;
public class TheEnd extends Screen implements IScreen {
public function localiseButton():void{
content.btn_games.loc.gotoAndStop(JaludoUtil.Goto);
}
public function killGames():void{
content.btn_games.removeEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
content.btn_games.removeEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
content.btn_games.removeEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
content.btn_kiba.removeEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
content.btn_kiba.removeEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
content.btn_kiba.removeEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
}
public function mainMenu_clickHandler(_arg1:MouseEvent):void{
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, new MainMenu(), new Fadeout(1)));
}
public function init():void{
loadSWF(Ressources.THEEND_CLASS, Ressources.THEEND_PATH, completeHandler);
}
public function completeHandler():void{
var _local1:XML;
ButtonManager.getInstance().addButton(content.HUD.label_btn1, mainMenu_clickHandler);
_local1 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
_local1.@level = ChromeWars2.currentLevel;
GlobalVariables.sharedObject.data.save2 = GlobalVariables.save.toXMLString();
ChromeWars2.player.x = content.origin.x;
ChromeWars2.player.y = content.origin.y;
ChromeWars2.player.scaleX = -0.65;
ChromeWars2.player.scaleY = 0.65;
ChromeWars2.player.animation.playLabel("idle", true, null, true);
content.addChildAt(ChromeWars2.player, content.getChildIndex(content.origin));
initGames();
initPlayMoreGamesButton();
}
private function initPlayMoreGamesButton():void{
ButtonManager.getInstance().addButton(content.btnPlayMoreGames, btnPlayMoreGamesClick_Handler);
}
public function render(_arg1:Number):void{
ChromeWars2.player.animation.render(_arg1);
}
public function initGames():void{
content.btn_kiba.visible = JaludoUtil.KIBA_VERSION;
localiseButton();
content.btn_games.addEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
content.btn_games.addEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
content.btn_games.addEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
content.btn_kiba.addEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
content.btn_kiba.addEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
content.btn_kiba.addEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
content.btn_games.buttonMode = true;
content.btn_games.useHandCursor = true;
content.btn_kiba.buttonMode = true;
content.btn_kiba.useHandCursor = true;
}
private function btnKibaClick_Handler(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://www.kibagames.com");
navigateToURL(_local2);
}
private function btnKibaOut_Handler(_arg1:MouseEvent):void{
content.btn_kiba.gotoAndStop("off");
}
private function btnGamesOver_Handler(_arg1:MouseEvent):void{
content.btn_games.gotoAndStop("on");
localiseButton();
}
public function mouseDown():void{
}
public function reload():void{
}
private function btnGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.GAME_OVER);
}
public function mouseUp():void{
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
}
private function btnGamesOut_Handler(_arg1:MouseEvent):void{
content.btn_games.gotoAndStop("off");
localiseButton();
}
private function btnPlayMoreGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.GAME_OVER);
}
private function btnKibaOver_Handler(_arg1:MouseEvent):void{
content.btn_kiba.gotoAndStop("on");
}
public function destroy():void{
content.removeChild(ChromeWars2.player);
ButtonManager.getInstance().clear();
TweenMax.killAll();
killGames();
}
public function deactivate():void{
}
}
}//package net.odd1.chromeWars2.screens
Section 170
//Tournament (net.odd1.chromeWars2.screens.Tournament)
package net.odd1.chromeWars2.screens {
import net.odd1.minig.managers.*;
import flash.events.*;
import gs.*;
import net.odd1.chromeWars2.global.*;
import net.odd1.minig.screens.*;
import net.odd1.minig.global.*;
import net.odd1.chromeWars2.utils.*;
import flash.net.*;
import net.odd1.minig.events.*;
import net.odd1.minig.transitions.*;
public final class Tournament extends Screen implements IScreen {
private const TRANSITION_TIME:Number = 1;
public var goldEarned:int;
public static var won:Boolean;
public function destroy():void{
ButtonManager.getInstance().clear();
TweenMax.killAll();
killGames();
}
public function localiseButton():void{
content.btn_games.loc.gotoAndStop(JaludoUtil.Goto);
}
public function killGames():void{
content.btn_games.removeEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
content.btn_games.removeEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
content.btn_games.removeEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
content.btn_kiba.removeEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
content.btn_kiba.removeEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
content.btn_kiba.removeEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
}
public function stats_clickHandler(_arg1:MouseEvent):void{
if (won){
if (ChromeWars2.currentLevel == 50){
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new TheEnd() as IScreen), new Fadeout(TRANSITION_TIME)));
} else {
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new Stats() as IScreen), new Fadeout(TRANSITION_TIME)));
};
} else {
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new Lobby() as IScreen), new Fadeout(TRANSITION_TIME)));
};
}
public function initGames():void{
content.btn_kiba.visible = JaludoUtil.KIBA_VERSION;
localiseButton();
content.btn_games.addEventListener(MouseEvent.CLICK, btnGamesClick_Handler);
content.btn_games.addEventListener(MouseEvent.MOUSE_OVER, btnGamesOver_Handler);
content.btn_games.addEventListener(MouseEvent.MOUSE_OUT, btnGamesOut_Handler);
content.btn_kiba.addEventListener(MouseEvent.CLICK, btnKibaClick_Handler);
content.btn_kiba.addEventListener(MouseEvent.MOUSE_OVER, btnKibaOver_Handler);
content.btn_kiba.addEventListener(MouseEvent.MOUSE_OUT, btnKibaOut_Handler);
content.btn_games.buttonMode = true;
content.btn_games.useHandCursor = true;
content.btn_kiba.buttonMode = true;
content.btn_kiba.useHandCursor = true;
}
public function init():void{
loadSWF(Ressources.TOURNAMENT_CLASS, Ressources.TOURNAMENT_PATH, completeHandler);
SoundManager.getInstance().playSong(Ressources.sound_musicMenu);
}
private function completeHandler():void{
var _local1:XML;
var _local6:XML;
var _local9:XML;
goldEarned = 0;
content.bossDefeat = false;
if (won){
SoundManager.getInstance().playSound(Ressources.sound_crowd1);
goldEarned = (ChromeWars2.enemy.gold + ((ChromeWars2.enemy.gold * Math.min(100, ChromeWars2.player.chrome)) / 100));
ChromeWars2.player.gold = (ChromeWars2.player.gold + goldEarned);
ChromeWars2.currentLevel++;
if (ChromeWars2.enemy.boss){
ChromeWars2.currentArena++;
_local9 = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
if (ChromeWars2.currentArena < 6){
_local9.specials.@[("part" + (ChromeWars2.currentArena - 1))] = (ChromeWars2.currentArena - 1);
};
content.bossDefeat = true;
};
Utils.updateHighScore(Utils.HS_STREAK, 1);
Utils.updateHighScore(Utils.HS_WINS, 1);
content.setUpHUD("regular", String(ChromeWars2.player.gold), "UPGRADE", "");
} else {
Utils.updateHighScore(Utils.HS_STREAK, 0);
Utils.updateHighScore(Utils.HS_LOSS, 1);
goldEarned = Math.round(((ChromeWars2.enemy.gold + ((ChromeWars2.enemy.gold * Math.min(100, ChromeWars2.player.chrome)) / 100)) / 4));
ChromeWars2.player.gold = (ChromeWars2.player.gold + goldEarned);
content.setUpHUD("dual", String(ChromeWars2.player.gold), "LOBBY", "REMATCH");
};
content.initTournament();
content.setUpResults((won) ? "VICTORY" : "DEFEAT", Utils.getRankString((51 - ChromeWars2.currentLevel)), (ChromeWars2.currentArena + 1), goldEarned, Utils.getPlayerHS(), (ChromeWars2.enemy.boss) ? (ChromeWars2.currentArena - 1) : 0, (ChromeWars2.enemy.boss) ? LocaleManager.getInstance().xml.specials.special[ChromeWars2.currentArena].@name : "y");
ButtonManager.getInstance().addButton(content.HUD.label_btn1, stats_clickHandler, Ressources.sound_button0);
ButtonManager.getInstance().addButton(content.HUD.label_btn2, retry_clickHandler, Ressources.sound_button0);
SoundPlayer.getInstance().setSoundIcons(content.miniHUD);
var _local2:XML = GlobalVariables.save.saves.save[ChromeWars2.currentSave].highScore[0];
_local1 = GlobalVariables.save.highscores[0];
var _local3:int;
var _local4:Boolean;
var _local5:int;
var _local7:int;
var _local8:int = _local1.length;
for each (_local6 in _local1.highscore) {
if (String(_local6.@robotName) == String(ChromeWars2.player.fullName)){
_local4 = true;
_local5 = int(_local6.@score);
break;
} else {
_local7++;
};
};
if (!_local4){
for each (_local6 in _local1.highscore) {
if (int(_local2.@highScore) < int(_local6.@score)){
_local3++;
} else {
break;
};
};
if (_local3 < 5){
_local1 = _local1.insertChildBefore(_local1.highscore[_local3], new XML((((("<highscore robotName=\"" + ChromeWars2.player.fullName) + "\" score=\"") + _local2.@highScore) + "\" />")));
delete _local1.highscore[(_local1.highscore.length() - 1)];
};
} else {
if (_local2.@highScore > _local5){
delete _local1.highscore[_local7];
for each (_local6 in _local1.highscore) {
if (int(_local2.@highScore) < int(_local6.@score)){
_local3++;
} else {
break;
};
};
_local1 = _local1.insertChildBefore(_local1.highscore[_local3], new XML((((("<highscore robotName=\"" + ChromeWars2.player.fullName) + "\" score=\"") + _local2.@highScore) + "\" />")));
};
};
Utils.setPlayerStats(content);
initGames();
initPlayMoreGamesButton();
}
public function reload():void{
}
private function btnKibaClick_Handler(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest("http://www.kibagames.com");
navigateToURL(_local2);
}
public function render(_arg1:Number):void{
}
private function btnKibaOut_Handler(_arg1:MouseEvent):void{
content.btn_kiba.gotoAndStop("off");
}
public function mainMenu_clickHandler(_arg1:MouseEvent):void{
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new MainMenu() as IScreen), new Fadeout(TRANSITION_TIME)));
}
private function btnGamesOver_Handler(_arg1:MouseEvent):void{
content.btn_games.gotoAndStop("on");
localiseButton();
}
public function mouseDown():void{
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
}
public function mouseUp():void{
}
public function retry_clickHandler(_arg1:MouseEvent):void{
var _local2:XML = GlobalVariables.save.saves.save[ChromeWars2.currentSave];
ChromeWars2.player.hp = ChromeWars2.player.hpTotal;
ChromeWars2.enemy.hp = ChromeWars2.enemy.hpTotal;
ChromeWars2.enemy.repairLeft = 3;
if (ChromeWars2.player.eyeAnimation){
ChromeWars2.player.eyeAnimation.playLabel("idle", true);
};
if (ChromeWars2.enemy.eyeAnimation){
ChromeWars2.enemy.eyeAnimation.playLabel("idle", true);
};
if (ChromeWars2.player.specials > 0){
ChromeWars2.player.remainingSpecial = ((ChromeWars2.player.specials < 4)) ? 3 : 5;
};
if (ChromeWars2.enemy.specials > 0){
ChromeWars2.enemy.remainingSpecial = ((ChromeWars2.player.specials < 4)) ? 3 : 5;
};
dispatchEvent(new ScreenEvent(ScreenEvent.QUIT, (new Arena() as IScreen), new Fadeout(TRANSITION_TIME)));
}
private function btnGamesOut_Handler(_arg1:MouseEvent):void{
content.btn_games.gotoAndStop("off");
localiseButton();
}
private function btnPlayMoreGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.BETWEEN_LEVELS);
}
private function btnKibaOver_Handler(_arg1:MouseEvent):void{
content.btn_kiba.gotoAndStop("on");
}
private function initPlayMoreGamesButton():void{
ButtonManager.getInstance().addButton(content.btnPlayMoreGames, btnPlayMoreGamesClick_Handler);
ButtonManager.getInstance().addButton(content.btnSubmit, btnSubmitClick_Handler);
}
public function deactivate():void{
}
private function btnGamesClick_Handler(_arg1:MouseEvent):void{
JaludoUtil.openLink(JaludoUtil.BETWEEN_LEVELS);
}
private function btnSubmitClick_Handler(_arg1:MouseEvent):void{
var _local2:Array;
_local2 = Utils.getPlayerHS();
trace(("send score:" + _local2[4]));
JaludoUtil.sendHighscore(JaludoUtil.BETWEEN_LEVELS, JaludoUtil.encrypt(String(_local2[4])));
}
}
}//package net.odd1.chromeWars2.screens
Section 171
//JaludoUtil (net.odd1.chromeWars2.utils.JaludoUtil)
package net.odd1.chromeWars2.utils {
import flash.utils.*;
import com.hurlant.crypto.symmetric.*;
import com.hurlant.crypto.*;
import com.hurlant.util.*;
public class JaludoUtil {
public static const GAME_OVER:String = "game over";
public static const COMPLETED_GAME:String = "completed game";
public static const INTRO:String = "intro";
public static const KIBA_VERSION:Boolean = false;
public static const PRELOADER:String = "preloader";
public static const BETWEEN_LEVELS:String = "between levels";
public static const GAME:String = "game";
public static const SHOP:String = "shop";
public static const START_MENU:String = "start menu";
public static var Goto:String;
public static var Url:String;
public static var sendHighscore:Function;
public static var openLink:Function;
private static var type:String = "simple-des-ecb";
public static function encrypt(_arg1:String=""):String{
var _local2:ByteArray = Hex.toArray(Hex.fromString(_arg1));
var _local3:IPad = new PKCS5();
var _local4:ICipher = Crypto.getCipher(type, Hex.toArray(Hex.fromString("9sj2te5h")), _local3);
_local3.setBlockSize(_local4.getBlockSize());
_local4.encrypt(_local2);
return (Base64.encodeByteArray(_local2));
}
}
}//package net.odd1.chromeWars2.utils
Section 172
//FactoryClass (net.odd1.chromeWars2.FactoryClass)
package net.odd1.chromeWars2 {
import net.odd1.minig.global.*;
import com.mochibot.*;
import net.odd1.minig.factories.*;
import flash.text.*;
import net.odd1.chromeWars2.screens.*;
import net.odd1.chromeWars2.fonts.*;
import net.odd1.chromeWars2.global.*;
import net.odd1.chromeWars2.utils.*;
public class FactoryClass extends Factory {
private const IS_DEBUGGING:Boolean = false;
private const IS_LOADING_EMBEDDED:Boolean = true;
private const MOCHIBOT:String = "8da5bc0b";
private const DATA_URL:String = "./assets/data/data.xml";
private const IS_RENEW_SAVE:Boolean = false;
private const MOCHIBOT_JALUDO:String;
private const LOCALE_BYTE:Array;
private const DOMAINS:Array;
private const CLASS_NAME:String = "ChromeWars2";
private const IS_SKIPPING_TRANSITIONS:Boolean = false;
private const LOCALE:Array;
private const SAVE_URL:String = "./assets/data/save.xml";
private const STAGE_WIDTH:int = 640;
private const LOCALE_EN_US_URL:String = "./assets/data/locale/en-US.xml";
private const STAGE_HEIGHT:int = 480;
private const LOCALE_URL:Array;
private const IS_SKIPPING_ADS:Boolean = false;
private const CREDIT:String = "Chrome Wars 2 by Odd1.net
Programmed by Jean-Denis Boivin
Art by Francis Beausoleil
Design by Benjamin Paquette
Produced for Jaludo.com";
private const IS_SKIPPING_PRELOADER:Boolean = false;
private static var DATA_CLASS:Class = FactoryClass_DATA_CLASS;
private static var LOCALE_EN_US_CLASS:Class = FactoryClass_LOCALE_EN_US_CLASS;
private static var SAVE_CLASS:Class = FactoryClass_SAVE_CLASS;
public function FactoryClass(){
MOCHIBOT_JALUDO = (JaludoUtil.KIBA_VERSION) ? "71e1bcb4" : "2b33e2d5";
DOMAINS = [];
LOCALE = ["en-US"];
LOCALE_BYTE = [LOCALE_EN_US_CLASS];
LOCALE_URL = [LOCALE_EN_US_URL];
Font.registerFont(FontDefault);
Font.registerFont(FontSpinCycle);
Font.registerFont(FontHappyKiller);
Font.registerFont(FontEurostile);
super(CLASS_NAME, Preloader, DOMAINS, LOCALE, LOCALE_BYTE, LOCALE_URL, SAVE_CLASS, SAVE_URL, DATA_CLASS, DATA_URL, MOCHIBOT, CREDIT, STAGE_WIDTH, STAGE_HEIGHT, IS_DEBUGGING, IS_SKIPPING_ADS, IS_SKIPPING_TRANSITIONS, IS_LOADING_EMBEDDED, IS_RENEW_SAVE, IS_SKIPPING_PRELOADER);
try {
MochiBot.track(this, MOCHIBOT_JALUDO);
} catch(e:Error) {
};
Debug.getInstance().println("-----------");
Debug.getInstance().println("Chrome Wars 2, by Jean-Denis Boivin and Laurent Salaun and Louis-Simon Menard");
Debug.getInstance().println("");
Debug.getInstance().println(("Build : " + Version.BUILD_NUMBER));
Debug.getInstance().println(("Date : " + Version.BUILD_TIME));
Debug.getInstance().println(("Author : " + Version.BUILD_AUTHOR));
Debug.getInstance().println("");
Debug.getInstance().println("-----------");
}
}
}//package net.odd1.chromeWars2
Section 173
//FactoryClass_DATA_CLASS (net.odd1.chromeWars2.FactoryClass_DATA_CLASS)
package net.odd1.chromeWars2 {
import mx.core.*;
public class FactoryClass_DATA_CLASS extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2
Section 174
//FactoryClass_LOCALE_EN_US_CLASS (net.odd1.chromeWars2.FactoryClass_LOCALE_EN_US_CLASS)
package net.odd1.chromeWars2 {
import mx.core.*;
public class FactoryClass_LOCALE_EN_US_CLASS extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2
Section 175
//FactoryClass_SAVE_CLASS (net.odd1.chromeWars2.FactoryClass_SAVE_CLASS)
package net.odd1.chromeWars2 {
import mx.core.*;
public class FactoryClass_SAVE_CLASS extends ByteArrayAsset {
}
}//package net.odd1.chromeWars2
Section 176
//Animation (net.odd1.minig.animations.Animation)
package net.odd1.minig.animations {
public class Animation implements IAnimation {
public var stop:Boolean;
public var currentData:AnimationData;
private var stopHandler:Function;
public var fps:int;
protected var frame:int;
protected var currentFrame:Number;
private var lastFrame:int;
private var skipLastFrame:Boolean;
public var animationsData:Array;
private var looping:Boolean;
public function Animation(){
looping = false;
stopAnim();
}
public function render(_arg1:Number):void{
if (!stop){
currentFrame = (currentFrame + (_arg1 * fps));
if (int(currentFrame) != frame){
if (((stop) || (((!(looping)) && ((int(currentFrame) >= lastFrame)))))){
frame = (lastFrame - 1);
currentFrame = (lastFrame - 1);
setFrame(((lastFrame + currentData.start) - 1));
stopAnim();
} else {
frame = (int(currentFrame) % lastFrame);
currentFrame = (currentFrame % lastFrame);
setFrame((frame + currentData.start));
};
};
};
}
public function playLabel(_arg1:String, _arg2:Boolean=true, _arg3:Function=null, _arg4:Boolean=false):void{
var _local5:AnimationData;
var _local6:int;
var _local7:Boolean;
_local7 = false;
for each (_local5 in animationsData) {
if (_local5.label == _arg1){
_local7 = true;
break;
};
};
if (_local7){
frame = 0;
currentFrame = 0;
looping = _arg2;
stop = false;
currentData = _local5;
if (_arg4){
lastFrame = (currentData.length - 1);
} else {
lastFrame = currentData.length;
};
this.stopHandler = _arg3;
this.skipLastFrame = _arg4;
setFrame((frame + currentData.start));
};
}
public function get loop():Boolean{
return (looping);
}
public function playAnim(_arg1:int=-1, _arg2:int=-1, _arg3:Boolean=false):void{
}
public function setFrame(_arg1:int):void{
}
public function destroyAnim():void{
}
public function stopAnim():void{
var _local1:Function;
var _local2:AnimationData;
_local1 = stopHandler;
stopHandler = null;
stop = true;
if (_local1 != null){
_local1(this);
};
}
public function destroy():void{
stopHandler = null;
stopAnim();
animationsData = null;
destroyAnim();
currentData = null;
}
}
}//package net.odd1.minig.animations
Section 177
//AnimationData (net.odd1.minig.animations.AnimationData)
package net.odd1.minig.animations {
public class AnimationData {
public var label:String;
public var start:int;
public var length:int;
public var end:int;
public function AnimationData(_arg1:String, _arg2:int, _arg3:int){
this.label = _arg1;
this.start = _arg2;
this.end = _arg3;
this.length = ((_arg3 - _arg2) + 1);
}
}
}//package net.odd1.minig.animations
Section 178
//IAnimation (net.odd1.minig.animations.IAnimation)
package net.odd1.minig.animations {
public interface IAnimation {
function playLabel(_arg1:String, _arg2:Boolean=true, _arg3:Function=null, _arg4:Boolean=false):void;
function stopAnim():void;
function playAnim(_arg1:int=-1, _arg2:int=-1, _arg3:Boolean=false):void;
function render(_arg1:Number):void;
function destroy():void;
}
}//package net.odd1.minig.animations
Section 179
//MovieClipAnimation (net.odd1.minig.animations.MovieClipAnimation)
package net.odd1.minig.animations {
import flash.display.*;
import net.odd1.minig.utils.*;
public final class MovieClipAnimation extends Animation {
public var recursive:Boolean;
public var mc:MovieClip;
public function MovieClipAnimation(_arg1:MovieClip, _arg2:Array, _arg3:int, _arg4:Boolean=true){
this.mc = _arg1;
this.fps = _arg3;
this.animationsData = _arg2;
this.recursive = _arg4;
super();
}
override public function setFrame(_arg1:int):void{
if (recursive){
MovieClipUtil.gotoAndStopNextFrame(mc, (_arg1 + 1));
} else {
mc.gotoAndStop((_arg1 + 1));
};
}
override public function destroyAnim():void{
mc = null;
}
}
}//package net.odd1.minig.animations
Section 180
//DataEvent (net.odd1.minig.events.DataEvent)
package net.odd1.minig.events {
import flash.events.*;
public final class DataEvent extends Event {
public static const LOAD_COMPLETE:String = "dataLoadComplete";
public static const LOCALE_COMPLETE:String = "localeComplete";
public function DataEvent(_arg1:String){
super(_arg1);
}
}
}//package net.odd1.minig.events
Section 181
//ScreenEvent (net.odd1.minig.events.ScreenEvent)
package net.odd1.minig.events {
import flash.events.*;
import net.odd1.minig.screens.*;
import net.odd1.minig.transitions.*;
public final class ScreenEvent extends Event {
public var transition:Transition;
public var nextScreen:IScreen;
public static const COMPLETE:String = "screenComplete";
public static const QUIT:String = "screenQuit";
public function ScreenEvent(_arg1:String, _arg2:IScreen=null, _arg3:Transition=null){
super(_arg1);
this.nextScreen = _arg2;
this.transition = _arg3;
}
}
}//package net.odd1.minig.events
Section 182
//TransitionEvent (net.odd1.minig.events.TransitionEvent)
package net.odd1.minig.events {
import flash.events.*;
public final class TransitionEvent extends Event {
public static const FINISH:String = "transitionFinish";
public function TransitionEvent(_arg1:String){
super(_arg1);
}
}
}//package net.odd1.minig.events
Section 183
//Factory (net.odd1.minig.factories.Factory)
package net.odd1.minig.factories {
import flash.events.*;
import net.odd1.minig.managers.*;
import flash.display.*;
import net.odd1.minig.transitions.*;
import net.odd1.minig.events.*;
import net.odd1.minig.global.*;
import com.mochibot.*;
import flash.utils.*;
import net.odd1.minig.ui.*;
import flash.text.*;
import flash.net.*;
import flash.ui.*;
import flash.system.*;
public class Factory extends MovieClip {
public const LOCALE_HIGH_QUALITY:String = "Q00";
private const ONE_SECOND:int = 1000;
private const MEGABYTES:Number = 0x100000;
public const LOCALE_MEDIUM_QUALITY:String = "Q01";
private const BORDER_WIDTH:int = 1000;
public const LOCALE_LOW_QUALITY:String = "Q02";
private const BORDER_COLOR:int = 0;
private const BACKGROUND_COLOR:int = 0;
private const TRANSITION_TIME:Number = 1;
private var lastTime:int;
private var preloader_completeHandler:Function;
private var preloaderURL:String;
private var screenManager:ScreenManager;
private var preloaderClass:Class;
private var className:String;
private var border:Shape;
public var paused:Boolean;
private var fpsCount:int;
private var mainClass:Object;
private var fpsTime:int;
private var notice:String;
public var debug:Debug;
private var frameRate:TextShadow;
private var fps:int;
public function Factory(_arg1:String, _arg2:Class, _arg3:Array, _arg4:Array, _arg5:Array, _arg6:Array, _arg7:Class, _arg8:String, _arg9:Class, _arg10:String, _arg11:String, _arg12:String, _arg13:int, _arg14:int, _arg15:Boolean=false, _arg16:Boolean=false, _arg17:Boolean=false, _arg18:Boolean=true, _arg19:Boolean=false, _arg20:Boolean=false){
var item:ContextMenuItem;
var sharedObject:SharedObject;
var sender:LocalConnection;
var text:TextField;
var className = _arg1;
var preloaderClass = _arg2;
var domains = _arg3;
var xmlLocale = _arg4;
var xmlLocaleByte = _arg5;
var xmlLocaleURL = _arg6;
var saveByte = _arg7;
var saveURL = _arg8;
var dataByte = _arg9;
var dataURL = _arg10;
var mochibot = _arg11;
var notice = _arg12;
var stageWidth = _arg13;
var stageHeight = _arg14;
var isDebugging = _arg15;
var isSkippingAds = _arg16;
var isSkippingTransitions = _arg17;
var isLoadingEmbedded = _arg18;
var isRenewSave = _arg19;
var isSkippingPreloader = _arg20;
super();
sender = new LocalConnection();
paused = false;
try {
if (mochibot != ""){
MochiBot.track(this, mochibot);
};
} catch(e:Error) {
};
if ((((domains.length == 0)) || (!((domains.indexOf(sender.domain) == -1))))){
addEventListener(Event.ADDED_TO_STAGE, addedToStagehandler);
Security.allowDomain("*");
this.notice = notice;
this.className = className;
this.preloaderClass = preloaderClass;
GlobalVariables.isDebugging = isDebugging;
GlobalVariables.isSkippingAds = isSkippingAds;
GlobalVariables.isSkippingTransitions = isSkippingTransitions;
GlobalVariables.isSkippingPreloader = isSkippingPreloader;
GlobalVariables.stageWidth = stageWidth;
GlobalVariables.stageHeight = stageHeight;
stop();
RessourceManager.getInstance().isLoadingEmbedded = isLoadingEmbedded;
LocaleManager.getInstance().addLocale(xmlLocale, xmlLocaleByte, xmlLocaleURL);
sharedObject = SharedObject.getLocal(className);
if ((((sharedObject.data.save == undefined)) || (isRenewSave))){
GlobalVariables.isFirstTime = true;
RessourceManager.getInstance().loadXML(saveByte, saveURL, save_completeHandler);
} else {
GlobalVariables.isFirstTime = false;
GlobalVariables.save = sharedObject.data.save;
LocaleManager.getInstance().setLocale(GlobalVariables.save.global.@locale, locale_completeHandler);
};
GlobalVariables.sharedObject = sharedObject;
RessourceManager.getInstance().loadXML(dataByte, dataURL, data_completeHandler);
if (isDebugging){
fpsCount = 0;
fpsTime = getTimer();
frameRate = new TextShadow(true, 16773103);
frameRate.visible = false;
};
Debug.getInstance().println("-----------");
Debug.getInstance().println("Minig Frameworks, by Jean-Denis Boivin");
Debug.getInstance().println("");
Debug.getInstance().println(("Build : " + Version.BUILD_NUMBER));
Debug.getInstance().println(("Date : " + Version.BUILD_TIME));
Debug.getInstance().println(("Author : " + Version.BUILD_AUTHOR));
Debug.getInstance().println("");
Debug.getInstance().println("-----------");
debug = Debug.getInstance();
if (isDebugging){
CheatManager.getInstance().addCheat("fps", toggleFrameRate);
CheatManager.getInstance().addCheat("save", outputSave);
};
CheatManager.getInstance().addCheat("credit", displayCredit);
CheatManager.getInstance().addCheat("debug", toggleConsole);
} else {
text = new TextField();
text.text = (("You cannot play this game on this domain : " + sender.domain) + " !");
text.width = (text.textWidth + 5);
text.selectable = false;
addChild(text);
};
}
private function mouseUpHandler(_arg1:MouseEvent):void{
if (!paused){
screenManager.mouseUp();
};
}
private function save_completeHandler(_arg1:XML):void{
GlobalVariables.save = _arg1;
if (_arg1){
LocaleManager.getInstance().setLocale(_arg1.global.@locale, locale_completeHandler);
} else {
locale_completeHandler();
};
checkLoaded();
}
private function keyUpHandler(_arg1:KeyboardEvent):void{
if (!paused){
CheatManager.getInstance().pressKey(_arg1.keyCode);
screenManager.keyPress(_arg1.keyCode, true);
};
}
private function enterFrameHandler(_arg1:Event):void{
var _local2:Class;
if (framesLoaded == totalFrames){
nextFrame();
_local2 = Class(getDefinitionByName(className));
if (_local2){
this.mainClass = new _local2(screenManager);
};
stage.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
};
}
private function highquality_menuItemSelectHandler(_arg1:ContextMenuEvent):void{
stage.quality = StageQuality.HIGH;
}
private function outputSave():void{
System.setClipboard(GlobalVariables.save.toString());
}
private function mediumquality_menuItemSelectHandler(_arg1:ContextMenuEvent):void{
stage.quality = StageQuality.MEDIUM;
}
private function lowquality_menuItemSelectHandler(_arg1:ContextMenuEvent):void{
stage.quality = StageQuality.LOW;
}
public function resume():void{
paused = false;
}
private function deactivateHandler(_arg1:Event):void{
if (!paused){
screenManager.deactivate();
};
}
private function data_completeHandler(_arg1:XML):void{
GlobalVariables.data = _arg1;
checkLoaded();
}
private function checkLoaded():void{
if (((((((((!(screenManager)) && (!((stage == null))))) && (GlobalVariables.data))) && (GlobalVariables.save))) && (LocaleManager.getInstance().isLoaded))){
screenManager = new ScreenManager(GlobalVariables.stageWidth, GlobalVariables.stageHeight);
addChildAt(screenManager, 0);
screenManager.loadScreen(new preloaderClass(), new Fadeout(TRANSITION_TIME));
lastTime = getTimer();
stage.addEventListener(Event.ENTER_FRAME, calculate_enterFrameHandler);
stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
stage.addEventListener(Event.DEACTIVATE, deactivateHandler);
};
}
private function addedToStagehandler(_arg1:Event):void{
var _local2:Graphics;
removeEventListener(Event.ADDED_TO_STAGE, addedToStagehandler);
stage.frameRate = 0xFFFF;
if (GlobalVariables.isDebugging){
frameRate.x = (GlobalVariables.stageWidth - 120);
frameRate.y = (GlobalVariables.stageHeight - 44);
addChild(frameRate);
addChild(Debug.getInstance().text);
};
stage.scaleMode = StageScaleMode.SHOW_ALL;
stage.quality = StageQuality.HIGH;
GlobalVariables.stage = stage;
border = new Shape();
_local2 = border.graphics;
_local2.beginFill(BORDER_COLOR);
_local2.drawRect(-(BORDER_WIDTH), -(BORDER_WIDTH), ((BORDER_WIDTH << 1) + GlobalVariables.stageWidth), BORDER_WIDTH);
_local2.drawRect(-(BORDER_WIDTH), GlobalVariables.stageHeight, ((BORDER_WIDTH << 1) + GlobalVariables.stageWidth), BORDER_WIDTH);
_local2.drawRect(-(BORDER_WIDTH), 0, BORDER_WIDTH, GlobalVariables.stageHeight);
_local2.drawRect(GlobalVariables.stageWidth, 0, BORDER_WIDTH, GlobalVariables.stageHeight);
_local2.endFill();
graphics.beginFill(BACKGROUND_COLOR);
graphics.drawRect(0, 0, GlobalVariables.stageWidth, GlobalVariables.stageHeight);
graphics.endFill();
addChild(border);
checkLoaded();
}
private function displayCredit():void{
if (!Debug.getInstance().text.visible){
Debug.getInstance().toggle();
};
Debug.getInstance().println("");
Debug.getInstance().println("//////******************************************///////");
Debug.getInstance().println("");
Debug.getInstance().println("Credit :");
Debug.getInstance().println("");
Debug.getInstance().println(" _|_| _| _| _| ");
Debug.getInstance().println("_| _| _|_|_| _|_|_| _|_| ");
Debug.getInstance().println("_| _| _| _| _| _| _| ");
Debug.getInstance().println("_| _| _| _| _| _| _| ");
Debug.getInstance().println(" _|_| _|_|_| _|_|_| _| ");
Debug.getInstance().println("");
Debug.getInstance().println(notice);
Debug.getInstance().println("");
Debug.getInstance().println("//////******************************************///////");
Debug.getInstance().println("");
}
private function toggleConsole():void{
Debug.getInstance().toggle();
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (!paused){
screenManager.keyPress(_arg1.keyCode, false);
};
}
private function mouseDownHandler(_arg1:MouseEvent):void{
if (!paused){
screenManager.mouseDown();
};
}
private function locale_completeHandler():void{
var _local1:ContextMenuItem;
var _local2:ContextMenu;
_local2 = new ContextMenu();
_local2.hideBuiltInItems();
_local1 = new ContextMenuItem(LocaleManager.getInstance().getLocale(LOCALE_HIGH_QUALITY), true);
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, highquality_menuItemSelectHandler);
_local2.customItems.push(_local1);
_local1 = new ContextMenuItem(LocaleManager.getInstance().getLocale(LOCALE_MEDIUM_QUALITY));
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, mediumquality_menuItemSelectHandler);
_local2.customItems.push(_local1);
_local1 = new ContextMenuItem(LocaleManager.getInstance().getLocale(LOCALE_LOW_QUALITY));
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, lowquality_menuItemSelectHandler);
_local2.customItems.push(_local1);
contextMenu = _local2;
GlobalVariables.contextMenu = contextMenu;
dispatchEvent(new DataEvent(DataEvent.LOCALE_COMPLETE));
checkLoaded();
}
public function pause():void{
paused = true;
}
private function toggleFrameRate():void{
frameRate.visible = !(frameRate.visible);
}
private function calculate_enterFrameHandler(_arg1:Event):void{
var _local2:int;
var _local3:Number;
var _local4:int;
_local2 = getTimer();
_local3 = ((_local2 - lastTime) / ONE_SECOND);
lastTime = _local2;
if (!paused){
screenManager.render((_local3 * GlobalVariables.timeScale));
SoundManager.getInstance().render(_local3);
};
if (GlobalVariables.isDebugging){
_local4 = getTimer();
fpsCount++;
if ((_local4 - fpsTime) > ONE_SECOND){
fps = fpsCount;
fpsCount = 0;
fpsTime = _local4;
};
frameRate.text = (((((((("FPS : " + fps) + "\n") + "Memory : ") + (System.totalMemory / MEGABYTES).toFixed(2)) + " MB\n") + "Code : ") + (_local4 - _local2)) + " ms");
};
}
}
}//package net.odd1.minig.factories
Section 184
//Debug (net.odd1.minig.global.Debug)
package net.odd1.minig.global {
import net.odd1.minig.ui.*;
public final class Debug {
public var string:String;
public var text:TextShadow;
private static var _instance:Debug = new (Debug);
;
public function Debug(){
if (_instance){
throw (new Error("Singleton can only be accessed through Singleton.getInstance()"));
};
string = "";
text = new TextShadow(true);
text.visible = false;
}
public function toggle():void{
text.visible = !(text.visible);
if (text.visible){
updateText();
};
}
public function updateText():void{
text.text = string;
text.setHeight(GlobalVariables.stageHeight);
text.scrollMax();
}
public function println(_arg1:String):void{
if (GlobalVariables.isDebugging){
string = (string + (_arg1 + "\n"));
if (text.visible){
updateText();
};
};
}
public static function getInstance():Debug{
return (_instance);
}
}
}//package net.odd1.minig.global
Section 185
//GlobalVariables (net.odd1.minig.global.GlobalVariables)
package net.odd1.minig.global {
import flash.display.*;
import flash.net.*;
import flash.ui.*;
public final class GlobalVariables {
public static var isSkippingTransitions:Boolean = false;
public static var sharedObject:SharedObject;
public static var stageHeight:int;
public static var timeScale:Number = 1;
public static var stage:Stage;
public static var isFirstTime:Boolean = false;
public static var gameName:String;
public static var isDebugging:Boolean = false;
public static var stageWidth:int;
public static var data:XML;
public static var contextMenu:ContextMenu;
public static var isSkippingAds:Boolean = false;
public static var isSkippingPreloader:Boolean = false;
public static var save:XML;
public static var nextScreen:Class;
}
}//package net.odd1.minig.global
Section 186
//Version (net.odd1.minig.global.Version)
package net.odd1.minig.global {
public final class Version {
public static var BUILD_AUTHOR:String = "jdboivin";
public static var BUILD_NUMBER:String = "1604";
public static var BUILD_TIME:String = "23.06.2009 18:03";
}
}//package net.odd1.minig.global
Section 187
//AnimationManager (net.odd1.minig.managers.AnimationManager)
package net.odd1.minig.managers {
import flash.display.*;
import net.odd1.minig.animations.*;
import net.odd1.minig.utils.*;
public class AnimationManager {
private var m_paused:Boolean;
private var m_animations:Array;
private static var s_instance:AnimationManager = new (AnimationManager);
;
public function AnimationManager(){
if (s_instance){
throw (new Error("Singleton can only be accessed through Singleton.getInstance()"));
};
m_animations = new Array();
m_paused = false;
}
public function render(_arg1:Number):void{
var _local2:MovieClipAnimation;
if (!m_paused){
for each (_local2 in m_animations) {
_local2.render(_arg1);
};
};
}
public function isPaused():Boolean{
return (m_paused);
}
public function togglePause():void{
m_paused = !(m_paused);
}
public function addAnimation(_arg1:MovieClip, _arg2:int=30, _arg3:Boolean=true):MovieClipAnimation{
var _local4:MovieClipAnimation;
_local4 = new MovieClipAnimation(_arg1, MovieClipUtil.getAnimationData(_arg1), _arg2, _arg3);
m_animations.push(_local4);
_local4.playLabel("");
_local4.stopAnim();
return (_local4);
}
public function clear():void{
var _local1:int;
_local1 = m_animations.length;
while (_local1 > 0) {
removeAnimation(m_animations[0]);
_local1--;
};
}
public function removeAnimation(_arg1:MovieClipAnimation):void{
_arg1.destroy();
ArrayUtil.removeElement(m_animations, _arg1);
}
public static function getInstance():AnimationManager{
return (s_instance);
}
}
}//package net.odd1.minig.managers
Section 188
//ButtonManager (net.odd1.minig.managers.ButtonManager)
package net.odd1.minig.managers {
import flash.events.*;
import flash.display.*;
import flash.media.*;
public final class ButtonManager {
private const SOUNDOVER:int = 2;
private const STATE_MOUSEOVER:int = 1;
private const SOUNDDOWN:int = 3;
private const LABEL_MOUSEOUT:String = "out";
private const STATE_MOUSEOUT:int = 0;
private const STATE_MOUSEDOWN:int = 2;
private const SOUNDOUT:int = 4;
private const SOUNDCLICK:int = 1;
private const LABEL_MOUSEOVER:String = "over";
private const LABEL_MOUSEDOWN:String = "down";
private var infos:Array;
private var states:Array;
private var buttons:Array;
private var currentButton:MovieClip;
public var isClicking:Boolean;
private static const LISTENER:int = 0;
private static var _instance:ButtonManager = new (ButtonManager);
;
public function ButtonManager(){
if (_instance){
throw (new Error("Singleton can only be accessed through Singleton.getInstance()"));
};
buttons = new Array();
infos = new Array();
states = new Array();
isClicking = false;
}
private function changeState(_arg1:MovieClip, _arg2:String):void{
_arg1.gotoAndStop(_arg2);
}
public function updateLocale(_arg1:Event=null):void{
var _local2:MovieClip;
for each (_local2 in buttons) {
LocaleManager.getInstance().setMovieClip(_local2);
};
}
public function clear():void{
while (buttons.length != 0) {
removeButton(buttons[0]);
};
}
public function removeButton(_arg1:MovieClip):void{
var _local2:int;
_local2 = buttons.indexOf(_arg1);
if (_local2 != -1){
_arg1.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
_arg1.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
_arg1.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
_arg1.removeEventListener(MouseEvent.CLICK, clickHandler);
buttons.splice(_local2, 1);
states.splice(_local2, 1);
infos.splice(_local2, 1);
_arg1.buttonMode = false;
_arg1.useHandCursor = false;
_arg1.mouseEnabled = false;
_arg1.mouseChildren = false;
};
}
private function mouseOutHandler(_arg1:MouseEvent):void{
var _local2:MovieClip;
var _local3:int;
_local2 = (_arg1.currentTarget as MovieClip);
_local3 = buttons.indexOf(_local2);
if (_local3 != -1){
if (states[_local3] != STATE_MOUSEOUT){
states[_local3] = STATE_MOUSEOUT;
changeState(_local2, LABEL_MOUSEOUT);
};
if (infos[_local3][SOUNDOUT]){
SoundManager.getInstance().playSound(infos[_local3][SOUNDOUT]);
};
};
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:MovieClip;
var _local3:int;
_local2 = (_arg1.currentTarget as MovieClip);
_local3 = buttons.indexOf(_local2);
isClicking = true;
if (_local3 != -1){
if (states[_local3] != STATE_MOUSEDOWN){
states[_local3] = STATE_MOUSEDOWN;
changeState(_local2, LABEL_MOUSEDOWN);
};
if (infos[_local3][SOUNDDOWN]){
SoundManager.getInstance().playSound(infos[_local3][SOUNDDOWN]);
};
};
}
private function clickHandler(_arg1:MouseEvent):void{
var _local2:MovieClip;
var _local3:int;
_local2 = (_arg1.currentTarget as MovieClip);
_local3 = buttons.indexOf(_local2);
if (((!((_local3 == -1))) && (infos[_local3][SOUNDCLICK]))){
SoundManager.getInstance().playSound(infos[_local3][SOUNDCLICK]);
};
if (infos[_local3][LISTENER]){
var _local4 = infos[_local3];
_local4[LISTENER](_arg1);
};
}
private function mouseOverHandler(_arg1:MouseEvent):void{
var _local2:MovieClip;
var _local3:int;
_local2 = (_arg1.currentTarget as MovieClip);
_local3 = buttons.indexOf(_local2);
if (_local3 != -1){
if (((_arg1.buttonDown) && (!((states[_local3] == STATE_MOUSEDOWN))))){
states[_local3] = STATE_MOUSEDOWN;
changeState(_local2, LABEL_MOUSEDOWN);
} else {
if (states[_local3] != STATE_MOUSEOVER){
states[_local3] = STATE_MOUSEOVER;
changeState(_local2, LABEL_MOUSEOVER);
};
};
if (infos[_local3][SOUNDOVER]){
SoundManager.getInstance().playSound(infos[_local3][SOUNDOVER]);
};
};
}
public function addButton(_arg1:MovieClip, _arg2:Function, _arg3:Sound=null, _arg4:Sound=null, _arg5:Sound=null, _arg6:Sound=null):void{
buttons.push(_arg1);
infos.push([_arg2, _arg3, _arg4, _arg5, _arg6]);
states.push(STATE_MOUSEOUT);
_arg1.gotoAndStop(LABEL_MOUSEOUT);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
_arg1.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
_arg1.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
_arg1.addEventListener(MouseEvent.CLICK, clickHandler);
_arg1.buttonMode = true;
_arg1.useHandCursor = true;
_arg1.mouseEnabled = true;
_arg1.mouseChildren = true;
}
public static function getInstance():ButtonManager{
return (_instance);
}
}
}//package net.odd1.minig.managers
Section 189
//CheatManager (net.odd1.minig.managers.CheatManager)
package net.odd1.minig.managers {
import net.odd1.minig.global.*;
public final class CheatManager {
private const CHEAT_POS:int = 0;
private const HANDLER_POS:int = 1;
private var cheats:Array;
private var positions:Array;
private static var _instance:CheatManager = new (CheatManager);
;
public function CheatManager(){
if (_instance){
throw (new Error("Singleton can only be accessed through Singleton.getInstance()"));
};
cheats = [];
positions = [];
}
public function addCheat(_arg1:String, _arg2:Function):void{
cheats.push([_arg1.toUpperCase(), _arg2]);
positions.push(0);
Debug.getInstance().println(("Added cheat : " + _arg1));
}
public function removeCheat(_arg1:String):void{
var _local2:int;
var _local3:Boolean;
var _local4:int;
_arg1 = _arg1.toUpperCase();
_local3 = false;
_local4 = cheats.length;
_local2 = 0;
while (_local2 < _local4) {
if (cheats[_local2][CHEAT_POS] == _arg1){
_local3 = true;
break;
};
_local2++;
};
if (_local3){
cheats.splice(_local2, 1);
positions.splice(_local2, 1);
Debug.getInstance().println(("Removed cheat : " + _arg1));
};
}
public function pressKey(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:Array;
for each (_local5 in cheats) {
_local2 = cheats.indexOf(_local5);
_local4 = _local5[CHEAT_POS];
if (_local4.charCodeAt(positions[_local2]) == _arg1){
var _local8 = positions;
var _local9 = _local2;
var _local10 = (_local8[_local9] + 1);
_local8[_local9] = _local10;
if (_local10 == _local4.length){
Debug.getInstance().println(("Cheat Activated : " + _local4));
positions[_local2] = 0;
_local8 = _local5;
_local8[HANDLER_POS]();
};
} else {
positions[_local2] = 0;
};
};
}
public static function getInstance():CheatManager{
return (_instance);
}
}
}//package net.odd1.minig.managers
Section 190
//LocaleManager (net.odd1.minig.managers.LocaleManager)
package net.odd1.minig.managers {
import flash.display.*;
import flash.text.*;
public final class LocaleManager {
private const OPEN_TAG:String = "<";
private const CLOSE_TAG:String = ">";
private var localeByte:Array;
private var localeName:Array;
public var isLoaded:Boolean;
private var localeXML:XML;
private var localeIndex:int;
private var currentCompleteHandler:Function;
public var currentLocale:String;
private var localeURL:Array;
public static const FONT_SUFFIX:String = "_Embed";
private static var _instance:LocaleManager = new (LocaleManager);
;
public function LocaleManager(){
if (_instance){
throw (new Error("Singleton can only be accessed through Singleton.getInstance()"));
};
localeIndex = -1;
isLoaded = false;
}
public function getLocale(_arg1:String):String{
var id = _arg1;
if (((!((localeIndex == -1))) && (localeXML))){
return (localeXML.strings.string.(@id == id).@value);
//unresolved jump
};
return ("");
}
public function get xml():XML{
return (localeXML);
}
private function completeHandler(_arg1:XML):void{
localeXML = _arg1;
isLoaded = true;
currentCompleteHandler();
}
private function checkContainer(_arg1:DisplayObjectContainer):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:TextField;
var _local5:TextFormat;
_local2 = 0;
while (_local2 < _arg1.numChildren) {
_local3 = _arg1.getChildAt(_local2);
if ((_local3 is TextField)){
_local4 = (_local3 as TextField);
if (_local4.type == TextFieldType.DYNAMIC){
_local4.mouseEnabled = false;
if ((((_local4.text.charAt(0) == OPEN_TAG)) && ((_local4.text.charAt((_local4.text.length - 1)) == CLOSE_TAG)))){
_local4.text = getLocale(_local4.text.substr(1, (_local4.text.length - 2)));
};
};
_local4.embedFonts = true;
_local5 = _local4.getTextFormat();
if (_local5.font){
_local5.font = (_local5.font.toLowerCase() + FONT_SUFFIX);
};
_local4.setTextFormat(_local5);
_local4.defaultTextFormat = _local5;
} else {
if ((_local3 is DisplayObjectContainer)){
checkContainer((_local3 as DisplayObjectContainer));
};
};
_local2++;
};
}
public function addLocale(_arg1:Array, _arg2:Array, _arg3:Array):void{
this.localeName = _arg1;
this.localeByte = _arg2;
this.localeURL = _arg3;
}
public function setLocale(_arg1:String, _arg2:Function):void{
localeIndex = localeName.indexOf(_arg1);
if (localeIndex != -1){
currentLocale = _arg1;
currentCompleteHandler = _arg2;
isLoaded = false;
RessourceManager.getInstance().loadXML(localeByte[localeIndex], localeURL[localeIndex], this.completeHandler);
};
}
public function setMovieClip(_arg1:MovieClip):void{
if (isLoaded){
checkContainer(_arg1);
};
}
public static function getInstance():LocaleManager{
return (_instance);
}
}
}//package net.odd1.minig.managers
Section 191
//RessourceManager (net.odd1.minig.managers.RessourceManager)
package net.odd1.minig.managers {
import flash.events.*;
import flash.display.*;
import net.odd1.minig.utils.*;
import flash.net.*;
public final class RessourceManager {
private const POS_URL:int = 2;
private const POS_TYPE:int = 0;
private const POS_BYTE:int = 1;
private const POS_HANDLER:int = 3;
private var queue:Array;
public var isLoadingEmbedded:Boolean;// = true
private var _force:Boolean;// = false
private var loaders:Array;
public static const RESSOURCE_XML:int = 1;
public static const RESSOURCE_SWF:int = 0;
private static var _instance:RessourceManager = new (RessourceManager);
;
public function RessourceManager(){
if (_instance){
throw (new Error("Singleton can only be accessed through Singleton.getInstance()"));
};
queue = [];
loaders = [];
}
private function XMLCompleteHandler(_arg1:Event):void{
var _local2:URLLoader;
_local2 = (_arg1.currentTarget as URLLoader);
var _local3 = queue[0];
_local3[POS_HANDLER](new XML(_local2.data));
_local2.removeEventListener(Event.COMPLETE, XMLCompleteHandler);
ArrayUtil.removeElement(loaders, _local2);
checkNextItem();
}
private function checkNextItem():void{
queue.shift();
if (queue.length != 0){
_force = true;
loadRessource(queue[0]);
};
}
private function SWFCompleteHandler(_arg1:Event):void{
var _local2:LoaderInfo;
var _local3:MovieClip;
_local2 = (_arg1.currentTarget as LoaderInfo);
_local3 = (_local2.content as MovieClip);
var _local4 = queue[0];
_local4[POS_HANDLER](_local3);
LocaleManager.getInstance().setMovieClip(_local3);
_local2.removeEventListener(Event.COMPLETE, SWFCompleteHandler);
ArrayUtil.removeElement(loaders, _local2.loader);
checkNextItem();
}
public function loadXML(_arg1:Class, _arg2:String, _arg3:Function):void{
var _local4:URLLoader;
if (((_arg1) || (!((_arg2 == ""))))){
if (((((isLoadingEmbedded) && (_arg1))) || ((_arg2 == "")))){
_arg3(new XML(new (_arg1)));
} else {
if (!_force){
queue.push([RESSOURCE_XML, _arg1, _arg2, _arg3]);
};
if ((((((queue.length == 1)) || (_force))) && (!((_arg2 == ""))))){
_force = false;
_local4 = new URLLoader(new URLRequest(_arg2));
_local4.addEventListener(Event.COMPLETE, XMLCompleteHandler);
loaders.push(_local4);
};
};
} else {
_arg3(null);
};
}
private function loadRessource(_arg1:Array):void{
switch (_arg1[POS_TYPE]){
case RESSOURCE_SWF:
loadSWF(_arg1[POS_BYTE], _arg1[POS_URL], _arg1[POS_HANDLER]);
break;
case RESSOURCE_XML:
loadXML(_arg1[POS_BYTE], _arg1[POS_URL], _arg1[POS_HANDLER]);
break;
default:
throw (new Error("Invalid ressource type"));
};
}
public function loadSWF(_arg1:Class, _arg2:String, _arg3:Function):void{
var _local4:MovieClip;
var _local5:Loader;
if (((_arg1) || (!((_arg2 == ""))))){
if (!_force){
queue.push([RESSOURCE_SWF, _arg1, _arg2, _arg3]);
};
if ((((queue.length == 1)) || (_force))){
_force = false;
if (((((isLoadingEmbedded) && (_arg1))) || ((_arg2 == "")))){
_local4 = new (_arg1);
_local5 = (_local4.getChildAt(0) as Loader);
} else {
_local5 = new Loader();
_local5.load(new URLRequest(_arg2));
};
_local5.contentLoaderInfo.addEventListener(Event.COMPLETE, SWFCompleteHandler);
loaders.push(_local5);
};
} else {
_arg3(null);
};
}
public static function getInstance():RessourceManager{
return (_instance);
}
}
}//package net.odd1.minig.managers
Section 192
//ScreenManager (net.odd1.minig.managers.ScreenManager)
package net.odd1.minig.managers {
import flash.display.*;
import net.odd1.minig.screens.*;
import net.odd1.minig.transitions.*;
import net.odd1.minig.events.*;
import net.odd1.minig.global.*;
import flash.utils.*;
import flash.system.*;
public class ScreenManager extends Sprite {
public var stageHeight:int;
public var stageWidth:int;
public var screen:IScreen;
private var transitionManager:TransitionManager;
public function ScreenManager(_arg1:int, _arg2:int){
this.stageWidth = _arg1;
this.stageHeight = _arg2;
transitionManager = new TransitionManager(this);
addChild(transitionManager);
}
public function mouseUp():void{
ButtonManager.getInstance().isClicking = false;
if (Screen(screen).isLoaded){
screen.mouseUp();
};
}
public function keyPress(_arg1:int, _arg2:Boolean):void{
if (Screen(screen).isLoaded){
screen.keyPress(_arg1, _arg2);
};
}
public function mouseDown():void{
if (((Screen(screen).isLoaded) && (!(ButtonManager.getInstance().isClicking)))){
screen.mouseDown();
};
}
public function loadScreen(_arg1:IScreen, _arg2:Transition=null):void{
var newScreen = _arg1;
var transition = _arg2;
Debug.getInstance().println("");
Debug.getInstance().println(("Loading screen : " + getQualifiedClassName(newScreen)));
Debug.getInstance().println("");
if (screen){
if (((!(GlobalVariables.isSkippingTransitions)) && (transition))){
transitionManager.loadTransition((screen as IBitmapDrawable), transition);
};
screen.destroy();
Screen(screen).destroyContent();
removeChild((screen as Screen));
try {
System.gc();
} catch(e:Error) {
};
} else {
if (((!(GlobalVariables.isSkippingTransitions)) && (stage))){
transitionManager.loadTransition((stage.getChildAt(0) as IBitmapDrawable), transition);
};
};
screen = newScreen;
addChildAt((screen as Screen), 0);
if (transition){
transition.screen = (screen as Screen);
};
if (AnimationManager.getInstance().isPaused()){
AnimationManager.getInstance().togglePause();
};
screen.addEventListener(ScreenEvent.QUIT, quitHandler);
stage.focus = stage;
screen.init();
}
public function deactivate():void{
if (Screen(screen).isLoaded){
screen.deactivate();
};
}
public function render(_arg1:Number):void{
if (Screen(screen).destroyEvent){
loadScreen(Screen(screen).destroyEvent.nextScreen, Screen(screen).destroyEvent.transition);
} else {
if (Screen(screen).isLoaded){
screen.render(_arg1);
};
transitionManager.render(_arg1);
AnimationManager.getInstance().render(_arg1);
};
}
public function reload():void{
if (Screen(screen).isLoaded){
screen.reload();
};
}
private function quitHandler(_arg1:ScreenEvent):void{
screen.removeEventListener(ScreenEvent.QUIT, quitHandler);
Screen(screen).destroyEvent = _arg1;
}
}
}//package net.odd1.minig.managers
Section 193
//SoundManager (net.odd1.minig.managers.SoundManager)
package net.odd1.minig.managers {
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.utils.*;
public final class SoundManager {
private const VOLUME_POS:int = 1;
private const POINT_POS:int = 0;
public var isMuteMusic:Boolean;
private var _speakerOrigin:Point;
public var soundVolume:Number;
private var _3DSoundsKey:Array;
private var song:SoundChannel;
private var newVolume:Number;
private var newSong:SoundChannel;
private var _3DSounds:Array;
private var _sounds:Array;
public var isMuteSound:Boolean;
private var _3DInfo:Array;
private var lastSong:Sound;
private var isMute:Boolean;
private var _soundsKey:Array;
private var _maxDistance:Number;
private static var _instance:SoundManager = new (SoundManager);
;
public function SoundManager(){
if (_instance){
throw (new Error("Singleton can only be accessed through Singleton.getInstance()"));
};
isMute = false;
isMuteSound = false;
isMuteMusic = false;
song = null;
newSong = null;
_3DSounds = new Array();
_3DSoundsKey = new Array();
_3DInfo = new Array();
_sounds = new Array();
_soundsKey = new Array();
soundVolume = 1;
}
public function stopMusic():void{
if (song){
song.stop();
};
if (newSong){
newSong.stop();
};
}
public function muteMusic():void{
isMuteMusic = !(isMuteMusic);
if (((!(isMuteMusic)) && (lastSong))){
playSong(lastSong, 1, true, true);
} else {
if (song){
song.stop();
} else {
if (newSong){
newSong.stop();
};
};
};
}
private function _3D_soundCompleteHandler(_arg1:Event):void{
var _local2:SoundChannel;
var _local3:int;
_local2 = (_arg1.currentTarget as SoundChannel);
_local3 = _3DSounds.indexOf(_local2);
_local2.removeEventListener(Event.SOUND_COMPLETE, _3D_soundCompleteHandler);
_3DInfo.splice(_local3, 1);
_3DSounds.splice(_local3, 1);
_3DSoundsKey.splice(_local3, 1);
}
public function render(_arg1:Number):void{
var _local2:SoundTransform;
var _local3:int;
var _local4:int;
if (!isMute){
if (newSong){
if (song){
_local2 = song.soundTransform;
_local2.volume = (_local2.volume - (0.75 * _arg1));
song.soundTransform = _local2;
if (_local2.volume <= 0){
song.stop();
song = null;
};
};
if (newSong){
_local2 = newSong.soundTransform;
_local2.volume = (_local2.volume + ((0.75 * newVolume) * _arg1));
newSong.soundTransform = _local2;
if (_local2.volume >= newVolume){
_local2.volume = newVolume;
newSong.soundTransform = _local2;
song = newSong;
newSong = null;
};
};
};
};
}
private function _sound_soundCompleteHandler(_arg1:Event):void{
var _local2:SoundChannel;
var _local3:int;
_local2 = (_arg1.currentTarget as SoundChannel);
_local3 = _sounds.indexOf(_local2);
_local2.removeEventListener(Event.SOUND_COMPLETE, _sound_soundCompleteHandler);
_sounds.splice(_local3, 1);
_soundsKey.splice(_local3, 1);
}
public function mute():Boolean{
isMute = !(isMute);
if (isMute){
SoundMixer.soundTransform = new SoundTransform(0);
} else {
SoundMixer.soundTransform = new SoundTransform(1);
};
return (isMute);
}
public function playSong(_arg1:Sound, _arg2:Number=1, _arg3:Boolean=true, _arg4:Boolean=false):void{
var _local5:SoundTransform;
if (((!(isMuteMusic)) && (((_arg4) || (!((getQualifiedClassName(_arg1) == getQualifiedClassName(lastSong)))))))){
lastSong = _arg1;
if (newSong){
newSong.stop();
};
newVolume = _arg2;
if (_arg3){
newSong = _arg1.play(0, 9999);
} else {
newSong = _arg1.play(0, 0);
};
_local5 = newSong.soundTransform;
_local5.volume = 0;
newSong.soundTransform = _local5;
};
}
public function play3DSound(_arg1:Sound, _arg2:Point, _arg3:int=0, _arg4:Number=1, _arg5:Boolean=false):void{
var _local6:SoundTransform;
var _local7:SoundChannel;
var _local8:int;
var _local9:String;
_arg4 = (_arg4 * soundVolume);
if (!isMuteSound){
_local9 = getQualifiedClassName(_arg1);
_local8 = _3DSoundsKey.indexOf(_local9);
if (_arg5){
_local8 = -1;
};
if (_local8 != -1){
_local7 = _3DSounds[_local8];
_local7.removeEventListener(Event.SOUND_COMPLETE, _3D_soundCompleteHandler);
_local7.stop();
};
_local6 = new SoundTransform(0, 0);
_local7 = _arg1.play(_arg3, 0, _local6);
if (_local7){
_local7.addEventListener(Event.SOUND_COMPLETE, _3D_soundCompleteHandler);
if (_local8 == -1){
_3DInfo.push([_arg2, _arg4]);
_local8 = (_3DSounds.push(_local7) - 1);
_3DSoundsKey.push(_local9);
} else {
_3DInfo[_local8] = [_arg2, _arg4];
_3DSounds[_local8] = _local7;
};
adjust3DSound(_local8);
} else {
if (_local8 != -1){
_3DInfo.splice(_local8, 1);
_3DSounds.splice(_local8, 1);
_3DSoundsKey.splice(_local8, 1);
};
};
};
}
public function adjust3DSound(_arg1:int):void{
var _local2:SoundChannel;
var _local3:SoundTransform;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Point;
_local2 = _3DSounds[_arg1];
_local3 = _local2.soundTransform;
_local7 = _3DInfo[_arg1][POINT_POS];
_local4 = Point.distance(_speakerOrigin, _local7);
if (_local4 < _maxDistance){
_local5 = (Math.atan2((_local7.x - _speakerOrigin.x), (_local7.y - _speakerOrigin.y)) - (Math.PI / 2));
if (_local5 < 0){
_local5 = (_local5 + (Math.PI * 2));
};
if (_local5 < (Math.PI / 2)){
_local6 = (((Math.PI / 2) - _local5) / (Math.PI / 2));
} else {
if (_local5 < Math.PI){
_local6 = ((_local5 - (Math.PI / 2)) / -((Math.PI / 2)));
} else {
if (_local5 < ((Math.PI * 3) / 2)){
_local6 = (((Math.PI / 2) - (_local5 - Math.PI)) / -((Math.PI / 2)));
} else {
_local6 = ((_local5 - ((Math.PI * 3) / 2)) / (Math.PI / 2));
};
};
};
_local3.volume = ((((_maxDistance - _local4) / _maxDistance) * _3DInfo[_arg1][VOLUME_POS]) * soundVolume);
_local3.pan = _local6;
} else {
_local3.volume = 0;
_local3.pan = 0;
};
_local2.soundTransform = _local3;
}
public function muteSound():void{
isMuteSound = !(isMuteSound);
}
public function playSound(_arg1:Sound, _arg2:int=0, _arg3:Boolean=false, _arg4:Number=1, _arg5:Number=0, _arg6:Boolean=false):void{
var _local7:SoundTransform;
var _local8:SoundChannel;
var _local9:int;
var _local10:String;
_arg4 = (_arg4 * soundVolume);
if (!isMuteSound){
_local10 = getQualifiedClassName(_arg1);
_local9 = _soundsKey.indexOf(_local10);
if (!_arg6){
if (_local9 != -1){
_local8 = _sounds[_local9];
_local8.removeEventListener(Event.SOUND_COMPLETE, _sound_soundCompleteHandler);
_local8.stop();
};
};
if (((!(_arg6)) || ((_local9 == -1)))){
if (_arg3){
_local7 = new SoundTransform((((Math.random() * 0.5) + 0.5) * _arg4), ((Math.random() * 2) - 1));
} else {
_local7 = new SoundTransform(_arg4, _arg5);
};
_local8 = _arg1.play(_arg2, 0, _local7);
if (_local8){
if (_local9 == -1){
_sounds.push(_local8);
_soundsKey.push(_local10);
} else {
_sounds[_local9] = _local8;
};
_local8.addEventListener(Event.SOUND_COMPLETE, _sound_soundCompleteHandler);
} else {
if (_local9 != -1){
_sounds.splice(_local9, 1);
_soundsKey.splice(_local9, 1);
};
};
};
};
}
public function set3DSound(_arg1:Point, _arg2:Number=-1):void{
_speakerOrigin = _arg1;
if (_arg2 != -1){
_maxDistance = _arg2;
};
}
public static function getInstance():SoundManager{
return (_instance);
}
}
}//package net.odd1.minig.managers
Section 194
//TransitionManager (net.odd1.minig.managers.TransitionManager)
package net.odd1.minig.managers {
import flash.display.*;
import net.odd1.minig.transitions.*;
import net.odd1.minig.events.*;
import net.odd1.minig.utils.*;
public final class TransitionManager extends Sprite {
private const WAIT:int = 2;
private var screenManager:ScreenManager;
private var transitions:Array;
public function TransitionManager(_arg1:ScreenManager){
this.screenManager = _arg1;
transitions = [];
mouseEnabled = false;
mouseChildren = false;
}
public function render(_arg1:Number):void{
var _local2:Transition;
for each (_local2 in transitions) {
if (((((!(_local2.screen)) || (_local2.screen.isLoaded))) && ((_local2.wait++ > WAIT)))){
ITransition(_local2).render(_arg1);
};
};
}
private function finishHandler(_arg1:TransitionEvent):void{
var _local2:Transition;
_local2 = (_arg1.currentTarget as Transition);
(_local2 as ITransition).destroy();
ArrayUtil.removeElement(transitions, _local2);
removeChild(_local2);
_local2.removeEventListener(TransitionEvent.FINISH, finishHandler);
}
public function loadTransition(_arg1:IBitmapDrawable, _arg2:Transition):void{
_arg2.setScreen(_arg1, screenManager.stageWidth, screenManager.stageHeight);
transitions.push(_arg2);
addChildAt(_arg2, 0);
_arg2.addEventListener(TransitionEvent.FINISH, finishHandler);
}
}
}//package net.odd1.minig.managers
Section 195
//IScreen (net.odd1.minig.screens.IScreen)
package net.odd1.minig.screens {
import flash.events.*;
public interface IScreen extends IEventDispatcher {
function init():void;
function keyPress(_arg1:int, _arg2:Boolean):void;
function render(_arg1:Number):void;
function mouseDown():void;
function reload():void;
function destroy():void;
function deactivate():void;
function mouseUp():void;
}
}//package net.odd1.minig.screens
Section 196
//Screen (net.odd1.minig.screens.Screen)
package net.odd1.minig.screens {
import flash.events.*;
import net.odd1.minig.managers.*;
import flash.display.*;
import net.odd1.minig.events.*;
public class Screen extends Sprite {
private const DEFAULT_FRAMERATE:int = 0xFFFF;
private const BACKGROUND_COLOR:int = 0;
public var content:MovieClip;
private var frameRate:int;
public var isLoaded:Boolean;
private var completeHandler:Function;
public var destroyEvent:ScreenEvent;
public function Screen(){
this.addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
isLoaded = false;
destroyEvent = null;
frameRate = DEFAULT_FRAMERATE;
}
private function addedToStageHandler(_arg1:Event):void{
stage.frameRate = frameRate;
graphics.beginFill(BACKGROUND_COLOR);
graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
graphics.endFill();
}
private function loadSWF_completeHandler(_arg1:MovieClip):void{
isLoaded = true;
this.content = _arg1;
addChild(_arg1.loaderInfo.loader);
frameRate = _arg1.loaderInfo.frameRate;
if (stage){
stage.frameRate = frameRate;
};
if (completeHandler != null){
completeHandler();
};
}
public function loadSWF(_arg1:Class, _arg2:String, _arg3:Function=null):void{
this.completeHandler = _arg3;
RessourceManager.getInstance().loadSWF(_arg1, _arg2, loadSWF_completeHandler);
}
public function destroyContent():void{
if (content){
removeChild(content.loaderInfo.loader);
try {
content.loaderInfo.loader.unload();
} catch(e:Error) {
};
};
content = null;
completeHandler = null;
}
}
}//package net.odd1.minig.screens
Section 197
//Fadeout (net.odd1.minig.transitions.Fadeout)
package net.odd1.minig.transitions {
import net.odd1.minig.events.*;
public final class Fadeout extends Transition implements ITransition {
private var alphaDelta:Number;
public function Fadeout(_arg1:Number){
super(null);
alpha = 1;
alphaDelta = (1 / _arg1);
}
public function destroy():void{
alphaDelta = -1;
dispose();
}
public function render(_arg1:Number):void{
alpha = (alpha - (alphaDelta * _arg1));
if (alpha <= 0){
alpha = 0;
dispatchEvent(new TransitionEvent(TransitionEvent.FINISH));
};
}
}
}//package net.odd1.minig.transitions
Section 198
//ITransition (net.odd1.minig.transitions.ITransition)
package net.odd1.minig.transitions {
import flash.events.*;
public interface ITransition extends IEventDispatcher {
function destroy():void;
function render(_arg1:Number):void;
}
}//package net.odd1.minig.transitions
Section 199
//Transition (net.odd1.minig.transitions.Transition)
package net.odd1.minig.transitions {
import net.odd1.minig.managers.*;
import flash.display.*;
import net.odd1.minig.screens.*;
public class Transition extends Bitmap {
private const DEFAULT_COLOR:uint = 0;
private const TRANSPARENT:Boolean = true;
private const SMOOTHING:Boolean = false;
public var screenManager:ScreenManager;
public var screen:Screen;
public var wait:int;
public function Transition(_arg1:ScreenManager){
wait = 0;
screen = null;
this.screenManager = _arg1;
super(null, PixelSnapping.ALWAYS, SMOOTHING);
}
public function setScreen(_arg1:IBitmapDrawable, _arg2:int, _arg3:int):void{
bitmapData = new BitmapData(_arg2, _arg3, TRANSPARENT, DEFAULT_COLOR);
bitmapData.draw(_arg1);
}
public function dispose():void{
screenManager = null;
screen = null;
bitmapData.dispose();
}
}
}//package net.odd1.minig.transitions
Section 200
//TextShadow (net.odd1.minig.ui.TextShadow)
package net.odd1.minig.ui {
import flash.display.*;
import flash.text.*;
import flash.filters.*;
public final class TextShadow extends Sprite {
private const SPACE:int = 5;
private const BACKGROUND_Y:int = 1;
private const FONT_NAME:String = "Default";
private var foreground:TextField;
private var background:TextField;
public function TextShadow(_arg1:Boolean=false, _arg2:int=0xFFFFFF, _arg3:int=0x666666, _arg4:String="Default"){
var _local5:TextFormat;
super();
mouseEnabled = false;
mouseChildren = false;
_local5 = new TextFormat(_arg4, 9);
foreground = new TextField();
background = new TextField();
foreground.mouseEnabled = false;
background.mouseEnabled = false;
foreground.textColor = _arg2;
background.textColor = _arg3;
foreground.defaultTextFormat = _local5;
background.defaultTextFormat = _local5;
foreground.selectable = false;
background.selectable = false;
foreground.embedFonts = true;
background.embedFonts = true;
background.y = BACKGROUND_Y;
addChild(foreground);
if (_arg1){
filters = [new GlowFilter(0, 1, 3, 3, 4, 1, false, false)];
};
}
public function setHeight(_arg1:int):void{
background.height = _arg1;
foreground.height = _arg1;
}
public function get text():String{
return (foreground.text);
}
public function scrollMax():void{
foreground.scrollV = foreground.maxScrollV;
background.scrollV = background.maxScrollV;
}
public function set text(_arg1:String):void{
foreground.text = _arg1;
background.text = _arg1;
foreground.width = (foreground.textWidth + SPACE);
foreground.height = (foreground.textHeight + SPACE);
background.width = (background.textWidth + SPACE);
background.height = (background.textHeight + SPACE);
}
}
}//package net.odd1.minig.ui
Section 201
//ArrayUtil (net.odd1.minig.utils.ArrayUtil)
package net.odd1.minig.utils {
public final class ArrayUtil {
public static function removeElement(_arg1:Array, _arg2):Boolean{
var _local3:int;
_local3 = _arg1.indexOf(_arg2);
if (_local3 != -1){
_arg1.splice(_local3, 1);
return (true);
};
return (false);
}
public static function randomArray(_arg1:Array){
var _local2:int;
var _local3:*;
_local2 = (Math.random() * _arg1.length);
_local3 = _arg1[_local2];
_arg1.splice(_local2, 1);
return (_local3);
}
}
}//package net.odd1.minig.utils
Section 202
//MovieClipUtil (net.odd1.minig.utils.MovieClipUtil)
package net.odd1.minig.utils {
import flash.display.*;
import net.odd1.minig.animations.*;
public final class MovieClipUtil {
public static function getAnimationData(_arg1:MovieClip):Array{
var _local2:FrameLabel;
var _local3:AnimationData;
var _local4:int;
var _local5:int;
var _local6:Array;
_local6 = [];
_local5 = _arg1.currentLabels.length;
_local6.push(new AnimationData("", 0, (_arg1.totalFrames - 1)));
_local4 = 0;
while (_local4 < _local5) {
_local2 = _arg1.currentLabels[_local4];
if (_local4 == (_local5 - 1)){
_local3 = new AnimationData(_local2.name, (_local2.frame - 1), (_arg1.totalFrames - 1));
} else {
_local3 = new AnimationData(_local2.name, (_local2.frame - 1), (FrameLabel(_arg1.currentLabels[(_local4 + 1)]).frame - 2));
};
_local6.push(_local3);
_local4++;
};
return (_local6);
}
public static function nextFrame(_arg1:MovieClip):void{
var _local2:int;
var _local3:int;
var _local4:DisplayObject;
_local2 = _arg1.numChildren;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _arg1.getChildAt(_local3);
if ((_local4 is MovieClip)){
nextFrame((_local4 as MovieClip));
};
_local3++;
};
if (_arg1.currentFrame == _arg1.totalFrames){
_arg1.gotoAndStop(1);
} else {
_arg1.nextFrame();
};
}
public static function gotoAndStopNextFrame(_arg1:MovieClip, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:DisplayObject;
_local3 = _arg1.numChildren;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _arg1.getChildAt(_local4);
if ((((_local5 is MovieClip)) && (!(MovieClip(_local5).animation)))){
nextFrame((_local5 as MovieClip));
};
_local4++;
};
_arg1.gotoAndStop(_arg2);
}
public static function nextFrameAnimation(_arg1:MovieClip):void{
var _local2:int;
var _local3:int;
var _local4:DisplayObject;
_local2 = _arg1.numChildren;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _arg1.getChildAt(_local3);
if ((((_local4 is MovieClip)) && (((!(MovieClip(_local4).animation)) || (((MovieClip(_local4).animation) && ((MovieClipAnimation(MovieClip(_local4).animation).animationsData.length > 2)))))))){
nextFrameAnimation((_local4 as MovieClip));
};
_local3++;
};
if (_arg1.currentFrame == _arg1.totalFrames){
_arg1.gotoAndStop(1);
} else {
_arg1.nextFrame();
};
}
public static function gotoAndStop(_arg1:MovieClip, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:DisplayObject;
_local3 = _arg1.numChildren;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _arg1.getChildAt(_local4);
if ((_local5 is MovieClip)){
gotoAndStop((_local5 as MovieClip), _arg2);
};
_local4++;
};
_arg1.gotoAndStop(_arg2);
}
}
}//package net.odd1.minig.utils
Section 203
//ChromeWars2 (ChromeWars2)
package {
import net.odd1.minig.managers.*;
import net.odd1.chromeWars2.characters.*;
import net.odd1.chromeWars2.screens.*;
import flash.display.*;
import net.odd1.minig.global.*;
public final class ChromeWars2 extends MovieClip {
public static var player:Robot;
public static var enemy:Robot;
public static var currentLevel:int;
public static var currentSave:int;
public static var currentArena:int;
public function ChromeWars2(_arg1:ScreenManager){
GlobalVariables.nextScreen = MainMenu;
if (GlobalVariables.sharedObject.data.save2){
GlobalVariables.save = new XML(GlobalVariables.sharedObject.data.save2);
};
player = new Robot();
enemy = new Robot();
}
}
}//package