home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Diversos / sheriff_tripeaks.swf / scripts / frame_14 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  11.1 KB  |  328 lines

  1. function music_play(play_flag)
  2. {
  3.    var _loc1_ = _root;
  4.    if(play_flag)
  5.    {
  6.       if(!_loc1_.music_started)
  7.       {
  8.          _loc1_.music_started = true;
  9.          _loc1_.music_sfx.start(0,9999);
  10.       }
  11.    }
  12.    else
  13.    {
  14.       _loc1_.music_started = false;
  15.       _loc1_.music_sfx.stop();
  16.    }
  17. }
  18. function hex_md5(s)
  19. {
  20.    return binl2hex(core_md5(str2binl(s),s.length * chrsz));
  21. }
  22. function b64_md5(s)
  23. {
  24.    return binl2b64(core_md5(str2binl(s),s.length * chrsz));
  25. }
  26. function str_md5(s)
  27. {
  28.    return binl2str(core_md5(str2binl(s),s.length * chrsz));
  29. }
  30. function hex_hmac_md5(key, data)
  31. {
  32.    return binl2hex(core_hmac_md5(key,data));
  33. }
  34. function b64_hmac_md5(key, data)
  35. {
  36.    return binl2b64(core_hmac_md5(key,data));
  37. }
  38. function str_hmac_md5(key, data)
  39. {
  40.    return binl2str(core_hmac_md5(key,data));
  41. }
  42. function md5_vm_test()
  43. {
  44.    return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
  45. }
  46. function core_md5(x, len)
  47. {
  48.    x[len >> 5] |= 128 << len % 32;
  49.    x[(len + 64 >>> 9 << 4) + 14] = len;
  50.    var a = 1732584193;
  51.    var _loc3_ = -271733879;
  52.    var _loc2_ = -1732584194;
  53.    var _loc1_ = 271733878;
  54.    var i = 0;
  55.    while(i < x.length)
  56.    {
  57.       var olda = a;
  58.       var oldb = _loc3_;
  59.       var oldc = _loc2_;
  60.       var oldd = _loc1_;
  61.       a = md5_ff(a,_loc3_,_loc2_,_loc1_,x[i + 0],7,-680876936);
  62.       _loc1_ = md5_ff(_loc1_,a,_loc3_,_loc2_,x[i + 1],12,-389564586);
  63.       _loc2_ = md5_ff(_loc2_,_loc1_,a,_loc3_,x[i + 2],17,606105819);
  64.       _loc3_ = md5_ff(_loc3_,_loc2_,_loc1_,a,x[i + 3],22,-1044525330);
  65.       a = md5_ff(a,_loc3_,_loc2_,_loc1_,x[i + 4],7,-176418897);
  66.       _loc1_ = md5_ff(_loc1_,a,_loc3_,_loc2_,x[i + 5],12,1200080426);
  67.       _loc2_ = md5_ff(_loc2_,_loc1_,a,_loc3_,x[i + 6],17,-1473231341);
  68.       _loc3_ = md5_ff(_loc3_,_loc2_,_loc1_,a,x[i + 7],22,-45705983);
  69.       a = md5_ff(a,_loc3_,_loc2_,_loc1_,x[i + 8],7,1770035416);
  70.       _loc1_ = md5_ff(_loc1_,a,_loc3_,_loc2_,x[i + 9],12,-1958414417);
  71.       _loc2_ = md5_ff(_loc2_,_loc1_,a,_loc3_,x[i + 10],17,-42063);
  72.       _loc3_ = md5_ff(_loc3_,_loc2_,_loc1_,a,x[i + 11],22,-1990404162);
  73.       a = md5_ff(a,_loc3_,_loc2_,_loc1_,x[i + 12],7,1804603682);
  74.       _loc1_ = md5_ff(_loc1_,a,_loc3_,_loc2_,x[i + 13],12,-40341101);
  75.       _loc2_ = md5_ff(_loc2_,_loc1_,a,_loc3_,x[i + 14],17,-1502002290);
  76.       _loc3_ = md5_ff(_loc3_,_loc2_,_loc1_,a,x[i + 15],22,1236535329);
  77.       a = md5_gg(a,_loc3_,_loc2_,_loc1_,x[i + 1],5,-165796510);
  78.       _loc1_ = md5_gg(_loc1_,a,_loc3_,_loc2_,x[i + 6],9,-1069501632);
  79.       _loc2_ = md5_gg(_loc2_,_loc1_,a,_loc3_,x[i + 11],14,643717713);
  80.       _loc3_ = md5_gg(_loc3_,_loc2_,_loc1_,a,x[i + 0],20,-373897302);
  81.       a = md5_gg(a,_loc3_,_loc2_,_loc1_,x[i + 5],5,-701558691);
  82.       _loc1_ = md5_gg(_loc1_,a,_loc3_,_loc2_,x[i + 10],9,38016083);
  83.       _loc2_ = md5_gg(_loc2_,_loc1_,a,_loc3_,x[i + 15],14,-660478335);
  84.       _loc3_ = md5_gg(_loc3_,_loc2_,_loc1_,a,x[i + 4],20,-405537848);
  85.       a = md5_gg(a,_loc3_,_loc2_,_loc1_,x[i + 9],5,568446438);
  86.       _loc1_ = md5_gg(_loc1_,a,_loc3_,_loc2_,x[i + 14],9,-1019803690);
  87.       _loc2_ = md5_gg(_loc2_,_loc1_,a,_loc3_,x[i + 3],14,-187363961);
  88.       _loc3_ = md5_gg(_loc3_,_loc2_,_loc1_,a,x[i + 8],20,1163531501);
  89.       a = md5_gg(a,_loc3_,_loc2_,_loc1_,x[i + 13],5,-1444681467);
  90.       _loc1_ = md5_gg(_loc1_,a,_loc3_,_loc2_,x[i + 2],9,-51403784);
  91.       _loc2_ = md5_gg(_loc2_,_loc1_,a,_loc3_,x[i + 7],14,1735328473);
  92.       _loc3_ = md5_gg(_loc3_,_loc2_,_loc1_,a,x[i + 12],20,-1926607734);
  93.       a = md5_hh(a,_loc3_,_loc2_,_loc1_,x[i + 5],4,-378558);
  94.       _loc1_ = md5_hh(_loc1_,a,_loc3_,_loc2_,x[i + 8],11,-2022574463);
  95.       _loc2_ = md5_hh(_loc2_,_loc1_,a,_loc3_,x[i + 11],16,1839030562);
  96.       _loc3_ = md5_hh(_loc3_,_loc2_,_loc1_,a,x[i + 14],23,-35309556);
  97.       a = md5_hh(a,_loc3_,_loc2_,_loc1_,x[i + 1],4,-1530992060);
  98.       _loc1_ = md5_hh(_loc1_,a,_loc3_,_loc2_,x[i + 4],11,1272893353);
  99.       _loc2_ = md5_hh(_loc2_,_loc1_,a,_loc3_,x[i + 7],16,-155497632);
  100.       _loc3_ = md5_hh(_loc3_,_loc2_,_loc1_,a,x[i + 10],23,-1094730640);
  101.       a = md5_hh(a,_loc3_,_loc2_,_loc1_,x[i + 13],4,681279174);
  102.       _loc1_ = md5_hh(_loc1_,a,_loc3_,_loc2_,x[i + 0],11,-358537222);
  103.       _loc2_ = md5_hh(_loc2_,_loc1_,a,_loc3_,x[i + 3],16,-722521979);
  104.       _loc3_ = md5_hh(_loc3_,_loc2_,_loc1_,a,x[i + 6],23,76029189);
  105.       a = md5_hh(a,_loc3_,_loc2_,_loc1_,x[i + 9],4,-640364487);
  106.       _loc1_ = md5_hh(_loc1_,a,_loc3_,_loc2_,x[i + 12],11,-421815835);
  107.       _loc2_ = md5_hh(_loc2_,_loc1_,a,_loc3_,x[i + 15],16,530742520);
  108.       _loc3_ = md5_hh(_loc3_,_loc2_,_loc1_,a,x[i + 2],23,-995338651);
  109.       a = md5_ii(a,_loc3_,_loc2_,_loc1_,x[i + 0],6,-198630844);
  110.       _loc1_ = md5_ii(_loc1_,a,_loc3_,_loc2_,x[i + 7],10,1126891415);
  111.       _loc2_ = md5_ii(_loc2_,_loc1_,a,_loc3_,x[i + 14],15,-1416354905);
  112.       _loc3_ = md5_ii(_loc3_,_loc2_,_loc1_,a,x[i + 5],21,-57434055);
  113.       a = md5_ii(a,_loc3_,_loc2_,_loc1_,x[i + 12],6,1700485571);
  114.       _loc1_ = md5_ii(_loc1_,a,_loc3_,_loc2_,x[i + 3],10,-1894986606);
  115.       _loc2_ = md5_ii(_loc2_,_loc1_,a,_loc3_,x[i + 10],15,-1051523);
  116.       _loc3_ = md5_ii(_loc3_,_loc2_,_loc1_,a,x[i + 1],21,-2054922799);
  117.       a = md5_ii(a,_loc3_,_loc2_,_loc1_,x[i + 8],6,1873313359);
  118.       _loc1_ = md5_ii(_loc1_,a,_loc3_,_loc2_,x[i + 15],10,-30611744);
  119.       _loc2_ = md5_ii(_loc2_,_loc1_,a,_loc3_,x[i + 6],15,-1560198380);
  120.       _loc3_ = md5_ii(_loc3_,_loc2_,_loc1_,a,x[i + 13],21,1309151649);
  121.       a = md5_ii(a,_loc3_,_loc2_,_loc1_,x[i + 4],6,-145523070);
  122.       _loc1_ = md5_ii(_loc1_,a,_loc3_,_loc2_,x[i + 11],10,-1120210379);
  123.       _loc2_ = md5_ii(_loc2_,_loc1_,a,_loc3_,x[i + 2],15,718787259);
  124.       _loc3_ = md5_ii(_loc3_,_loc2_,_loc1_,a,x[i + 9],21,-343485551);
  125.       a = safe_add(a,olda);
  126.       _loc3_ = safe_add(_loc3_,oldb);
  127.       _loc2_ = safe_add(_loc2_,oldc);
  128.       _loc1_ = safe_add(_loc1_,oldd);
  129.       i += 16;
  130.    }
  131.    return Array(a,_loc3_,_loc2_,_loc1_);
  132. }
  133. function md5_cmn(q, a, b, x, s, t)
  134. {
  135.    return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);
  136. }
  137. function md5_ff(a, b, c, d, x, s, t)
  138. {
  139.    var _loc1_ = b;
  140.    return md5_cmn(_loc1_ & c | (~_loc1_) & d,a,_loc1_,x,s,t);
  141. }
  142. function md5_gg(a, b, c, d, x, s, t)
  143. {
  144.    return md5_cmn(b & d | c & (~d),a,b,x,s,t);
  145. }
  146. function md5_hh(a, b, c, d, x, s, t)
  147. {
  148.    return md5_cmn(b ^ c ^ d,a,b,x,s,t);
  149. }
  150. function md5_ii(a, b, c, d, x, s, t)
  151. {
  152.    return md5_cmn(c ^ (b | ~d),a,b,x,s,t);
  153. }
  154. function core_hmac_md5(key, data)
  155. {
  156.    var _loc2_ = str2binl(key);
  157.    if(_loc2_.length > 16)
  158.    {
  159.       _loc2_ = core_md5(_loc2_,key.length * chrsz);
  160.    }
  161.    var _loc3_ = Array(16);
  162.    var opad = Array(16);
  163.    var _loc1_ = 0;
  164.    while(_loc1_ < 16)
  165.    {
  166.       _loc3_[_loc1_] = _loc2_[_loc1_] ^ 0x36363636;
  167.       opad[_loc1_] = _loc2_[_loc1_] ^ 0x5C5C5C5C;
  168.       _loc1_ = _loc1_ + 1;
  169.    }
  170.    var hash = core_md5(_loc3_.concat(str2binl(data)),512 + data.length * chrsz);
  171.    return core_md5(opad.concat(hash),640);
  172. }
  173. function safe_add(x, y)
  174. {
  175.    var _loc1_ = (x & 0xFFFF) + (y & 0xFFFF);
  176.    var _loc2_ = (x >> 16) + (y >> 16) + (_loc1_ >> 16);
  177.    return _loc2_ << 16 | _loc1_ & 0xFFFF;
  178. }
  179. function bit_rol(num, cnt)
  180. {
  181.    return num << cnt | num >>> 32 - cnt;
  182. }
  183. function str2binl(str)
  184. {
  185.    var _loc2_ = str;
  186.    var _loc3_ = Array();
  187.    var mask = (1 << chrsz) - 1;
  188.    var _loc1_ = 0;
  189.    while(_loc1_ < _loc2_.length * chrsz)
  190.    {
  191.       _loc3_[_loc1_ >> 5] |= (_loc2_.charCodeAt(_loc1_ / chrsz) & mask) << _loc1_ % 32;
  192.       _loc1_ += chrsz;
  193.    }
  194.    return _loc3_;
  195. }
  196. function binl2str(bin)
  197. {
  198.    var _loc2_ = bin;
  199.    var _loc3_ = "";
  200.    var mask = (1 << chrsz) - 1;
  201.    var _loc1_ = 0;
  202.    while(_loc1_ < _loc2_.length * 32)
  203.    {
  204.       _loc3_ += String.fromCharCode(_loc2_[_loc1_ >> 5] >>> _loc1_ % 32 & mask);
  205.       _loc1_ += chrsz;
  206.    }
  207.    return _loc3_;
  208. }
  209. function binl2hex(binarray)
  210. {
  211.    var _loc2_ = binarray;
  212.    var _loc3_ = !hexcase ? "0123456789abcdef" : "0123456789ABCDEF";
  213.    var str = "";
  214.    var _loc1_ = 0;
  215.    while(_loc1_ < _loc2_.length * 4)
  216.    {
  217.       str += _loc3_.charAt(_loc2_[_loc1_ >> 2] >> _loc1_ % 4 * 8 + 4 & 0x0F) + _loc3_.charAt(_loc2_[_loc1_ >> 2] >> _loc1_ % 4 * 8 & 0x0F);
  218.       _loc1_ = _loc1_ + 1;
  219.    }
  220.    return str;
  221. }
  222. function binl2b64(binarray)
  223. {
  224.    var _loc3_ = binarray;
  225.    var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  226.    var str = "";
  227.    var _loc2_ = 0;
  228.    while(_loc2_ < _loc3_.length * 4)
  229.    {
  230.       var triplet = (_loc3_[_loc2_ >> 2] >> 8 * (_loc2_ % 4) & 0xFF) << 16 | (_loc3_[_loc2_ + 1 >> 2] >> 8 * ((_loc2_ + 1) % 4) & 0xFF) << 8 | _loc3_[_loc2_ + 2 >> 2] >> 8 * ((_loc2_ + 2) % 4) & 0xFF;
  231.       var _loc1_ = 0;
  232.       while(_loc1_ < 4)
  233.       {
  234.          if(_loc2_ * 8 + _loc1_ * 6 > _loc3_.length * 32)
  235.          {
  236.             str += b64pad;
  237.          }
  238.          else
  239.          {
  240.             str += tab.charAt(triplet >> 6 * (3 - _loc1_) & 0x3F);
  241.          }
  242.          _loc1_ = _loc1_ + 1;
  243.       }
  244.       _loc2_ += 3;
  245.    }
  246.    return str;
  247. }
  248. AwardsScoring = new Array();
  249. AwardsScoring.push([1400,2000]);
  250. AwardsScoring.push([1200,1600]);
  251. AwardsScoring.push([700,1100]);
  252. AwardsScoring.push([1000,1600]);
  253. AwardsScoring.push([900,1300]);
  254. AwardsScoring.push([1000,1500]);
  255. AwardsScoring.push([1200,1900]);
  256. AwardsScoring.push([1100,1700]);
  257. AwardsScoring.push([1400,2000]);
  258. AwardsScoring.push([1400,2000]);
  259. AwardsScoring.push([1200,1800]);
  260. AwardsScoring.push([1500,2300]);
  261. AwardsScoring.push([1500,2300]);
  262. AwardsScoring.push([1700,2600]);
  263. AwardsScoring.push([800,1300]);
  264. AwardsScoring.push([1200,1800]);
  265. AwardsScoring.push([1200,1800]);
  266. AwardsScoring.push([700,1300]);
  267. AwardsScoring.push([1400,2000]);
  268. AwardsScoring.push([1000,1600]);
  269. AwardsScoring.push([1400,2100]);
  270. AwardsScoring.push([500,1000]);
  271. AwardsScoring.push([1700,2300]);
  272. AwardsScoring.push([700,1100]);
  273. AwardsScoring.push([1000,1500]);
  274. _root.AwardType = function(level)
  275. {
  276.    var _loc2_ = _global.Settings.playedScores[level];
  277.    var _loc3_ = _root.AwardsScoring[level][0];
  278.    var _loc1_ = _root.AwardsScoring[level][1];
  279.    var interval = (_loc1_ - _loc3_) / 3;
  280.    if(_loc2_ < _loc3_)
  281.    {
  282.       return 3;
  283.    }
  284.    if(_loc2_ < _loc1_)
  285.    {
  286.       return 2;
  287.    }
  288.    return 1;
  289. };
  290. music_started = false;
  291. first_play = SharedObject.getLocal("sheriff_tripeaks");
  292. if(first_play.data.played != "true")
  293. {
  294.    first_play.data.played = "true";
  295.    first_play.flush();
  296.    show_tips = true;
  297. }
  298. else
  299. {
  300.    show_tips = false;
  301. }
  302. var button_sfx = new Sound();
  303. button_sfx.attachSound("button_sfx");
  304. var music_sfx = new Sound();
  305. music_sfx.attachSound("music");
  306. var wrong_card_sfx = new Sound();
  307. wrong_card_sfx.attachSound("wrong_card");
  308. var level_done_sfx = new Sound();
  309. level_done_sfx.attachSound("level_done");
  310. var non_playable_sfx = new Sound();
  311. non_playable_sfx.attachSound("non_playable");
  312. var points_sfx = new Sound();
  313. points_sfx.attachSound("points");
  314. var set_sfx = new Sound();
  315. set_sfx.attachSound("set");
  316. var shot_sfx = new Sound();
  317. shot_sfx.attachSound("shot");
  318. var undo_sfx = new Sound();
  319. undo_sfx.attachSound("undo");
  320. var game_over_sfx = new Sound();
  321. game_over_sfx.attachSound("game_over");
  322. var level_start_sfx = new Sound();
  323. level_start_sfx.attachSound("level_start");
  324. var MEvents = new Object();
  325. var hexcase = 0;
  326. var b64pad = "";
  327. var chrsz = 8;
  328.