STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229595
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/68711372?noj=FRM68711372-22DC" width="1" height="1"></div>

Master of Security.swf

This is the info page for
Flash #41265

(Click the ID number above for more basic data on this flash file.)


Text
www.kongregate.com

Name for Highscore List:

<p align="left"></p>

<p align="left"><font face="Times New Roman" size="14" color="#ff0000" letterSpacing="0.000000" kerning="1"><b>You must enter your name.</b></font></p>

AntiVirus

Best against viruses, rootkits,
backdoors and dangeous malware

200

25

2

Big

250

Damages all types of malware.

Score:

0000

150$

1000

30

Spam

Risk:

1

Security
Monitor:

AntiVirus

Best against viruses, rootkits,
backdoors and dangeous malware

200

2

Security Level:

0/2

Damages all types of malware.

Defeat!

Think about career in information security!

Score:

Threats killed:

Software Lost:

Money spent:

Security Tools Built:

100

100

100

100

100

Play More Games

<p align="center"><font face="Times New Roman" size="16" color="#ffcc00" letterSpacing="0.000000" kerning="0"><a href="http://www.warspark.com" target = "_blank"><b>www.WarSpark.com</b></a></font></p>

Master of Security

Most simple threat,
doesn't hurt too much

Quantity:

10 pieces

Risk Level:

Lowest

Adware

The goal of the game is to protect your software from harmful threats: adware, spyware, viruses, etc.
To kill security invaders you must build security shields on the game desktop. All invaders, except viruses, can’t go
through the shields. You must place shields on the desktop to change movement direction of the invaders and to force
them to pass longer way, to give your shields time for destroying threats.

How to Play

AntiAdware damages all types of invaders.
AntiSpyware is stronger than AntiAdware but can’t damage viruses.
Garbage Cleaner damages all types of invaders. It has small damage rate but this shield slows down invaders
and has the chance to stun invader for some time.
AntiVirus is the best shield against viruses, but it can’t damage other invaders except viruses.
Firewall has powerful damage of all near units within fire circle, but it doesn't effect viruses.

The higher risk level is, the stronger invaders will appear.
Spam has increased count of invaders.
Keylogger is the most fast moving invader.
Hijacker can attack security shields.
Virus moves through the security shields without changing its way. (Tip: but you still can stun it by Garbage Cleaner)

A few things you should know about the Shields:

A few things you should know about the Invaders:

To make your software stronger, keep it up to date. To update your software, select it and press Update or <U> on the
keyboard if you have sufficient amount of money. Each software can be updated three times.

Level 1  Level 2  Level 3

ActionScript [AS3]

Section 1
//AnimatedBitmap (fai.AnimatedBitmap) package fai { import flash.display.*; import flash.geom.*; public class AnimatedBitmap extends Bitmap { private var point:Point;// = null private var rect:Rectangle;// = null public var curbuffer:BitmapData;// = null public var nframes:uint;// = 0 public var framen:uint;// = 0 public function AnimatedBitmap(_arg1:BitmapData, _arg2:int, _arg3:int):void{ nframes = 0; curbuffer = null; framen = 0; point = null; rect = null; super(new BitmapData(_arg2, _arg3, true, 0), "auto", true); point = new Point(0, 0); setBuffer(_arg1); } public function setBuffer(_arg1:BitmapData):void{ if (((_arg1) && (!((curbuffer == _arg1))))){ curbuffer = _arg1; nframes = (curbuffer.width / width); framen = 0; draw(); }; } public function setFrame(_arg1:uint):void{ if (_arg1 == framen){ return; }; framen = _arg1; draw(); } private function draw():void{ var _local1:BitmapData; _local1 = bitmapData; rect = new Rectangle((framen * width), 0, width, height); _local1.copyPixels(curbuffer, rect, point); bitmapData = _local1; smoothing = true; } } }//package fai
Section 2
//Astar (fai.Astar) package fai { public class Astar { private var maxf:uint;// = 0 public var ns:Array; public var checkxy:Function;// = null public var destination:Position; private var tempg:uint;// = 0 private var temph:uint;// = 0 public var tid:uint;// = 0 private var node:AstarNode;// = null public var map:MapMatrix;// = null private var nextbestpos:Position;// = null private var startnode:AstarNode;// = null private var cnode:AstarNode;// = null private var opened:AstarMap;// = null private var closed:AstarMap;// = null private var onode:AstarNode;// = null private var openedMap:AstarMap;// = null private var curf:int;// = 0 public static var npasses:int = 0; public function Astar(_arg1:MapMatrix, _arg2:int):void{ checkxy = null; map = null; ns = new Array(); opened = null; closed = null; openedMap = null; nextbestpos = null; tid = 0; tempg = 0; temph = 0; maxf = 0; curf = 0; onode = null; cnode = null; startnode = null; node = null; destination = new Position(); super(); checkxy = checkwallid; map = _arg1; tid = _arg2; } public function allgood(_arg1:uint, _arg2:uint):Boolean{ return (true); } public function findNearPlace(_arg1:Position, _arg2:int=0):void{ var _local3:int; var _local4:int; var _local5:int; _local3 = _arg2; while (true) { _local4 = (_arg1.x - _local3); while (_local4 <= (_arg1.x + _local3)) { _local5 = (_arg1.y - _local3); while (_local5 <= (_arg1.y + _local3)) { if ((((((((_local4 >= 0)) && ((_local5 >= 0)))) && ((_local4 < map.h)))) && ((_local5 < map.v)))){ if (checkxy(_local4, _local5)){ destination.set(_local4, _local5); return; }; }; _local5++; }; _local4++; }; _local3++; if (((((((((_arg1.x - _local3) < 0)) && (((_arg1.x + _local3) >= map.h)))) && (((_arg1.y - _local3) < 0)))) && (((_arg1.y + _local3) >= map.v)))){ destination = null; return; }; }; } public function hestimate(_arg1:Position, _arg2:Position):uint{ return ((Math.abs((_arg1.x - _arg2.x)) + Math.abs((_arg1.y - _arg2.y)))); } public function checknotempty(_arg1:uint, _arg2:uint):Boolean{ return (!(map.getxy(_arg1, _arg2))); } public function checkwall(_arg1:uint, _arg2:uint):Boolean{ return (!((Consts.Wall == map.getxy(_arg1, _arg2)))); } private function addToOpened(_arg1:AstarNode):void{ opened.add(_arg1.key(), _arg1); openedMap.add(_arg1.h, _arg1); } public function startSearch(_arg1:Position, _arg2:Position):Boolean{ nextbestpos = null; ns.length = 0; opened = new AstarMap(); openedMap = new AstarMap(); closed = new AstarMap(); tempg = 0; temph = 0; maxf = 0; curf = 0; onode = null; cnode = null; findNearPlace(_arg2); if (!destination){ return (false); }; startnode = new AstarNode(); node = null; startnode.pos = _arg1; startnode.f = (startnode.h = hestimate(_arg1, destination)); addToOpened(startnode); return (true); } public function isPathExists():Boolean{ var _local1:Position; var _local2:AstarNode; while (!(opened.empty())) { node = getBestNode(); if (node.pos.isequal(destination)){ return (true); }; neighbours(node.pos); for each (_local1 in ns) { tempg = (node.g + hestimate(node.pos, _local1)); temph = hestimate(_local1, destination); curf = (tempg + temph); onode = opened.get(((_local1.x * 1000) + _local1.y)); if (onode){ } else { cnode = closed.get(((_local1.x * 1000) + _local1.y)); if (cnode){ } else { if (onode){ opened.remove(onode.key()); openedMap.removeNode(onode.h, onode); }; if (cnode){ closed.remove(cnode.key()); }; _local2 = new AstarNode(); _local2.pos = _local1; _local2.g = tempg; _local2.h = temph; _local2.f = curf; _local2.parent = node; addToOpened(_local2); }; }; }; closed.add(node.key(), node); }; return (false); } public function search(_arg1:Array):Boolean{ var _local2:Position; var _local3:AstarNode; var _local4:AstarNode; while (!(opened.empty())) { npasses--; if (npasses <= 0){ return (true); }; node = getBestNode(); if (node.pos.isequal(destination)){ _local3 = node; while (_local3 != startnode) { _arg1.unshift(_local3.pos); _local3 = _local3.parent; }; return (true); }; neighbours(node.pos); for each (_local2 in ns) { tempg = (node.g + hestimate(node.pos, _local2)); temph = hestimate(_local2, destination); curf = (tempg + temph); onode = opened.get(((_local2.x * 1000) + _local2.y)); if (((onode) && ((onode.f <= curf)))){ } else { cnode = closed.get(((_local2.x * 1000) + _local2.y)); if (((cnode) && ((cnode.f <= curf)))){ } else { if (onode){ opened.remove(onode.key()); openedMap.removeNode(onode.h, onode); }; if (cnode){ closed.remove(cnode.key()); }; _local4 = new AstarNode(); _local4.pos = _local2; _local4.g = tempg; _local4.h = temph; _local4.f = curf; _local4.parent = node; addToOpened(_local4); }; }; }; closed.add(node.key(), node); }; return (false); } public function checkwallid(_arg1:uint, _arg2:uint):Boolean{ var _local3:uint; _local3 = map.getxy(_arg1, _arg2); return (((!((_local3 == Consts.Wall))) && (!((_local3 == tid))))); } public function neighbours(_arg1:Position):void{ ns.length = 0; if (_arg1.x > 0){ if (checkxy((_arg1.x - 1), _arg1.y)){ ns.push(new Position((_arg1.x - 1), _arg1.y)); }; if ((((_arg1.y < (map.v - 1))) && (checkxy((_arg1.x - 1), (_arg1.y + 1))))){ ns.push(new Position((_arg1.x - 1), (_arg1.y + 1))); }; if ((((_arg1.y > 0)) && (checkxy((_arg1.x - 1), (_arg1.y - 1))))){ ns.push(new Position((_arg1.x - 1), (_arg1.y - 1))); }; }; if ((((_arg1.y > 0)) && (checkxy(_arg1.x, (_arg1.y - 1))))){ ns.push(new Position(_arg1.x, (_arg1.y - 1))); }; if (_arg1.x < (map.h - 1)){ if (checkxy((_arg1.x + 1), _arg1.y)){ ns.push(new Position((_arg1.x + 1), _arg1.y)); }; if ((((_arg1.y < (map.v - 1))) && (checkxy((_arg1.x + 1), (_arg1.y + 1))))){ ns.push(new Position((_arg1.x + 1), (_arg1.y + 1))); }; if ((((_arg1.y > 0)) && (checkxy((_arg1.x + 1), (_arg1.y - 1))))){ ns.push(new Position((_arg1.x + 1), (_arg1.y - 1))); }; }; if ((((_arg1.y < (map.v - 1))) && (checkxy(_arg1.x, (_arg1.y + 1))))){ ns.push(new Position(_arg1.x, (_arg1.y + 1))); }; } private function getBestNode():AstarNode{ var _local1:AstarNode; _local1 = openedMap.shift(); opened.remove(_local1.key()); return (_local1); } } }//package fai class AstarNode { public var f:uint;// = 0 public var g:uint;// = 0 public var h:uint;// = 0 public var parent:AstarNode;// = null public var pos:Position;// = null private function AstarNode(){ f = 0; g = 0; h = 0; parent = null; pos = null; super(); } public function key():uint{ return (((pos.x * 1000) + pos.y)); } } class AstarMap extends Map { private function AstarMap(){ } public function removeNode(_arg1:int, _arg2:AstarNode):void{ var _local3:int; if (find(_arg1)){ if (!values[index_].pos.isequal(_arg2.pos)){ _local3 = (index_ - 1); while ((((_local3 >= 0)) && ((keys[_local3] == _arg1)))) { if (values[_local3].pos.isequal(_arg2.pos)){ keys.splice(_local3, 1); values.splice(_local3, 1); return; }; _local3--; }; _local3 = (index_ + 1); while ((((_local3 < keys.length)) && ((keys[_local3] == _arg1)))) { if (values[_local3].pos.isequal(_arg2.pos)){ keys.splice(_local3, 1); values.splice(_local3, 1); return; }; _local3++; }; trace("ERROR ___ 1"); } else { keys.splice(index_, 1); values.splice(index_, 1); }; }; } }
Section 3
//AttackGoal (fai.AttackGoal) package fai { public class AttackGoal extends Goal { public var preciseTarget:Unit;// = null public var attacktarget:Unit;// = null private var onlyFlying:Boolean;// = false private var recharging:int;// = 0 public var paused:Boolean;// = false private var onlyLand:Boolean;// = false private var precisePos:Position;// = null public var hostilecamp:Camp;// = null public function AttackGoal(_arg1:Unit, _arg2:Camp):void{ hostilecamp = null; attacktarget = null; onlyFlying = false; onlyLand = false; recharging = 0; paused = false; preciseTarget = null; precisePos = null; super(); owner = _arg1; hostilecamp = _arg2; if (!owner.flag(UnitFlags.Antiaircraft)){ onlyLand = true; }; if (!owner.flag(UnitFlags.Antilandforces)){ onlyFlying = true; }; } public function advance():void{ var _local1:Unit; _local1 = null; if (Consts.ATTACK == owner.cstate){ if (recharging > 0){ recharging--; if (((((!(recharging)) && (!(paused)))) && (!(preciseAttack())))){ _local1 = hostilecamp.getNearestUnit(owner.pos, owner.eyerange, onlyFlying, onlyLand); if (_local1 != null){ owner.startattack(_local1); } else { owner.reset(); owner.sprite.setMoveSprite(); return; }; }; } else { owner.attack(); }; if ((((Consts.IDLE == owner.cstate)) && (!(paused)))){ if (preciseAttack()){ recharging = owner.rechargetime; } else { _local1 = hostilecamp.getNearestUnit(owner.pos, owner.eyerange, onlyFlying, onlyLand); if (_local1 != null){ recharging = owner.rechargetime; owner.startattack(_local1); } else { owner.sprite.setMoveSprite(); }; }; }; } else { if ((((((Consts.IDLE == owner.cstate)) && (!(paused)))) && (!(preciseAttack())))){ _local1 = hostilecamp.getNearestUnit(owner.pos, owner.eyerange, onlyFlying, onlyLand); if (_local1 != null){ owner.startattack(_local1); }; }; }; } public function preciseAttack():Boolean{ var _local1:int; var _local2:int; var _local3:Boolean; if (!preciseTarget){ return (false); }; if (!preciseTarget.isLive()){ clearPreciseTarget(); return (false); }; if (((((preciseTarget.flag(UnitFlags.Flying)) && (!(owner.flag(UnitFlags.Antiaircraft))))) || (((!(preciseTarget.flag(UnitFlags.Flying))) && (!(owner.flag(UnitFlags.Antilandforces))))))){ clearPreciseTarget(); return (false); }; _local1 = (owner.pos.x - preciseTarget.pos.x); _local2 = (owner.pos.y - preciseTarget.pos.y); _local3 = (Math.sqrt(((_local1 * _local1) + (_local2 * _local2))) <= owner.eyerange); if (!_local3){ if (owner.flag(UnitFlags.Building)){ clearPreciseTarget(); return (false); }; if (((!(precisePos)) || (!(precisePos.isequal(preciseTarget.pos))))){ owner.life.move(preciseTarget.pos); precisePos = preciseTarget.pos; }; return (true); }; owner.startattack(preciseTarget); return (true); } public function clearPreciseTarget():void{ precisePos = null; preciseTarget = null; } } }//package fai
Section 4
//BulletGoal (fai.BulletGoal) package fai { import flash.display.*; public class BulletGoal extends Goal { private var engine:Engine;// = null private var sprite:AnimatedBitmap;// = null private var gip:int;// = 0 public var bullet:Sprite; private var hitpos:Position;// = null private var framen:int;// = 0 private var assaulter:Unit;// = null private var subject:Unit;// = null private var expl:AnimatedBitmap;// = null public function BulletGoal(_arg1:Unit, _arg2:Unit, _arg3:Position, _arg4:Engine):void{ var _local5:int; var _local6:int; assaulter = null; subject = null; sprite = null; expl = null; engine = null; gip = 0; hitpos = null; bullet = new Sprite(); framen = 0; super(); engine = _arg4; assaulter = _arg1; subject = _arg2; sprite = new AnimatedBitmap(assaulter.sprite.bullet, assaulter.sprite.bullet.width, assaulter.sprite.bullet.height); expl = new AnimatedBitmap(assaulter.sprite.bulletexp, assaulter.sprite.bulletexp.height, assaulter.sprite.bulletexp.height); bullet.addChild(sprite); expl.visible = false; bullet.addChild(expl); sprite.x = (sprite.x - (sprite.width / 2)); sprite.y = (sprite.y - (sprite.height / 2)); expl.y = (expl.y + (sprite.height - (expl.height / 2))); hitpos = subject.pos; bullet.x = _arg1.sprite.x; bullet.y = _arg1.sprite.y; bullet.rotation = (((Math.atan2((_arg3.y - _arg1.sprite.y), (_arg3.x - _arg1.sprite.x)) / Math.PI) * 180) - 90); _local5 = (subject.pos.x - assaulter.pos.x); _local6 = (subject.pos.y - assaulter.pos.y); gip = (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))) * Consts.cellsize); } public function advance():void{ if (gip <= 0){ if (framen < expl.nframes){ expl.setFrame(framen); framen++; return; }; deactivate(); } else { gip = (gip - assaulter.bulletspeed); if (gip <= 0){ sprite.y = (sprite.y + (assaulter.bulletspeed + gip)); sprite.visible = false; expl.x = sprite.x; expl.y = sprite.y; expl.visible = true; engine.hitUnit(assaulter.damage, subject); if (assaulter.flag(UnitFlags.Frozenable)){ engine.froze(subject); }; if (!subject.isLive()){ assaulter.killed++; if (engine.isSelectedUnit(assaulter)){ engine.updateMenu(); }; }; } else { sprite.y = (sprite.y + assaulter.bulletspeed); }; }; } override public function deactivate():void{ super.deactivate(); if (bullet){ bullet.removeChild(sprite); bullet.removeChild(expl); engine.bulletlayer.removeChild(bullet); sprite = null; assaulter = (subject = null); bullet = null; }; } } }//package fai
Section 5
//Camp (fai.Camp) package fai { public class Camp { public var units:Array; public function Camp(){ units = new Array(); super(); } public function getUnder(_arg1:Position):Unit{ var _local2:Unit; var _local3:int; _local2 = null; _local3 = 0; while (_local3 < units.length) { _local2 = units[_local3]; if (((((((((_local2.sprite.x - (_local2.spritewidth / 2)) <= _arg1.x)) && ((_arg1.x < (_local2.sprite.x + (_local2.spritewidth / 2)))))) && (((_local2.sprite.y - (_local2.sprite.height / 2)) <= _arg1.y)))) && ((_arg1.y < (_local2.sprite.y + (_local2.sprite.height / 2)))))){ return (_local2); }; _local3++; }; return (null); } public function remove(_arg1:Unit):void{ var _local2:uint; _local2 = 0; while (_local2 < units.length) { if (units[_local2] == _arg1){ delete units[_local2]; units.splice(_local2, 1); break; }; _local2++; }; } public function add(_arg1:Unit):void{ units[units.length] = _arg1; } public function getUnderSelection(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Array):void{ var _local6:Unit; var _local7:int; _arg5.length = 0; _local6 = null; _local7 = 0; while (_local7 < units.length) { _local6 = units[_local7]; if ((((((((((_local6.pos.x >= _arg1)) && ((_local6.pos.x <= (_arg1 + _arg3))))) && ((_local6.pos.y >= _arg2)))) && ((_local6.pos.y <= (_arg2 + _arg4))))) && (!(((_local6.flag(UnitFlags.Building)) && (_local6.flag(UnitFlags.Peaceful))))))){ _arg5.push(_local6); }; _local7++; }; } public function getNearestUnit(_arg1:Position, _arg2:int, _arg3:Boolean, _arg4:Boolean):Unit{ var _local5:Unit; var _local6:int; var _local7:Unit; var _local8:int; var _local9:int; _local5 = null; _local6 = 9999999; _local7 = null; _local8 = 0; while (_local8 < units.length) { _local7 = units[_local8]; if (((((_arg3) && (!(_local7.flag(UnitFlags.Flying))))) || (((_arg4) && (_local7.flag(UnitFlags.Flying)))))){ } else { _local9 = distanceFrom(_arg1, _local7); if (_local9 <= _arg2){ if (_local9 < _local6){ _local6 = _local9; _local5 = _local7; }; }; }; _local8++; }; return (_local5); } public function size():uint{ return (units.length); } public function getNearUnits(_arg1:Position, _arg2:int):Array{ var _local3:Array; var _local4:Unit; var _local5:int; var _local6:int; _local3 = new Array(); _local4 = null; _local5 = 0; while (_local5 < units.length) { _local4 = units[_local5]; _local6 = distanceFrom(_arg1, _local4); if (_local6 <= _arg2){ _local3.push(_local4); }; _local5++; }; return (_local3); } public function getNearUnitById(_arg1:Position, _arg2:int, _arg3:int):Unit{ var _local4:Unit; var _local5:int; var _local6:int; var _local7:int; var _local8:int; _local4 = null; _local5 = 0; while (_local5 < units.length) { _local4 = units[_local5]; if (_local4.mapid != _arg3){ } else { _local6 = (_local4.pos.x - _arg1.x); _local7 = (_local4.pos.y - _arg1.y); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); if (_local8 <= _arg2){ return (_local4); }; }; _local5++; }; return (null); } public function isUnitNear(_arg1:Position, _arg2:int):Boolean{ var _local3:Unit; var _local4:int; var _local5:int; _local3 = null; _local4 = 0; while (_local4 < units.length) { _local3 = units[_local4]; _local5 = distanceFrom(_arg1, _local3); if (_local5 <= _arg2){ return (true); }; _local4++; }; return (false); } public function getInMapUnder(_arg1:Position):Unit{ var _local2:Unit; var _local3:int; _local2 = null; _local3 = 0; while (_local3 < units.length) { _local2 = units[_local3]; if ((((_local2.pos.x == _arg1.x)) && ((_local2.pos.y == _arg1.y)))){ return (_local2); }; _local3++; }; return (null); } public function getNearestByType(_arg1:String, _arg2:Position):Unit{ var _local3:Unit; var _local4:Unit; var _local5:int; var _local6:int; var _local7:int; var _local8:int; var _local9:int; _local3 = null; _local4 = null; _local5 = 9999999; _local6 = 0; while (_local6 < units.length) { _local3 = units[_local6]; if (_local3.type == _arg1){ _local7 = (_local3.pos.x - _arg2.x); _local8 = (_local3.pos.y - _arg2.y); _local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8))); if (_local9 < _local5){ _local4 = _local3; _local5 = _local9; }; }; _local6++; }; return (_local4); } public function getNearestById(_arg1:int, _arg2:Position):Unit{ var _local3:Unit; var _local4:Unit; var _local5:int; var _local6:int; var _local7:int; var _local8:int; var _local9:int; _local3 = null; _local4 = null; _local5 = 9999999; _local6 = 0; while (_local6 < units.length) { _local3 = units[_local6]; if (_local3.mapid == _arg1){ _local7 = (_local3.pos.x - _arg2.x); _local8 = (_local3.pos.y - _arg2.y); _local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8))); if (_local9 < _local5){ _local4 = _local3; _local5 = _local9; }; }; _local6++; }; return (_local4); } public static function distanceFrom(_arg1:Position, _arg2:Unit):int{ var _local3:int; var _local4:int; _local3 = (_arg2.pos.x - _arg1.x); _local4 = (_arg2.pos.y - _arg1.y); return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4)))); } } }//package fai
Section 6
//Consts (fai.Consts) package fai { public class Consts { public static const maxLogMsgs:int = 10; public static const upgradeHExtra:Number = 1; public static const Normal:int = 2; public static const ATTACK:uint = 1; public static const UNIT_LEAVE_COUNT:int = 100; public static const UnitWaveCount:int = 30; public static const Extreme:int = 4; public static const MOVING:uint = 2; public static const upgradeDExtra:Number = 1; public static const IDLE:uint = 0; public static const cellsize:uint = 9; public static const softId:uint = 5; public static const myId:uint = 3; public static const Easy:int = 1; public static const Wall:uint = 1; public static const cornerWindow:int = 150; public static const GOALSCLEANPAUSE:uint = 10; public static const FrozenTime:int = 100; public static const hostileId:uint = 4; public static const DEATH:uint = 3; public static const Hard:int = 3; public static const defaultScrollSpeed:int = 50; public static const SoftShotDamage:int = 25; public static const FrozenMoveSteps:int = 10; } }//package fai
Section 7
//DieGoal (fai.DieGoal) package fai { import flash.display.*; public class DieGoal extends Goal { public var engine:Engine;// = null private var spriteScale:Number;// = 1 public var unit:Unit;// = null private var lifegoal:LifeGoal;// = null private var framen:int;// = 0 private var esprite:Sprite;// = null private var expl:AnimatedBitmap;// = null private var pause:int;// = 0 private var leave:int;// = 100 private var debris:AnimatedBitmap;// = null public function DieGoal(_arg1:Unit, _arg2:Engine, _arg3:LifeGoal):void{ unit = null; engine = null; leave = Consts.UNIT_LEAVE_COUNT; lifegoal = null; expl = null; debris = null; pause = 0; spriteScale = 1; esprite = null; framen = 0; super(); unit = _arg1; engine = _arg2; lifegoal = _arg3; unit.destroy(); expl = new AnimatedBitmap(engine.sloader.specials[UnitTypes.spdeath1], 32, 32); debris = new AnimatedBitmap(engine.sloader.specials[UnitTypes.spdebris], 32, 32); esprite = new Sprite(); expl.x = (expl.x - (unit.spritewidth / 2)); expl.y = (expl.y - (unit.sprite.sprite.height / 2)); expl.x = (expl.x + ((unit.spritewidth - expl.width) / 2)); expl.y = (expl.y + ((unit.sprite.sprite.height - expl.height) / 2)); esprite.scaleX = (esprite.scaleY = (_arg1.spritewidth / 32)); debris.x = expl.x; debris.y = expl.y; debris.visible = false; esprite.addChild(expl); esprite.addChild(debris); unit.sprite.body.addChild(esprite); engine.playSound(engine.sloader.sounds[UnitTypes.sounddeath], unit.pos); } public function advance():void{ if (pause > 0){ pause--; return; }; if (expl.framen < expl.nframes){ spriteScale = (spriteScale - 0.2); unit.sprite.sprite.alpha = spriteScale; framen++; expl.setFrame(framen); return; }; if (leave > 0){ if (leave == Consts.UNIT_LEAVE_COUNT){ expl.visible = false; if (!unit.flag(UnitFlags.Flying)){ debris.visible = true; }; unit.sprite.sprite.visible = false; }; leave--; return; }; deactivate(); } override public function deactivate():void{ super.deactivate(); lifegoal.destroy(true); } } }//package fai
Section 8
//DifficultyParams (fai.DifficultyParams) package fai { public class DifficultyParams { public var nwaves:int;// = 0 public var divquotient:Number;// = 0 public function DifficultyParams(_arg1:int):void{ nwaves = 0; divquotient = 0; super(); switch (_arg1){ case Consts.Easy: nwaves = 50; divquotient = 2.5; break; case Consts.Normal: nwaves = 100; divquotient = 1.3; break; case Consts.Hard: nwaves = 150; divquotient = 1; break; case Consts.Extreme: nwaves = 200; divquotient = 0.7; break; }; } } }//package fai
Section 9
//EffectGoal (fai.EffectGoal) package fai { public class EffectGoal extends Goal { public var engine:Engine;// = null public var sprite:AnimatedBitmap;// = null private var pause:int;// = 0 private var frame:int;// = 0 public function EffectGoal(_arg1:AnimatedBitmap, _arg2:Engine):void{ sprite = null; engine = null; pause = 0; frame = 0; super(); engine = _arg2; sprite = _arg1; } public function advance():void{ if (pause > 0){ pause--; return; }; if (frame >= sprite.nframes){ deactivate(); } else { sprite.setFrame(frame); frame++; pause = 1; return; }; } override public function deactivate():void{ super.deactivate(); if (sprite){ engine.bulletlayer.removeChild(sprite); sprite = null; }; } } }//package fai
Section 10
//Engine (fai.Engine) package fai { import flash.display.*; import flash.events.*; import flash.media.*; import flash.text.*; public class Engine { public var resourcelayer:Sprite;// = null public var camps:Array; public var gamewidth:int;// = 0 public var comp:Player;// = null public var events:GameEvents;// = null public var currentMap:LevelMap;// = null public var utypes:UnitTypes;// = null public var userid:int;// = 0 public var soft:Camp; public var paused:Boolean;// = false public var groundlayer:Sprite;// = null public var globalstage:MovieClip;// = null public var sloader:SmartLoader;// = null public var airlayer:Sprite;// = null public var unitlayer:Sprite;// = null private var backbitmaps:Array; public var menu:GameMenu;// = null public var maplayer:Sprite;// = null public var ccursor:MouseCursor;// = null public var mapheight:int;// = 0 public var airworld:MapMatrix;// = null public var bulletlayer:Sprite;// = null public var scenario:Scenario;// = null public var nechelons:int;// = 0 public var world:MapMatrix;// = null public var selectedUnits:Array; public var selshape:Shape;// = null public var score:int;// = 0 public var gamesid:String;// = "" public var gameheight:int;// = 0 public var scrollspeed:int; public var my:Player;// = null private var frozenUnits:Map;// = null public var wtxt:TextField;// = null public var difficulty:int;// = 0 public var logmsg:Array; public var goals:Array; public var money:int;// = 0 public var buildGrid:Shape;// = null public var backimage:AnimatedBitmap;// = null public var mapwidth:int;// = 0 private var counter:int;// = 0 public var actions:GameActions;// = null public static var stageRadius = 0; public function Engine(_arg1:MovieClip, _arg2:SmartLoader):void{ goals = new Array(); world = null; airworld = null; camps = new Array(); counter = 0; globalstage = null; maplayer = null; resourcelayer = null; unitlayer = null; groundlayer = null; airlayer = null; bulletlayer = null; selshape = null; backimage = null; ccursor = null; sloader = null; my = null; comp = null; soft = new Camp(); menu = null; utypes = null; money = 0; score = 0; paused = false; scenario = null; scrollspeed = Consts.defaultScrollSpeed; mapwidth = 0; mapheight = 0; gamewidth = 0; gameheight = 0; wtxt = null; actions = null; events = null; logmsg = new Array(); backbitmaps = new Array(); nechelons = 0; gamesid = ""; userid = 0; selectedUnits = new Array(); currentMap = null; frozenUnits = null; difficulty = 0; buildGrid = null; super(); gamewidth = 800; gameheight = 600; sloader = _arg2; sloader.engine = this; globalstage = _arg1; utypes = new UnitTypes(sloader); utypes.engine = this; KeyboardKeys.init(globalstage); actions = new GameActions(this); events = new GameEvents(this); } public function endSelection():void{ var _local1:int; var _local2:int; var _local3:int; var _local4:int; var _local5:Array; events.selecting = false; selshape.graphics.clear(); _local1 = (events.downPoint.x - unitlayer.mouseX); _local2 = (events.downPoint.y - unitlayer.mouseY); if ((((_local1 == 0)) || ((_local2 == 0)))){ return; }; _local3 = events.downPoint.x; _local4 = events.downPoint.y; if (_local2 > 0){ _local4 = unitlayer.mouseY; }; if (_local1 > 0){ _local3 = unitlayer.mouseX; }; _local5 = new Array(); my.camp.getUnderSelection(Math.floor(((_local3 / Consts.cellsize) + 0.5)), Math.floor(((_local4 / Consts.cellsize) + 0.5)), Math.floor(((Math.abs(_local1) / Consts.cellsize) + 0.5)), Math.floor(((Math.abs(_local2) / Consts.cellsize) + 0.5)), _local5); if (_local5.length > 0){ deselectUnits(); selectedUnits = _local5; updateMenu(); }; } public function isSelectedUnit(_arg1:Unit):Boolean{ if ((((selectedUnits.length == 1)) && ((selectedUnits[0] == _arg1)))){ return (true); }; return (false); } public function buildUnit(_arg1:String, _arg2:int, _arg3:int, _arg4:Boolean):Unit{ var _local5:Unit; var _local6:Camp; _local5 = utypes.createUnit(_arg1); _local5.pos.set(_arg2, _arg3); addUnit(_local5); if (((_arg4) && (!(_local5.flag(UnitFlags.Peaceful))))){ _local6 = ((_local5.mapid == Consts.myId)) ? comp.camp : my.camp; _local5.life.attack(_local6); }; return (_local5); } public function restart(_arg1:int):void{ difficulty = _arg1; events.register(); menu.reset(); menu.resources.update(); scenario.start(); actions.clear(true); updateMenu(); } private function fillWalls(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{ var _local5:int; var _local6:int; _local5 = _arg1; while (_local5 < _arg3) { _local6 = _arg2; while (_local6 < _arg4) { world.setxy(_local5, _local6, Consts.Wall); airworld.setxy(_local5, _local6, Consts.Wall); _local6++; }; _local5++; }; } private function removeUnit(_arg1:Unit):void{ var _local2:Camp; _local2 = null; if (_arg1.mapid == Consts.myId){ _local2 = my.camp; } else { if (_arg1.mapid == Consts.hostileId){ _local2 = comp.camp; } else { if (_arg1.mapid == Consts.softId){ _local2 = soft; }; }; }; if (_local2){ _local2.remove(_arg1); }; if (_arg1.flag(UnitFlags.Flying)){ airworld.setpos(_arg1.pos, 0); } else { if (((_arg1.flag(UnitFlags.Building)) && ((_arg1.spritewidth > Consts.cellsize)))){ setUnitPos(_arg1, 0); } else { world.setpos(_arg1.pos, 0); }; }; } public function moveEntireMap(_arg1:int, _arg2:int):void{ var _local3:int; var _local4:int; _local3 = (maplayer.x + _arg1); _local4 = (maplayer.y + _arg2); if (_arg1 != 0){ if (_local3 > 0){ maplayer.x = 0; } else { if ((Math.abs(_local3) + gamewidth) > (mapwidth * Consts.cellsize)){ maplayer.x = ((-(mapwidth) * Consts.cellsize) + gamewidth); } else { maplayer.x = _local3; }; }; }; if (_arg2 != 0){ if (_local4 > 0){ maplayer.y = 0; } else { if ((Math.abs(_local4) + gameheight) > (mapheight * Consts.cellsize)){ maplayer.y = ((-(mapheight) * Consts.cellsize) + gameheight); backimage.y = (Math.abs(((-(mapheight) * Consts.cellsize) + gameheight)) - (Consts.cellsize / 2)); } else { maplayer.y = _local4; backimage.y = (Math.abs(_local4) - (Consts.cellsize / 2)); }; }; }; } public function loadLevel(_arg1:LevelMap):void{ var _local2:Unit; var _local3:XMLList; var _local4:XML; mapwidth = _arg1.data.size.@width; mapheight = _arg1.data.size.@height; stageRadius = (Math.sqrt(((gamewidth * gamewidth) + (gameheight * gameheight))) / 3); world = new MapMatrix(mapwidth, mapheight); airworld = new MapMatrix(mapwidth, mapheight); createLayers(); fillWalls(0, 13, 23, 16); fillWalls(45, 13, 69, 16); my = new Player(this); comp = new Player(this); camps.length = 0; camps.push(my.camp); camps.push(comp.camp); _local2 = null; _local3 = _arg1.data.unit; for each (_local4 in _local3) { buildUnit(_local4.@type, _local4.@x, _local4.@y, true); }; nechelons = _arg1.data.scenario.nechelons.@value; wtxt = Utils.createTextField(0xFFFFFF, 12); wtxt.y = 30; globalstage.addChildAt(wtxt, 1); money = _arg1.data.scenario.smoney.@value; moveEntireMap(0, (-(mapheight) * Consts.cellsize)); } public function removeBuildCursor():void{ if (ccursor){ ccursor.remove(); unitlayer.removeChild(ccursor); ccursor = null; buildGrid.visible = false; }; } public function log(_arg1:String):void{ logmsg.push(_arg1); updateLog(); if (events.logTimer){ events.logTimer.start(); }; } public function playSound(_arg1:Sound, _arg2:Position):void{ var _local3:SoundTransform; var _local4:int; var _local5:int; var _local6:int; if (!menu.volume){ return; }; _local3 = new SoundTransform(); _local4 = ((Math.abs(unitlayer.x) + (gamewidth / 2)) - (_arg2.x * Consts.cellsize)); _local5 = ((Math.abs(unitlayer.y) + (gameheight / 2)) - (_arg2.y * Consts.cellsize)); _local6 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))); _local3.volume = (menu.volume / (1 + (_local6 / stageRadius))); _local3.pan = -((1 - (Math.abs(((Math.atan2(_local5, _local4) / Math.PI) * 180)) / 90))); _arg1.play(0, 0, _local3); } public function isUnitInSelection(_arg1:Unit):Boolean{ var _local2:Unit; for each (_local2 in selectedUnits) { if (_local2 == _arg1){ return (true); }; }; return (false); } private function createLayers():void{ var _local1:BitmapData; var _local2:int; var _local3:int; var _local4:int; _local1 = sloader.grounds["background.png"]; backimage = new AnimatedBitmap(_local1, _local1.width, _local1.height); maplayer = new Sprite(); globalstage.addChildAt(maplayer, 0); unitlayer = new Sprite(); unitlayer.x = (unitlayer.x + (Consts.cellsize / 2)); unitlayer.y = (unitlayer.y + (Consts.cellsize / 2)); maplayer.addChildAt(unitlayer, 0); backimage.x = (backimage.x - (Consts.cellsize / 2)); backimage.y = (backimage.y - (Consts.cellsize / 2)); unitlayer.addChildAt(backimage, 0); resourcelayer = new Sprite(); unitlayer.addChildAt(resourcelayer, 1); groundlayer = new Sprite(); unitlayer.addChildAt(groundlayer, 2); airlayer = new Sprite(); unitlayer.addChildAt(airlayer, 3); bulletlayer = new Sprite(); unitlayer.addChildAt(bulletlayer, 4); selshape = new Shape(); selshape.alpha = 0.3; unitlayer.addChildAt(selshape, 5); buildGrid = new Shape(); buildGrid.graphics.lineStyle(2, 0xFFFFFF); _local2 = 65; _local3 = 0; while (_local3 <= mapwidth) { if ((_local3 % 2) == 0){ buildGrid.graphics.moveTo(((_local3 * Consts.cellsize) - 4), _local2); buildGrid.graphics.lineTo(((_local3 * Consts.cellsize) - 4), (gameheight - 140)); }; _local3++; }; _local4 = 0; while (_local4 < (mapheight - 29)) { if ((_local4 % 2) == 0){ buildGrid.graphics.moveTo(0, ((_local4 * Consts.cellsize) + _local2)); buildGrid.graphics.lineTo((gamewidth - 192), ((_local4 * Consts.cellsize) + _local2)); }; _local4++; }; buildGrid.alpha = 0.15; globalstage.addChild(buildGrid); buildGrid.visible = false; } public function stopall():void{ var _local1:Unit; var _local2:int; if (scenario){ paused = true; scenario.stop(); scenario = null; events.unregister(); actions.clear(true); _local1 = null; _local2 = 0; _local2 = 0; while (_local2 < my.camp.units.length) { _local1 = my.camp.units[_local2]; _local1.life.destroy(true); _local2++; }; _local2 = 0; while (_local2 < comp.camp.units.length) { _local1 = comp.camp.units[_local2]; _local1.life.destroy(true); _local2++; }; _local2 = 0; while (_local2 < soft.units.length) { _local1 = soft.units[_local2]; _local1.life.destroy(true); _local2++; }; _local2 = 0; while (_local2 < goals.length) { if ((goals[_local2] is LifeGoal)){ goals[_local2].destroy(true); } else { if (goals[_local2].active){ goals[_local2].deactivate(); }; }; _local2++; }; goals.length = 0; world = null; airworld = null; camps.length = 0; counter = 0; frozenUnits = null; selshape.graphics.clear(); if (ccursor){ removeBuildCursor(); }; selectedUnits.length = 0; my.camp.units.length = 0; comp.camp.units.length = 0; soft.units.length = 0; utypes = null; money = 0; score = 0; menu.stat.reset(); mapwidth = 0; mapheight = 0; globalstage.removeChild(wtxt); wtxt = null; logmsg.length = 0; globalstage.removeChild(maplayer); unitlayer.removeChild(backimage); backimage = null; unitlayer.removeChild(groundlayer); groundlayer = null; unitlayer.removeChild(airlayer); airlayer = null; unitlayer.removeChild(bulletlayer); bulletlayer = null; unitlayer.removeChild(selshape); selshape = null; maplayer.removeChild(unitlayer); unitlayer = null; maplayer = null; if (buildGrid){ buildGrid.graphics.clear(); globalstage.removeChild(buildGrid); buildGrid = null; }; paused = false; }; } public function createBuildingCursor(_arg1:String):void{ var _local2:Unit; var _local3:AnimatedBitmap; if (ccursor){ removeBuildCursor(); }; _local2 = utypes.params(_arg1); _local3 = new AnimatedBitmap(sloader.getBody(_arg1), _local2.spritewidth, sloader.getBody(_arg1).height); ccursor = new MouseCursor(this, _arg1, _local3, _local2.eyerange, _local2.cost, _local2.spritewidth); ccursor.visible = events.mouseWithinMap; unitlayer.addChild(ccursor); buildGrid.visible = true; } public function runBullet(_arg1:Unit, _arg2:Unit, _arg3:Position):void{ var _local4:FirewallCircle; var _local5:BulletGoal; if (_arg1.flag(UnitFlags.Firewall)){ _local4 = new FirewallCircle(this, _arg1, _arg2); _local4.x = _arg1.sprite.x; _local4.y = _arg1.sprite.y; bulletlayer.addChild(_local4); } else { _local5 = new BulletGoal(_arg1, _arg2, _arg3, this); bulletlayer.addChild(_local5.bullet); goals[goals.length] = _local5; }; } private function setUnitPos(_arg1:Unit, _arg2:int):void{ var _local3:MapMatrix; var _local4:int; var _local5:int; var _local6:int; var _local7:int; _local3 = (_arg1.flag(UnitFlags.Flying)) ? airworld : world; _local4 = Math.floor(((_arg1.spritewidth / Consts.cellsize) + 0.5)); _local5 = Math.floor(((_arg1.sprite.height / Consts.cellsize) + 0.5)); _local6 = ((_arg1.pos.x - (_local4 / 2)) + 1); while (_local6 < ((_arg1.pos.x + (_local4 / 2)) + 1)) { _local7 = ((_arg1.pos.y - (_local5 / 2)) + 1); while (_local7 < ((_arg1.pos.y + (_local5 / 2)) + 1)) { if ((((((((_local6 < _local3.h)) && ((_local6 >= 0)))) && ((_local7 >= 0)))) && ((_local7 < _local3.v)))){ _local3.setxy(_local6, _local7, _arg2); }; _local7++; }; _local6++; }; } public function checkCursor():void{ var _local1:uint; var _local2:uint; var _local3:Boolean; var _local4:Boolean; var _local5:int; var _local6:int; var _local7:int; var _local8:int; if (ccursor != null){ _local1 = Math.floor(((unitlayer.mouseX / Consts.cellsize) + 0.5)); _local2 = Math.floor(((unitlayer.mouseY / Consts.cellsize) + 0.5)); _local3 = true; if ((_local1 % 2) == 0){ _local1--; }; if ((_local2 % 2) == 0){ _local2--; }; if (((!((ccursor.x == (_local1 * Consts.cellsize)))) || (!((ccursor.y == (_local2 * Consts.cellsize)))))){ ccursor.x = (_local1 * Consts.cellsize); ccursor.y = (_local2 * Consts.cellsize); if ((((((((_local2 < 17)) || ((_local2 > 58)))) || ((_local1 < 1)))) || ((_local1 > 65)))){ ccursor.setGood(false); ccursor.visible = true; return; }; ccursor.visible = true; if (ccursor.spritewidth > Consts.cellsize){ _local4 = false; _local5 = Math.floor(((ccursor.spritewidth / Consts.cellsize) + 0.5)); _local6 = Math.floor(((ccursor.bitmap.height / Consts.cellsize) + 0.5)); _local7 = ((_local1 - (_local5 / 2)) + 1); while (_local7 < ((_local1 + (_local5 / 2)) + 1)) { _local8 = ((_local2 - (_local6 / 2)) + 1); while (_local8 < ((_local2 + (_local6 / 2)) + 1)) { if ((((((((_local7 < world.h)) && ((_local7 >= 0)))) && ((_local8 >= 0)))) && ((_local8 < world.v)))){ if (world.getxy(_local7, _local8) != 0){ _local3 = false; _local4 = true; break; }; }; _local8++; }; if (_local4){ break; }; _local7++; }; } else { if (world.getxy(_local1, _local2) != 0){ _local3 = false; }; }; ccursor.setGood(_local3); }; }; } public function isBlocking(_arg1:String, _arg2:int, _arg3:int):Boolean{ var _local4:Astar; var _local5:int; var _local6:int; var _local7:int; var _local8:int; var _local9:int; var _local10:MapMatrix; var _local11:Boolean; _local4 = new Astar(world, Consts.myId); _local4.startSearch(new Position(0, 0), new Position(38, 61)); _local5 = utypes.params(_arg1).spritewidth; _local6 = Math.floor(((_local5 / Consts.cellsize) + 0.5)); _local7 = Math.floor(((_local5 / Consts.cellsize) + 0.5)); _local8 = 0; _local9 = 0; _local10 = new MapMatrix(_local6, _local7); _local8 = ((_arg2 - (_local6 / 2)) + 1); while (_local8 < ((_arg2 + (_local6 / 2)) + 1)) { _local9 = ((_arg3 - (_local7 / 2)) + 1); while (_local9 < ((_arg3 + (_local7 / 2)) + 1)) { if ((((((((_local8 < world.h)) && ((_local8 >= 0)))) && ((_local9 >= 0)))) && ((_local9 < world.v)))){ _local10.setxy((_local8 - int(((_arg2 - (_local6 / 2)) + 1))), (_local9 - int(((_arg3 - (_local7 / 2)) + 1))), world.getxy(_local8, _local9)); world.setxy(_local8, _local9, Consts.myId); }; _local9++; }; _local8++; }; _local11 = _local4.isPathExists(); _local8 = ((_arg2 - (_local6 / 2)) + 1); while (_local8 < ((_arg2 + (_local6 / 2)) + 1)) { _local9 = ((_arg3 - (_local7 / 2)) + 1); while (_local9 < ((_arg3 + (_local7 / 2)) + 1)) { if ((((((((_local8 < world.h)) && ((_local8 >= 0)))) && ((_local9 >= 0)))) && ((_local9 < world.v)))){ world.setxy(_local8, _local9, _local10.getxy((_local8 - int(((_arg2 - (_local6 / 2)) + 1))), (_local9 - int(((_arg3 - (_local7 / 2)) + 1))))); }; _local9++; }; _local8++; }; return (!(_local11)); } public function addResources(_arg1:int):void{ money = (money + _arg1); menu.resources.update(); } private function checkFrozenUnits():void{ var _local1:int; var _local2:int; var _local3:Unit; _local1 = 0; _local2 = 0; while (_local1 < frozenUnits.keys.length) { _local2 = frozenUnits.values[_local1]; _local2--; if (_local2 <= 0){ _local3 = frozenUnits.keys[_local1]; _local3.movesteps = utypes.params(_local3.type).movesteps; frozenUnits.keys.splice(_local1, 1); frozenUnits.values.splice(_local1, 1); } else { frozenUnits.values[_local1] = _local2; _local1++; }; }; } public function effect(_arg1:int, _arg2:int, _arg3:String):void{ var _local4:BitmapData; var _local5:AnimatedBitmap; var _local6:EffectGoal; _local4 = sloader.specials[_arg3]; _local5 = new AnimatedBitmap(_local4, _local4.height, _local4.height); _local5.x = _arg1; _local5.y = _arg2; bulletlayer.addChild(_local5); _local6 = new EffectGoal(_local5, this); goals[goals.length] = _local6; } public function froze(_arg1:Unit):void{ if (Consts.FrozenMoveSteps == _arg1.movesteps){ return; }; _arg1.movesteps = Consts.FrozenMoveSteps; frozenUnits.add(_arg1, Consts.FrozenTime); } public function destroyUnit(_arg1:Unit):void{ var _local2:uint; removeUnit(_arg1); if ((((_arg1.mapid == Consts.myId)) || ((_arg1.mapid == Consts.softId)))){ menu.stat.ilost++; } else { if (_arg1.mapid == Consts.hostileId){ menu.stat.ikilled++; score = (score + _arg1.cost); addResources(_arg1.deathcost); menu.resources.update(); }; }; if (isUnitInSelection(_arg1)){ deselectUnit(_arg1); }; if (ccursor){ checkCursor(); }; _local2 = 0; while (_local2 < goals.length) { if (goals[_local2].owner == _arg1){ goals[_local2].deactivate(); }; _local2++; }; _arg1.health = 0; _arg1.sprite.update(); } public function tick(_arg1:Event):void{ var _local2:uint; Astar.npasses = 300; _local2 = 0; while (_local2 < goals.length) { if (goals[_local2].active){ goals[_local2].advance(); }; _local2++; }; checkFrozenUnits(); if (!counter){ cleanGoals(); counter = Consts.GOALSCLEANPAUSE; } else { counter--; }; } public function loadMap(_arg1:LevelMap):void{ stopall(); utypes = new UnitTypes(sloader); utypes.engine = this; scenario = new Scenario(this); frozenUnits = new Map(); loadLevel(_arg1); currentMap = _arg1; } public function deselectUnits():void{ var _local1:Unit; if (selectedUnits.length > 0){ for each (_local1 in selectedUnits) { _local1.sprite.select(false); }; selectedUnits.length = 0; actions.clear(true); }; } public function playClick():void{ playSound(sloader.sounds[UnitTypes.soundclick], new Position(80, 50)); } public function hitUnit(_arg1:int, _arg2:Unit):void{ if (!_arg2.isLive()){ return; }; if (_arg2.mapid == Consts.hostileId){ score = (score + 1); }; _arg2.health = (_arg2.health - (_arg1 - _arg2.armor)); if (((_arg2.sprite.selection) && (_arg2.sprite.selection.visible))){ _arg2.updateHealth(); }; if (!_arg2.isLive()){ destroyUnit(_arg2); }; if (isUnitInSelection(_arg2)){ updateMenu(); }; menu.resources.update(); } public function updateLog():void{ var _local1:String; var _local2:String; while (logmsg.length > Consts.maxLogMsgs) { logmsg.shift(); }; _local1 = ""; for each (_local2 in logmsg) { _local1 = (_local1 + (_local2 + "\n")); }; wtxt.text = _local1; } public function addUnit(_arg1:Unit):void{ if (_arg1.flag(UnitFlags.Flying)){ airworld.setpos(_arg1.pos, _arg1.mapid); } else { if (((_arg1.flag(UnitFlags.Building)) && ((_arg1.spritewidth > Consts.cellsize)))){ setUnitPos(_arg1, _arg1.mapid); } else { world.setpos(_arg1.pos, _arg1.mapid); }; }; _arg1.activate(this); _arg1.sprite.x = (_arg1.pos.x * Consts.cellsize); _arg1.sprite.y = (_arg1.pos.y * Consts.cellsize); _arg1.sprite.visible = true; if (_arg1.mapid == Consts.myId){ my.camp.add(_arg1); } else { if (_arg1.mapid == Consts.hostileId){ comp.camp.add(_arg1); } else { if (_arg1.mapid == Consts.softId){ soft.add(_arg1); }; }; }; } public function isMoneyEnough(_arg1:String):Boolean{ return ((utypes.params(_arg1).cost <= money)); } public function updateMenu():void{ var _local1:Unit; for each (_local1 in selectedUnits) { if (_local1.isLive()){ _local1.updateHealth(); }; }; if (selectedUnits.length > 0){ if (actions.unitAction != ""){ menu.buttons.action(); } else { if (((ccursor) || (!((actions.currentAction == ""))))){ menu.buttons.action(); } else { if (selectedUnits[0].mapid != Consts.hostileId){ menu.buttons.showButtons(selectedUnits[0].type); } else { menu.buttons.hideButtons(); }; }; }; } else { if (((ccursor) || (!((actions.currentAction == ""))))){ menu.buttons.action(); } else { menu.buttons.hideButtons(); }; }; menu.updateInfo(); } public function upgradeUnit(_arg1:Unit):void{ var _local2:Unit; _local2 = utypes.params(_arg1.type); _arg1.upgradeLevel++; _arg1.health = (_arg1.health + (_local2.health * Consts.upgradeHExtra)); if (_arg1.mapid != Consts.hostileId){ _arg1.damage = (_arg1.damage + (_local2.damage * Consts.upgradeDExtra)); } else { if (_arg1.type == UnitTypes.hijacker){ _arg1.damage = (_arg1.damage + 1); }; }; if (_arg1.mapid != Consts.hostileId){ _arg1.sprite.update(); }; if (_arg1.mapid == Consts.softId){ _arg1.sprite.sprite.setFrame((_arg1.sprite.sprite.framen + 1)); }; if (isUnitInSelection(_arg1)){ updateMenu(); }; menu.resources.update(); } public function deselectUnit(_arg1:Unit):void{ var _local2:int; if (selectedUnits.length > 0){ if (isSelectedUnit(_arg1)){ _arg1.sprite.select(false); selectedUnits.length = 0; actions.clear(true); } else { _local2 = 0; while (_local2 < selectedUnits.length) { if (selectedUnits[_local2] == _arg1){ _arg1.sprite.select(false); selectedUnits.splice(_local2, 1); break; } else { _local2++; }; }; }; updateMenu(); }; } public function upgradeUnitToLevel(_arg1:Unit, _arg2:int):void{ var _local3:int; _local3 = 0; while (_local3 < _arg2) { upgradeUnit(_arg1); _local3++; }; } public function pause():void{ if (!paused){ log("Paused..."); events.unregister(); if (scenario){ scenario.thinktimer.stop(); }; } else { logmsg.pop(); updateLog(); events.register(); if (scenario){ scenario.thinktimer.start(); }; }; paused = !(paused); } private function cleanGoals():void{ var _local1:int; _local1 = 0; while (_local1 < goals.length) { if (!goals[_local1].active){ delete goals[_local1]; goals.splice(_local1, 1); } else { _local1++; }; }; } public function getUnitUnder(_arg1:Position):Unit{ var _local2:Unit; _local2 = comp.camp.getInMapUnder(_arg1); if (!_local2){ _local2 = my.camp.getInMapUnder(_arg1); }; return (_local2); } } }//package fai
Section 11
//GameActions (fai.GameActions) package fai { public class GameActions { private var engine:Engine;// = null public var currentAction:String;// = "" public var unitAction:String;// = "" public function GameActions(_arg1:Engine):void{ engine = null; currentAction = ""; unitAction = ""; super(); engine = _arg1; } public function doUnitAction():void{ clear(true); engine.updateMenu(); } private function buildConstruction(_arg1:String, _arg2:String):void{ engine.deselectUnits(); if (!engine.isMoneyEnough(_arg2)){ engine.log("Not enough money"); return; }; engine.menu.buttons.action(); engine.createBuildingCursor(_arg2); currentAction = _arg1; } public function doCurrentAction():void{ clear(true); engine.updateMenu(); engine.menu.resources.update(); } public function clear(_arg1:Boolean=false):void{ currentAction = ""; if (_arg1){ unitAction = ""; }; } private function effectAction(_arg1:int, _arg2:String):void{ if (engine.money < _arg1){ engine.log("Not enough money"); return; }; engine.menu.buttons.action(); currentAction = _arg2; } public function endAction():void{ switch (currentAction){ case UnitTypes.bantispyware: case UnitTypes.bantiadware: case UnitTypes.bantivirus: case UnitTypes.bgarbagecleaner: case UnitTypes.bfirewall: cancelBuildingConstruction(); break; default: clear(true); break; }; engine.updateMenu(); } public function buttonCommand(_arg1:String):void{ if (((engine.paused) || (!(engine.scenario.isRunning())))){ return; }; switch (_arg1){ case UnitTypes.bantispyware: buildConstruction(_arg1, UnitTypes.antispyware); break; case UnitTypes.bantiadware: buildConstruction(_arg1, UnitTypes.antiadware); break; case UnitTypes.bantivirus: buildConstruction(_arg1, UnitTypes.antivirus); break; case UnitTypes.bgarbagecleaner: buildConstruction(_arg1, UnitTypes.garbagecleaner); break; case UnitTypes.bfirewall: buildConstruction(_arg1, UnitTypes.firewall); break; case UnitTypes.bcancel: endAction(); break; }; } private function cancelBuildingConstruction():void{ var _local2 = engine; with (_local2) { if (ccursor){ removeBuildCursor(); }; }; clear(); } } }//package fai
Section 12
//GameButtons (fai.GameButtons) package fai { import flash.display.*; import flash.events.*; public class GameButtons extends Sprite { public var engine:Engine;// = null public var buttons:Map;// = null private var container:Sprite;// = null public var selectedUnit:Unit;// = null public function GameButtons(_arg1:Engine):void{ engine = null; buttons = null; container = null; selectedUnit = null; super(); engine = _arg1; buttons = new Map(); } public function onoutbutton(_arg1:MouseEvent):void{ if ((_arg1.currentTarget is ButtonSprite)){ _arg1.currentTarget.select(false); selectedUnit = null; engine.menu.updateInfo(); }; } public function create():void{ var _local1:int; var _local2:ButtonSprite; var _local3:int; container = new Sprite(); addChild(container); container.y = 2; _local1 = 45; _local2 = null; _local2 = createButton(UnitTypes.bantiadware, false, "1"); _local2 = createButton(UnitTypes.bantispyware, false, "2"); _local2.x = (_local1 + 1); _local2 = createButton(UnitTypes.bgarbagecleaner, false, "3"); _local2.x = ((_local1 + 1) * 2); _local2 = createButton(UnitTypes.bantivirus, false, "4"); _local2.x = ((_local1 + 1) * 3); _local2 = createButton(UnitTypes.bfirewall, false, "5"); _local2.y = (_local1 + 1); _local3 = 447; _local2 = createButton(UnitTypes.bcancel, true, "Esc"); _local2.x = ((_local1 + 1) * 3); _local2.y = (_local1 + 1); } public function onclick(_arg1:MouseEvent):void{ if (engine.paused){ return; }; engine.playClick(); if ((_arg1.currentTarget is ButtonSprite)){ engine.actions.buttonCommand(_arg1.currentTarget.type); }; } public function onoverbutton(_arg1:MouseEvent):void{ if ((_arg1.currentTarget is ButtonSprite)){ _arg1.currentTarget.select(true); showTooltip(_arg1.target.type); selectedUnit = engine.utypes.units[engine.utypes.buttonToUnit[_arg1.currentTarget.type]]; if (selectedUnit){ engine.menu.updateInfo(); }; }; } public function action():void{ hideButtons(); buttons.get(UnitTypes.bcancel).visible = true; } private function createButton(_arg1:String, _arg2:Boolean=false, _arg3:String=""):ButtonSprite{ var _local4:AnimatedBitmap; var _local5:ButtonSprite; _local4 = engine.sloader.getButton(_arg1); _local5 = new ButtonSprite(_arg1, _local4); _local5.addEventListener(MouseEvent.MOUSE_DOWN, onclick); _local5.addEventListener(MouseEvent.MOUSE_OVER, onoverbutton); _local5.addEventListener(MouseEvent.MOUSE_OUT, onoutbutton); container.addChild(_local5); if (_arg3 != ""){ _local5.makeHotKey(_arg3); }; if (_arg2){ _local5.visible = false; buttons.add(_arg1, _local5); }; return (_local5); } public function showTooltip(_arg1:String):void{ switch (_arg1){ }; } public function showButtons(_arg1:String):void{ hideButtons(); switch (_arg1){ default: break; }; } public function hideButtons():void{ var _local1:ButtonSprite; for each (_local1 in buttons.values) { _local1.visible = false; }; } } }//package fai import flash.display.*; import flash.text.*; class ButtonSprite extends Sprite { private var shaped:Shape; public var type:String;// = null private var shapes:Shape; private function ButtonSprite(_arg1:String, _arg2:AnimatedBitmap):void{ type = null; shaped = new Shape(); shapes = new Shape(); super(); Utils.drawRect(shaped, 2, 532555, 8954319, _arg2.width, _arg2.height, true); shaped.alpha = 0.5; addChild(shaped); shapes.visible = false; Utils.drawRect(shapes, 2, 532555, 14998899, _arg2.width, _arg2.height, true); shapes.alpha = 0.5; addChild(shapes); type = _arg1; addChild(_arg2); } public function select(_arg1:Boolean):void{ shaped.visible = !(_arg1); shapes.visible = _arg1; } public function makeHotKey(_arg1:String):void{ var _local2:TextField; _local2 = Utils.createTextField(0xFFFFFF, 10); _local2.text = _arg1; addChild(_local2); } }
Section 13
//GameEvents (fai.GameEvents) package fai { import flash.events.*; import flash.utils.*; import flash.ui.*; public class GameEvents { private var engine:Engine;// = null public var downPoint:Position; public var dragging:Boolean;// = false public var mouseWithinMap:Boolean;// = false public var logTimer:Timer;// = null public var selecting:Boolean;// = false public var cursorpos:Position; public function GameEvents(_arg1:Engine):void{ engine = null; mouseWithinMap = false; dragging = false; selecting = false; downPoint = new Position(); cursorpos = new Position(); logTimer = null; super(); engine = _arg1; } public function unregister():void{ engine.globalstage.stage.removeEventListener(Event.ENTER_FRAME, engine.tick); engine.globalstage.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); engine.globalstage.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onmoving); engine.unitlayer.removeEventListener(MouseEvent.MOUSE_DOWN, onmousedown); engine.unitlayer.removeEventListener(MouseEvent.MOUSE_UP, onmouseup); if (logTimer){ logTimer.removeEventListener(TimerEvent.TIMER, logHandler); logTimer.stop(); logTimer = null; }; } private function onmouseup(_arg1:MouseEvent):void{ dragging = false; if (selecting){ engine.endSelection(); }; } private function onKeyDown(_arg1:KeyboardEvent):void{ if ((((32 == _arg1.charCode)) || ((Keyboard.ESCAPE == _arg1.keyCode)))){ engine.removeBuildCursor(); engine.actions.clear(true); engine.updateMenu(); } else { switch (_arg1.charCode){ case 49: buildInCC(UnitTypes.bantiadware); break; case 50: buildInCC(UnitTypes.bantispyware); break; case 51: buildInCC(UnitTypes.bgarbagecleaner); break; case 52: buildInCC(UnitTypes.bantivirus); break; case 53: buildInCC(UnitTypes.bfirewall); break; default: engine.menu.onMenuKeyDown(_arg1.charCode); break; }; }; } public function onmousedown(_arg1:MouseEvent):void{ var mapx:*; var mapy:*; var building:*; var selunit:Unit; var event = _arg1; downPoint.x = engine.unitlayer.mouseX; downPoint.y = engine.unitlayer.mouseY; if (engine.ccursor != null){ var _local3 = engine; with (_local3) { if (paused){ return; }; if (ccursor.isGood()){ if (!isMoneyEnough(ccursor.type)){ log("Not enough money"); removeBuildCursor(); actions.clear(true); updateMenu(); return; }; mapx = Math.floor(((unitlayer.mouseX / Consts.cellsize) + 0.5)); mapy = Math.floor(((unitlayer.mouseY / Consts.cellsize) + 0.5)); if ((mapx % 2) == 0){ mapx--; }; if ((mapy % 2) == 0){ mapy--; }; if (isBlocking(ccursor.type, mapx, mapy)){ menu.blockingwnd.visible = true; menu.blockingwnd.gotoAndPlay("start"); return; }; money = (money - ccursor.cost); menu.stat.ispent = (menu.stat.ispent + ccursor.cost); menu.stat.ibuilt++; building = buildUnit(ccursor.type, mapx, mapy, true); updateMenu(); menu.resources.update(); ccursor.setGood(false); }; }; return; }; if (engine.actions.unitAction != ""){ engine.actions.doUnitAction(); } else { if (event.shiftKey){ dragging = true; } else { selunit = engine.my.camp.getUnder(downPoint); if (!selunit){ selunit = engine.comp.camp.getUnder(downPoint); if (!selunit){ selunit = engine.soft.getUnder(downPoint); }; }; if (selunit){ if (((((!(event.shiftKey)) || ((selunit.mapid == Consts.hostileId)))) || ((((engine.selectedUnits.length > 0)) && ((engine.selectedUnits[0].mapid == Consts.hostileId)))))){ engine.deselectUnits(); } else { if (((event.shiftKey) && (engine.isUnitInSelection(selunit)))){ engine.deselectUnit(selunit); return; }; }; engine.selectedUnits.push(selunit); engine.updateMenu(); } else { selecting = true; }; }; }; } public function buildInCC(_arg1:String):void{ engine.actions.buttonCommand(_arg1); engine.checkCursor(); } public function register():void{ engine.globalstage.stage.addEventListener(Event.ENTER_FRAME, engine.tick); engine.globalstage.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); engine.globalstage.stage.addEventListener(MouseEvent.MOUSE_MOVE, onmoving); engine.unitlayer.addEventListener(MouseEvent.MOUSE_DOWN, onmousedown); engine.unitlayer.addEventListener(MouseEvent.MOUSE_UP, onmouseup); logTimer = new Timer(3000, 0); logTimer.addEventListener(TimerEvent.TIMER, logHandler); if (engine.logmsg.length > 0){ logTimer.start(); }; } private function logHandler(_arg1:TimerEvent):void{ if (engine.logmsg.length > 0){ engine.logmsg.shift(); engine.updateLog(); if (!engine.logmsg.length){ logTimer.stop(); }; }; } private function onmoving(_arg1:MouseEvent):void{ var evt = _arg1; cursorpos.x = evt.stageX; cursorpos.y = evt.stageY; engine.checkCursor(); if (selecting){ if (!evt.buttonDown){ engine.endSelection(); return; }; var _local3 = engine.selshape.graphics; with (_local3) { clear(); lineStyle(1, 1804218); beginFill(6077415); drawRect(downPoint.x, downPoint.y, -((downPoint.x - engine.unitlayer.mouseX)), -((downPoint.y - engine.unitlayer.mouseY))); endFill(); }; }; } public function isSelectedType(_arg1:String):Boolean{ if (engine.selectedUnits.length != 1){ return (false); }; return ((engine.selectedUnits[0].type == _arg1)); } } }//package fai
Section 14
//GameMenu (fai.GameMenu) package fai { import flash.display.*; import flash.events.*; import flash.text.*; import flash.net.*; public class GameMenu extends Sprite { private var acceptCodes:Boolean;// = false public var remaining:TextField;// = null private var startbutton:StartMenuButton;// = null public var resources:Resources;// = null public var volume:Number;// = 1 public var riskinfo:RiskInfo;// = null public var blockingwnd:Blocking;// = null private var engine:Engine;// = null public var stat:Statistics;// = null private var buttonsparent:Sprite;// = null private var sendnext:WebButton;// = null public var buttons:GameButtons;// = null private var howtoplay:HowToPlay;// = null public var pausebutton:WebButton;// = null private var about:About;// = null public var uinfo:UnitInfoPanel;// = null public var startmenu:StartMenu;// = null private var volbutton:WebButton;// = null private var menuparent:Sprite;// = null public var softinfo:SoftInfoPanel;// = null private var aboutbutton:WebButton;// = null public static const fillColor:int = 8954319; public static const borderColor:int = 532555; public function GameMenu(_arg1:Engine):void{ engine = null; menuparent = null; buttonsparent = null; pausebutton = null; aboutbutton = null; volbutton = null; about = null; startmenu = null; stat = null; volume = 1; resources = null; buttons = null; uinfo = null; softinfo = null; acceptCodes = false; sendnext = null; remaining = null; startbutton = null; blockingwnd = null; riskinfo = null; howtoplay = null; super(); engine = _arg1; engine.menu = this; engine.globalstage.addChild(this); } public function onMenuKeyDown(_arg1:int):void{ if (acceptCodes){ switch (_arg1){ case 82: case 114: onButtonRepair(null); break; case 85: case 117: onButtonUpgrade(null); break; }; }; } public function victory():void{ stat.caption.text = "Victory!"; stat.subtitle.text = "Think about career in information security!"; stat.iscore = engine.score; stat.update(); engine.pause(); stat.visible = true; } public function updateInfo():void{ var _local1:Array; var _local2:Unit; var _local3:int; var _local4:int; var _local5:int; var _local6:int; var _local7:Boolean; uinfo.visible = false; softinfo.visible = false; unregisterButtons(); if (!buttons.selectedUnit){ _local1 = engine.selectedUnits; if (_local1.length > 0){ if (_local1[0].mapid == Consts.softId){ softinfo.visible = true; softinfo.showAbout(_local1[0]); registerButtons(); softinfo.upgradeButton.visible = (_local1[0].upgradeLevel < 2); _local2 = null; _local3 = 0; _local4 = 0; _local5 = 0; while (_local5 < _local1.length) { _local2 = engine.utypes.params(_local1[_local5].type); _local3 = (_local3 + RepairGoal.rcost(engine, _local1[_local5])); _local4 = (_local4 + ((_local2.cost * 0.8) * (_local1[_local5].upgradeLevel + 1))); _local5++; }; if (_local3 > 0){ softinfo.repairButton.visible = true; softinfo.repairButton.txt.text = (("Repair (R) - " + _local3.toString()) + "$"); } else { softinfo.repairButton.visible = false; }; if (softinfo.upgradeButton.visible){ softinfo.upgradeButton.txt.text = (("Update Soft (U) - " + _local4.toString()) + "$"); }; if (_local1.length > 1){ softinfo.title.text = (("Selected: " + _local1.length) + " software"); }; } else { uinfo.visible = true; uinfo.showAbout(_local1[0], (_local1[0].mapid == Consts.hostileId)); if (_local1[0].mapid != Consts.hostileId){ registerButtons(); _local2 = null; _local3 = 0; _local6 = 0; _local4 = 0; _local7 = false; _local5 = 0; while (_local5 < _local1.length) { _local2 = engine.utypes.params(_local1[_local5].type); if (_local1[_local5].upgradeLevel < 5){ _local7 = true; }; _local3 = (_local3 + RepairGoal.rcost(engine, _local1[_local5])); _local6 = (_local6 + (_local1[_local5].cost / 2)); _local4 = (_local4 + ((_local2.cost * 0.8) * (_local1[_local5].upgradeLevel + 1))); _local5++; }; if (_local7){ uinfo.upgradeButton.txt.text = (("Upgrade (U) - " + _local4.toString()) + "$"); } else { uinfo.upgradeButton.visible = false; }; if (_local3 > 0){ uinfo.repairButton.txt.text = (("Repair (R) - " + _local3.toString()) + "$"); } else { uinfo.repairButton.visible = false; }; uinfo.destroyButton.txt.text = (("Sell for " + _local6.toString()) + "$"); if (_local1.length > 1){ uinfo.title.text = (("Selected: " + _local1.length) + " defenders"); }; }; }; }; } else { uinfo.visible = true; uinfo.showAbout(buttons.selectedUnit, (buttons.selectedUnit.mapid == Consts.hostileId)); }; } public function create():void{ var _local1:BitmapData; var _local2:AnimatedBitmap; var _local3:WebButton; createParents(); buttons = new GameButtons(engine); buttonsparent.addChild(buttons); buttons.create(); uinfo = new UnitInfoPanel(engine); menuparent.addChild(uinfo); uinfo.y = 172; uinfo.x = 15; softinfo = new SoftInfoPanel(engine); menuparent.addChild(softinfo); softinfo.y = 172; softinfo.x = 15; _local1 = engine.sloader.grounds["windowheader.png"]; _local2 = new AnimatedBitmap(_local1, _local1.width, _local1.height); engine.globalstage.addChild(_local2); resources = new Resources(engine); engine.globalstage.addChild(resources); createButtons(); createMenus(); sendnext = new WebButton("Send Next Wave", 150, 20, 20, 0xFFFFFF, 10, 25, true); sendnext.y = 550; sendnext.x = 630; sendnext.addEventListener(MouseEvent.MOUSE_DOWN, sendNext); engine.globalstage.addChild(sendnext); remaining = Utils.createTextField(7456766, 11); remaining.text = "Remaining:"; remaining.x = 630; remaining.y = 575; engine.globalstage.addChild(remaining); remaining = Utils.createTextField(7456766, 11); remaining.text = "30 seconds"; remaining.x = 705; remaining.y = 575; engine.globalstage.addChild(remaining); blockingwnd = new Blocking(); engine.globalstage.addChild(blockingwnd); blockingwnd.visible = false; blockingwnd.stop(); blockingwnd.x = (blockingwnd.y = 212); riskinfo = new RiskInfo(); riskinfo.visible = false; engine.globalstage.addChild(riskinfo); howtoplay = new HowToPlay(); howtoplay.visible = false; _local3 = new WebButton("Close", 180, 27, 20, 0xFFFFFF, 15, 25, true); addChild(_local3); _local3.y = 555; _local3.x = 315; _local3.addEventListener(MouseEvent.MOUSE_DOWN, closeTutorial); howtoplay.addChild(_local3); engine.globalstage.addChild(howtoplay); } public function onabout(_arg1:MouseEvent):void{ if (((startmenu.visible) || (stat.visible))){ return; }; engine.playClick(); engine.pause(); about.visible = !(about.visible); } public function show():void{ visible = true; resources.visible = true; } private function onrestart(_arg1:MouseEvent):void{ var dif:*; var evt = _arg1; if (about.visible){ return; }; var _local3 = engine; with (_local3) { playClick(); dif = difficulty; loadMap(currentMap); restart(dif); }; } public function createMenus():void{ about = new About(); engine.globalstage.addChildAt(about, 2); about.x = 170; about.y = 100; about.closebutton.addEventListener(MouseEvent.CLICK, onabout); stat = new Statistics(); stat.mainmenu.addEventListener(MouseEvent.MOUSE_DOWN, onmenu); stat.closebutton.addEventListener(MouseEvent.MOUSE_DOWN, onmenu); stat.restart.addEventListener(MouseEvent.CLICK, onrestart); stat.savescore.addEventListener(MouseEvent.CLICK, onsavescore); stat.kongbutton.addEventListener(MouseEvent.MOUSE_DOWN, onplaymoregames); engine.globalstage.addChild(stat); stat.visible = false; stat.x = 180; stat.y = 80; startmenu = new StartMenu(engine); startmenu.y = 63; startmenu.gregbutton.addEventListener(MouseEvent.MOUSE_DOWN, onplaymoregames); engine.globalstage.addChild(startmenu); startbutton = new StartMenuButton(engine); startbutton.x = 10; startbutton.y = 552; engine.globalstage.addChild(startbutton); reset(); } public function onsavescore(_arg1:MouseEvent):void{ engine.sloader.saveScore(); } public function reset():void{ stat.reset(); } public function hide():void{ visible = false; resources.visible = false; } public function onplaymoregames(_arg1:MouseEvent):void{ var _local2:String; var _local3:URLRequest; _local2 = "http://www.kongregate.com/?gamereferral=masterofsecurity"; _local3 = new URLRequest(_local2); navigateToURL(_local3, "_blank"); } public function createParents():void{ var menuback:Shape; var menuwidth:int; var buttonswidth:int; var bshape:Shape; menuparent = new Sprite(); menuback = new Shape(); addChild(menuparent); menuparent.addChild(menuback); menuwidth = 186; menuback.alpha = 0.3; Utils.drawRect(menuback, 1, 0x666666, 0xEAEAEA, menuwidth, engine.gameheight); menuparent.x = ((engine.gamewidth - menuwidth) - 1); menuback.alpha = 0.01; buttonsparent = new Sprite(); buttonswidth = 141; bshape = new Shape(); var _local2 = bshape; with (_local2) { graphics.lineStyle(1, 3957386); graphics.beginFill(10993365); graphics.drawRoundRect(1, 0, (menuwidth - 2), 93, 20, 20); graphics.endFill(); }; bshape.alpha = 0.2; buttonsparent.addChild(bshape); buttonsparent.y = 40; menuparent.addChild(buttonsparent); } private function closeTutorial(_arg1:MouseEvent):void{ if (engine.scenario){ engine.scenario.show(); }; howtoplay.visible = false; } public function showTutorial():void{ if (engine.scenario){ engine.scenario.hide(); }; howtoplay.visible = true; } public function resumegame(_arg1:MouseEvent):void{ startmenu.visible = false; show(); if (engine.paused){ engine.pause(); }; } public function newgame(_arg1:MouseEvent):void{ startmenu.visible = false; } public function registerButtons():void{ uinfo.destroyButton.visible = true; uinfo.repairButton.visible = true; uinfo.upgradeButton.visible = true; uinfo.destroyButton.addEventListener(MouseEvent.CLICK, onButtonDestroy); uinfo.repairButton.addEventListener(MouseEvent.CLICK, onButtonRepair); uinfo.upgradeButton.addEventListener(MouseEvent.CLICK, onButtonUpgrade); softinfo.repairButton.addEventListener(MouseEvent.CLICK, onButtonRepair); softinfo.upgradeButton.addEventListener(MouseEvent.CLICK, onButtonUpgrade); acceptCodes = true; } public function unregisterButtons():void{ uinfo.destroyButton.visible = false; uinfo.repairButton.visible = false; uinfo.upgradeButton.visible = false; uinfo.destroyButton.removeEventListener(MouseEvent.CLICK, onButtonDestroy); uinfo.repairButton.removeEventListener(MouseEvent.CLICK, onButtonRepair); uinfo.upgradeButton.addEventListener(MouseEvent.CLICK, onButtonUpgrade); softinfo.repairButton.removeEventListener(MouseEvent.CLICK, onButtonRepair); softinfo.upgradeButton.addEventListener(MouseEvent.CLICK, onButtonUpgrade); acceptCodes = false; } private function sendNext(_arg1:MouseEvent):void{ engine.playClick(); engine.scenario.sendNext(); } public function onvolume(_arg1:MouseEvent):void{ if (volume >= 1){ volume = 0; } else { volume = (volume + 0.25); }; volbutton.txt.text = (("volume: " + (volume * 100)) + "%"); engine.playClick(); } public function onmenu(_arg1:MouseEvent):void{ startMenu(); } public function gameover():void{ stat.iscore = engine.score; stat.caption.text = "Game Over"; stat.subtitle.text = "Information security is a tough science..."; stat.update(); engine.pause(); stat.visible = true; } private function onButtonDestroy(_arg1:MouseEvent):void{ while (engine.selectedUnits.length > 0) { engine.addResources((engine.selectedUnits[0].cost / 2)); engine.destroyUnit(engine.selectedUnits[0]); }; } private function onButtonRepair(_arg1:MouseEvent):void{ var _local2:int; _local2 = 0; _local2 = 0; while (_local2 < engine.selectedUnits.length) { engine.selectedUnits[_local2].life.repair(); _local2++; }; } public function startMenu():void{ if (about.visible){ return; }; engine.playSound(engine.sloader.sounds[UnitTypes.soundstartmenu], new Position(50, 50)); if (startmenu.visible){ startbutton.enable(false); startmenu.visible = false; startmenu.stop(); if (((engine.scenario.isRunning()) && (engine.paused))){ engine.pause(); }; } else { startbutton.enable(true); startmenu.visible = true; startmenu.play(); if (((engine.scenario.isRunning()) && (!(stat.visible)))){ startmenu.buttonsVisible(false); engine.pause(); } else { if (stat.visible){ startmenu.buttonsVisible(true); stat.visible = false; }; }; }; } private function createButtons():void{ var _local1:int; _local1 = 0xFFFFFF; volbutton = new WebButton("volume: 100%", 90, 20, 20, _local1, 10, 25, false); volbutton.y = 2; volbutton.x = 1; volbutton.addEventListener(MouseEvent.MOUSE_DOWN, onvolume); menuparent.addChild(volbutton); aboutbutton = new WebButton("About", 85, 20, 20, _local1, 10, 25, false); aboutbutton.y = 2; aboutbutton.x = 100; aboutbutton.addEventListener(MouseEvent.MOUSE_DOWN, onabout); menuparent.addChild(aboutbutton); } private function onButtonUpgrade(_arg1:MouseEvent):void{ var _local2:int; var _local3:Unit; var _local4:Unit; var _local5:int; _local2 = 0; _local2 = 0; while (_local2 < engine.selectedUnits.length) { _local3 = engine.selectedUnits[_local2]; if ((((((Consts.myId == _local3.mapid)) && ((_local3.upgradeLevel >= 5)))) || ((((Consts.softId == _local3.mapid)) && ((_local3.upgradeLevel >= 2)))))){ } else { _local4 = engine.utypes.params(_local3.type); _local5 = ((_local4.cost * 0.8) * (_local3.upgradeLevel + 1)); if (engine.money < _local5){ engine.log("Not enough money"); } else { engine.money = (engine.money - _local5); engine.upgradeUnit(_local3); }; }; _local2++; }; } } }//package fai import flash.display.*; import flash.text.*; class About extends Sprite { public var closebutton:Sprite;// = null private var mentart:TextField;// = null private var author:TextField;// = null private var caption:TextField;// = null private var back:Shape;// = null private var version:TextField;// = null private static const xoffset:int = 10; private function About():void{ var cbsize:int; var tf:TextFormat; back = null; caption = null; version = null; author = null; mentart = null; closebutton = null; super(); visible = false; back = new Shape(); var _local2 = back; with (_local2) { graphics.beginFill(0); graphics.drawRoundRect(0, 0, 280, 220, 15, 15); graphics.endFill(); alpha = 0.7; }; addChild(back); closebutton = new Sprite(); cbsize = 20; _local2 = closebutton; with (_local2) { graphics.beginFill(0); graphics.drawRoundRect(0, 0, cbsize, cbsize, 5, 5); graphics.endFill(); alpha = 0.5; graphics.lineStyle(1, 0xFFFFFF); graphics.moveTo(2, 2); graphics.lineTo((cbsize - 2), (cbsize - 2)); graphics.moveTo((cbsize - 2), 2); graphics.lineTo(2, (cbsize - 2)); }; closebutton.x = ((280 - cbsize) - 1); closebutton.y = 1; addChild(closebutton); caption = Utils.createTextField(0xFFFFFF, 16); caption.x = 55; tf = caption.defaultTextFormat; tf.underline = true; caption.defaultTextFormat = tf; caption.text = "Master of Security"; addChild(caption); version = Utils.createTextField(0xFFFFFF, 12); tf = version.defaultTextFormat; tf.bold = false; tf.italic = true; version.defaultTextFormat = tf; version.text = "version 1.1"; version.x = (xoffset + 90); version.y = (caption.height + 10); addChild(version); author = createStatElement(15825434, 12); author.y = 80; author.x = 70; author.text = "Author Anton Fedoruk\nCopyright (c) 2008.\nAll Rights Reserved."; mentart = createStatElement(15943950, 12); mentart.y = 160; mentart.x = 80; tf = mentart.defaultTextFormat; tf.url = "mailto:gmentat@gmail.com"; tf.underline = true; tf.italic = true; mentart.defaultTextFormat = tf; mentart.text = "Contact Author"; } private function createStatElement(_arg1:int, _arg2:int):TextField{ var _local3:TextField; _local3 = Utils.createTextField(_arg1, _arg2); _local3.x = xoffset; addChild(_local3); return (_local3); } } class ButtonSprite extends Sprite { private var shaped:Shape; public var bitmap:AnimatedBitmap;// = null private var shapes:Shape; public var suite:String;// = null private function ButtonSprite(_arg1:String, _arg2:AnimatedBitmap):void{ suite = null; bitmap = null; shaped = new Shape(); shapes = new Shape(); super(); shaped.graphics.lineStyle(2, 532555); shaped.graphics.beginFill(8954319); shaped.graphics.drawRoundRect(0, 0, _arg2.width, _arg2.height, (_arg2.width / 5), (_arg2.height / 5)); shaped.graphics.endFill(); shaped.alpha = 0.5; addChild(shaped); shapes.visible = false; shapes.graphics.lineStyle(2, 532555); shapes.graphics.beginFill(14998899); shapes.graphics.drawRoundRect(0, 0, _arg2.width, _arg2.height, (_arg2.width / 5), (_arg2.height / 5)); shapes.graphics.endFill(); shapes.alpha = 0.5; addChild(shapes); suite = _arg1; bitmap = _arg2; addChild(_arg2); } public function select(_arg1:Boolean):void{ shaped.visible = !(_arg1); shapes.visible = _arg1; } }
Section 15
//Goal (fai.Goal) package fai { public class Goal { public var owner:Unit;// = null public var active:Boolean;// = true public function Goal(){ active = true; owner = null; super(); } public function deactivate():void{ active = false; } } }//package fai
Section 16
//KeyboardKeys (fai.KeyboardKeys) package fai { import flash.events.*; public class KeyboardKeys { private static var initialized:Boolean = false; private static var keys:Object = new Object(); public static function init(_arg1):void{ _arg1.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed); _arg1.stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased); initialized = true; } private static function keyPressed(_arg1:KeyboardEvent):void{ keys[_arg1.keyCode] = true; } public static function isDown(_arg1:uint):Boolean{ if (!initialized){ return (false); }; if (Boolean((_arg1 in keys))){ return (keys[_arg1]); }; return (false); } private static function keyReleased(_arg1:KeyboardEvent):void{ keys[_arg1.keyCode] = false; } } }//package fai
Section 17
//LevelMap (fai.LevelMap) package fai { public class LevelMap { public var desc:String;// = null public var diff:String;// = null public var data:XML;// = null public var nechelons:int;// = 0 public var title:String;// = null public function LevelMap(_arg1:XML):void{ data = null; title = null; desc = null; nechelons = 0; diff = null; super(); data = _arg1; title = data.title.toString(); desc = data.desc.toString(); nechelons = int(data.scenario.nechelons.@value); diff = data.difficulty.toString(); if (!diff.length){ diff = "Normal"; }; } public function diffColor():int{ switch (diff){ case "Easy": return (5098747); case "Hard": return (0xFF0000); }; return (10925256); } } }//package fai
Section 18
//LifeGoal (fai.LifeGoal) package fai { public class LifeGoal extends Goal { private var engine:Engine;// = null public var goals:Array;// = null private var attackgoal:AttackGoal;// = null public var repairgoal:RepairGoal;// = null private var counter:int;// = 0 public var waitingMove:MoveGoal;// = null public function LifeGoal(_arg1:Engine, _arg2:Unit):void{ attackgoal = null; repairgoal = null; goals = null; waitingMove = null; engine = null; counter = 0; super(); owner = _arg2; engine = _arg1; goals = new Array(); } public function attack(_arg1:Camp):void{ if (attackgoal){ attackgoal.deactivate(); attackgoal = null; }; attackgoal = new AttackGoal(owner, _arg1); } public function advance():void{ var _local1:uint; var _local2:Boolean; if (repairgoal){ if (repairgoal.active){ repairgoal.advance(); } else { repairgoal = null; }; }; if (attackgoal){ attackgoal.advance(); }; _local1 = 0; _local2 = false; while (_local1 < goals.length) { if (goals[_local1].active){ if ((goals[_local1] is MoveGoal)){ _local2 = true; }; goals[_local1].advance(); _local1++; } else { delete goals[_local1]; goals.splice(_local1, 1); }; }; if (!_local2){ if (attackgoal){ attackgoal.paused = false; }; }; } public function repair():void{ if (repairgoal){ repairgoal.deactivate(); repairgoal = null; engine.updateMenu(); return; }; repairgoal = new RepairGoal(owner, engine); } public function move(_arg1:Position, _arg2:Boolean=false):void{ var _local3:*; var _local4:MoveGoal; for each (_local3 in goals) { if ((_local3 is MoveGoal)){ _local3.deactivate(); }; }; _local4 = new MoveGoal(owner, engine); _local4.setMoveTarget(_arg1, _arg2); goals[goals.length] = _local4; if (_arg2){ if (attackgoal){ attackgoal.clearPreciseTarget(); attackgoal.paused = true; }; } else { if (attackgoal){ attackgoal.paused = false; }; }; } public function destroy(_arg1:Boolean=false):void{ var _local2:int; _local2 = 0; while (_local2 < goals.length) { if (goals[_local2].active){ goals[_local2].deactivate(); }; _local2++; }; goals.length = 0; if (repairgoal){ repairgoal.deactivate(); repairgoal = null; }; if (attackgoal){ attackgoal.deactivate(); attackgoal = null; }; if (((_arg1) && (owner))){ if (owner.flag(UnitFlags.Flying)){ engine.airlayer.removeChild(owner.sprite); } else { engine.groundlayer.removeChild(owner.sprite); }; owner.destroy(); owner = null; active = false; }; } public function stop():void{ var _local1:*; for each (_local1 in goals) { if ((_local1 is MoveGoal)){ _local1.deactivate(); }; }; if (attackgoal){ attackgoal.clearPreciseTarget(); }; } override public function deactivate():void{ if (owner){ destroy(); goals.push(new DieGoal(owner, engine, this)); }; } public function setAttackTarget(_arg1:Unit):void{ if (_arg1 == owner){ engine.log("I can't attack myself."); return; }; if (attackgoal){ attackgoal.clearPreciseTarget(); attackgoal.preciseTarget = _arg1; }; } } }//package fai
Section 19
//Map (fai.Map) package fai { public class Map { public var values:Array; protected var index_:int;// = 0 public var keys:Array; public function Map(){ keys = new Array(); values = new Array(); index_ = 0; super(); } public function add(_arg1:Object, _arg2):void{ index_ = 0; find(_arg1); keys.splice(index_, 0, _arg1); values.splice(index_, 0, _arg2); } public function empty():Boolean{ return ((keys.length == 0)); } public function shift(){ var _local1:*; _local1 = values.shift(); keys.shift(); return (_local1); } public function remove(_arg1:Object):void{ if (find(_arg1)){ keys.splice(index_, 1); values.splice(index_, 1); }; } public function size():int{ return (keys.length); } public function pop(){ var _local1:*; _local1 = values.pop(); keys.pop(); return (_local1); } public function get(_arg1:Object){ if (!find(_arg1)){ return (null); }; return (values[index_]); } public function getout(_arg1:Object){ var _local2:*; if (!find(_arg1)){ return (null); }; _local2 = values[index_]; values.splice(index_, 1); keys.splice(index_, 1); return (_local2); } public function find(_arg1:Object):Boolean{ var _local2:int; var _local3:int; _local2 = 0; _local3 = (keys.length - 1); while (_local2 <= _local3) { index_ = ((_local2 + _local3) >> 1); if (_arg1 < keys[index_]){ _local3 = (index_ - 1); } else { if (_arg1 > keys[index_]){ _local2 = (index_ + 1); } else { return (true); }; }; }; index_ = _local2; return (false); } public function clear():void{ keys.length = 0; values.length = 0; index_ = 0; } } }//package fai
Section 20
//MapMatrix (fai.MapMatrix) package fai { public class MapMatrix { public var matrix:Array; public var v:uint; public var h:uint; public function MapMatrix(_arg1:uint, _arg2:uint):void{ var _local3:int; var _local4:int; matrix = new Array(); super(); h = _arg1; v = _arg2; _local3 = 0; while (_local3 < (v + 5)) { matrix.push(new Array((h + 5))); _local4 = 0; while (_local4 < (h + 5)) { matrix[(matrix.length - 1)][_local4] = 0; _local4++; }; _local3++; }; } public function setxy(_arg1:uint, _arg2:uint, _arg3:uint):void{ matrix[_arg2][_arg1] = _arg3; } public function getxy(_arg1:uint, _arg2:uint):uint{ return (matrix[_arg2][_arg1]); } public function clear():void{ var _local1:int; var _local2:int; _local1 = 0; while (_local1 < v) { _local2 = 0; while (_local2 < h) { matrix[_local1][_local2] = 0; _local2++; }; _local1++; }; } public function setpos(_arg1:Position, _arg2:uint):void{ matrix[_arg1.y][_arg1.x] = _arg2; } public function getpos(_arg1:Position):uint{ return (matrix[_arg1.y][_arg1.x]); } } }//package fai
Section 21
//Maps (fai.Maps) package fai { public class Maps { public static const maps:XML = <maps> <level number='0'> <size width='68' height='75'/> <unit type='Control Panel' x='3' y='64'/> <unit type='Mail Client' x='10' y='64'/> <unit type='Browser' x='17' y='64'/> <unit type='Documents Folder' x='24' y='64'/> <unit type='Games Folder' x='31' y='64'/> <unit type='Internet Messenger' x='38' y='64'/> <unit type='Music Player' x='45' y='64'/> <unit type='System Registry' x='52' y='64'/> <unit type='Recycle Bin' x='62' y='64'/> <scenario> <smoney value='150'/> <nechelons value='2'/> </scenario> </level> </maps> ; } }//package fai
Section 22
//MouseCursor (fai.MouseCursor) package fai { import flash.display.*; import flash.text.*; public class MouseCursor extends Sprite { private var goodshape:Shape;// = null public var isBuilding:Boolean;// = false public var bitmap:AnimatedBitmap;// = null public var type:String;// = null public var spritewidth:int;// = 0 private var engine:Engine;// = null private var msg:TextField;// = null private var badshape:Shape;// = null public var cost:uint;// = 0 public function MouseCursor(_arg1:Engine, _arg2:String, _arg3:AnimatedBitmap, _arg4:uint, _arg5:uint, _arg6:int):void{ engine = null; bitmap = null; type = null; badshape = null; goodshape = null; cost = 0; msg = null; spritewidth = 0; isBuilding = false; super(); engine = _arg1; type = _arg2; isBuilding = engine.utypes.params(type).flag(UnitFlags.Building); cost = _arg5; bitmap = new AnimatedBitmap(_arg3.curbuffer, _arg3.width, _arg3.height); spritewidth = _arg6; addChild(bitmap); bitmap.x = (bitmap.x - (_arg3.width / 2)); bitmap.y = (bitmap.y - (_arg3.height / 2)); if (!_arg4){ _arg4 = 1; }; goodshape = new Shape(); drawEyeRange(0xEAEAEA, goodshape, _arg4); addChild(goodshape); badshape = new Shape(); badshape.visible = false; drawEyeRange(0xFF0000, badshape, _arg4); addChild(badshape); msg = Utils.createTextField(0xD8D8D8, 10); msg.text = "Select place for the shield"; msg.y = (msg.height * 2); msg.x = (msg.x - (msg.width / 2)); addChild(msg); } public function isGood():Boolean{ return (goodshape.visible); } public function setGood(_arg1:Boolean):void{ goodshape.visible = _arg1; badshape.visible = !(_arg1); } public function remove():void{ removeChild(bitmap); removeChild(goodshape); removeChild(badshape); } public function drawEyeRange(_arg1:uint, _arg2:Shape, _arg3:uint):void{ var _local4:uint; var _local5:uint; _local4 = 0x666666; _local5 = 0; _arg2.graphics.lineStyle(_local5, _local4); _arg2.graphics.beginFill(_arg1); _arg2.graphics.drawCircle(0, 0, (_arg3 * Consts.cellsize)); _arg2.graphics.endFill(); _arg2.alpha = 0.1; } } }//package fai
Section 23
//MoveGoal (fai.MoveGoal) package fai { public class MoveGoal extends Goal { private var engine:Engine;// = null public var pathindex:uint;// = 0 public var target:Position; public var world:MapMatrix;// = null private var nchecks:int;// = 0 public var path:Array; private var ntries:int;// = 0 private var searchRange:uint;// = 0 private var pause:uint;// = 0 public var astar:Astar;// = null private var forcemove:Boolean;// = false public static const FindNearPlaceTries:uint = 8; public static const PAUSE:uint = 3; public static const MaxSearchTries:uint = 300; public static const MaxChecks:uint = 2; public function MoveGoal(_arg1:Unit, _arg2:Engine):void{ target = new Position(); path = new Array(); pathindex = 0; world = null; pause = 0; ntries = 0; nchecks = 0; astar = null; forcemove = false; searchRange = 0; engine = null; super(); engine = _arg2; owner = _arg1; if (owner.flag(UnitFlags.Flying)){ world = engine.airworld; } else { world = engine.world; }; astar = new Astar(world, Consts.myId); if (owner.type == UnitTypes.hijacker){ astar.checkxy = astar.checknotempty; } else { astar.checkxy = astar.checkwallid; }; } public function advance():void{ var _local1:int; var _local2:int; var _local3:Unit; var _local4:uint; if (Consts.MOVING == owner.cstate){ owner.move(); } else { if (Consts.IDLE == owner.cstate){ if (target.isequal(owner.pos)){ if (owner.mapid == Consts.hostileId){ if (engine.scenario.hitSoft(owner)){ owner.sprite.visible = false; engine.destroyUnit(owner); }; }; deactivate(); } else { if (pause > 0){ pause--; if (!pause){ if (path.length){ _local1 = world.getpos(path[pathindex]); _local2 = MaxChecks; if (_local1){ if (Consts.hostileId == _local1){ _local3 = engine.comp.camp.getInMapUnder(path[pathindex]); if (((!((_local3 == null))) && ((_local3.type == UnitTypes.hijacker)))){ _local2 = 1; } else { _local2 = 80; }; }; nchecks++; if (nchecks >= _local2){ astar.checkxy = astar.checknotempty; setMoveTarget(target, false); nchecks = 0; }; } else { nchecks = 0; }; } else { nchecks = 0; }; }; } else { if (path.length > 0){ _local4 = world.getpos(path[pathindex]); if (((!(owner.pos.isequal(path[pathindex]))) && (!((_local4 == 0))))){ if (Consts.Wall == _local4){ setMoveTarget(target, false); } else { pause = PAUSE; return; }; } else { owner.startmove(path[pathindex]); world.setpos(path[pathindex], owner.mapid); pathindex++; owner.move(); }; } else { keepSearching(); }; }; }; }; }; } public function setMoveTarget(_arg1:Position, _arg2:Boolean):void{ path.length = 0; pathindex = 0; target.copy(_arg1); if (((forcemove) || (_arg2))){ forcemove = _arg2; }; if (!astar.startSearch(owner.pos, target)){ deactivate(); } else { target.copy(astar.destination); }; } private function keepSearching():void{ var _local1:int; var _local2:int; var _local3:Number; var _local4:Number; if (!astar.search(path)){ ntries++; if (ntries >= MaxSearchTries){ deactivate(); } else { if (ntries >= FindNearPlaceTries){ searchRange++; astar.destination = new Position(); astar.findNearPlace(target, searchRange); if (astar.destination){ target.copy(astar.destination); }; }; setMoveTarget(target, false); pause = PAUSE; }; } else { if (path.length > 0){ nchecks = (ntries = 0); _local1 = Math.floor(((owner.sprite.x / Consts.cellsize) + 0.5)); _local2 = Math.floor(((owner.sprite.y / Consts.cellsize) + 0.5)); if (((!((_local1 == owner.pos.x))) || (!((_local2 == owner.pos.y))))){ _local3 = Math.sqrt((((target.x - _local1) * (target.x - _local1)) + ((target.y - _local2) * (target.y - _local2)))); _local4 = Math.sqrt((((target.x - owner.pos.x) * (target.x - owner.pos.x)) + ((target.y - owner.pos.y) * (target.y - owner.pos.y)))); if (_local4 < _local3){ path.unshift(new Position(owner.pos.x, owner.pos.y)); }; }; }; }; } private function cleanup():void{ if (owner){ astar = null; if ((((((pathindex > 0)) && (path.length))) && (!(owner.pos.isequal(path[(pathindex - 1)]))))){ world.setpos(path[(pathindex - 1)], 0); }; if (owner.cstate == Consts.MOVING){ owner.cstate = Consts.IDLE; }; owner = null; path.length = 0; }; } override public function deactivate():void{ super.deactivate(); cleanup(); } } }//package fai
Section 24
//Player (fai.Player) package fai { public class Player { public var camp:Camp; private var engine:Engine;// = null public function Player(_arg1:Engine):void{ engine = null; camp = new Camp(); super(); engine = _arg1; } public function attackTarget(_arg1:Position):void{ var _local2:Unit; var _local3:Unit; moveUnits(_arg1, false); _local2 = engine.getUnitUnder(_arg1); if (_local2){ for each (_local3 in engine.selectedUnits) { if (!_local3.flag(UnitFlags.Peaceful)){ _local3.life.setAttackTarget(_local2); }; }; }; } public function stopUnits():void{ var _local1:Unit; for each (_local1 in engine.selectedUnits) { _local1.life.stop(); }; } public function moveUnits(_arg1:Position, _arg2:Boolean):void{ var _local3:Unit; for each (_local3 in engine.selectedUnits) { if (!_local3.flag(UnitFlags.Building)){ _local3.life.move(_arg1, _arg2); }; }; } } }//package fai
Section 25
//Position (fai.Position) package fai { public class Position { public var x:int;// = 0 public var y:int;// = 0 public function Position(_arg1:int=0, _arg2:int=0):void{ x = 0; y = 0; super(); set(_arg1, _arg2); } public function copy(_arg1:Position):void{ x = _arg1.x; y = _arg1.y; } public function set(_arg1:int, _arg2:int):void{ x = _arg1; y = _arg2; } public function isequal(_arg1:Position):Boolean{ return ((((x == _arg1.x)) && ((y == _arg1.y)))); } } }//package fai
Section 26
//RepairGoal (fai.RepairGoal) package fai { public class RepairGoal extends Goal { private var engine:Engine;// = null private var unitcost:int;// = 0 private var life:int;// = 0 public function RepairGoal(_arg1:Unit, _arg2:Engine):void{ unitcost = 0; life = 0; engine = null; super(); owner = _arg1; engine = _arg2; life = engine.utypes.params(owner.type).health; life = (life + ((life * _arg1.upgradeLevel) * Consts.upgradeHExtra)); if (life == owner.health){ deactivate(); return; }; unitcost = (owner.cost - ((owner.cost * owner.health) / life)); if (((!(unitcost)) && (owner.cost))){ unitcost = 1; }; if (engine.money < unitcost){ engine.log("Not enough resources for repair"); } else { engine.money = (engine.money - unitcost); engine.menu.resources.update(); owner.health = life; if (engine.isUnitInSelection(owner)){ engine.updateMenu(); }; }; deactivate(); } public function advance():void{ } public static function rcost(_arg1, _arg2:Unit):int{ var _local3:int; var _local4:int; _local3 = _arg1.utypes.params(_arg2.type).health; _local3 = (_local3 + ((_local3 * _arg2.upgradeLevel) * Consts.upgradeHExtra)); if (_arg2.health == _local3){ return (0); }; _local4 = (_arg2.cost - ((_arg2.cost * _arg2.health) / _local3)); if (((!(_local4)) && (_arg2.cost))){ _local4 = 1; }; return (_local4); } } }//package fai
Section 27
//Scenario (fai.Scenario) package fai { import flash.events.*; import flash.text.*; import flash.utils.*; public class Scenario { public var engine:Engine;// = null private var enemy:int;// = 0 private var difparams:DifficultyParams;// = null public var thinktimer:Timer;// = null private var threats:Threats;// = null private var sm:SecurityMon;// = null private var tpos:Position;// = null private var targetSoft:Unit;// = null public var pause:int;// = 0 private static const PAUSE:int = 30; private static const EnemyCount:int = 10; private static const MaxCountForSendNext:int = 50; public function Scenario(_arg1:Engine):void{ engine = null; thinktimer = null; pause = 0; threats = null; enemy = 0; sm = null; targetSoft = null; tpos = null; difparams = null; super(); engine = _arg1; engine.scenario = this; } private function liveCount():int{ var _local1:int; var _local2:int; var _local3:Unit; _local1 = 0; _local2 = 0; while (_local2 < engine.comp.camp.units.length) { _local3 = engine.comp.camp.units[_local2]; if ((((_local3.mapid == Consts.hostileId)) && (_local3.isLive()))){ _local1++; }; _local2++; }; return (_local1); } public function stop():void{ if (thinktimer){ thinktimer.stop(); thinktimer.removeEventListener(TimerEvent.TIMER, thinkHandler); thinktimer = null; }; if (threats){ threats.clear(); engine.globalstage.removeChild(threats); }; if (sm){ engine.globalstage.removeChild(sm); }; } private function retarget():Position{ var _local1:Position; if (!tpos){ targetSoft = engine.soft.getNearestById(Consts.softId, new Position(35, 61)); } else { targetSoft = engine.soft.getNearestById(Consts.softId, tpos); }; if (!targetSoft){ return (null); }; _local1 = new Position(targetSoft.pos.x, targetSoft.pos.y); while (engine.world.getpos(_local1)) { _local1.y--; if (_local1.y <= 0){ return (null); }; }; return (_local1); } public function show():void{ if (sm){ sm.visible = true; }; if (threats){ threats.visible = true; }; } public function hide():void{ if (sm){ sm.visible = false; }; if (threats){ threats.visible = false; }; } private function makeEnemies():void{ var _local1:Number; var _local2:int; var _local3:int; var _local4:int; var _local5:Boolean; var _local6:MapMatrix; var _local7:String; var _local8:int; var _local9:int; var _local10:int; var _local11:Unit; _local1 = difparams.divquotient; if (threats.curlevel < 6){ _local1 = (difparams.divquotient * 1.5); } else { if (threats.curlevel < 10){ _local1 = (difparams.divquotient * 1.3); }; }; _local2 = int((threats.curlevel / _local1)); _local3 = 0; _local4 = EnemyCount; _local5 = false; if (enemy >= Threats.enemies.length){ enemy = 0; _local5 = true; _local4 = 1; }; _local6 = null; tpos = retarget(); if (!tpos){ return; }; engine.playSound(engine.sloader.sounds[UnitTypes.soundenemiesappearing], new Position(50, 10)); _local7 = Threats.enemies[enemy]; if (_local5){ _local9 = ((Math.floor((threats.curlevel / Threats.enemies.length)) - 1) % Threats.enemies.length); if (_local9 >= Threats.enemies.length){ _local9 = (Threats.enemies.length - 1); } else { if (_local9 < 0){ _local9 = 0; }; }; _local7 = Threats.enemies[_local9]; }; if ((((UnitTypes.spam == _local7)) && (!(_local5)))){ _local4 = (_local4 * 2); } else { if ((((UnitTypes.virus == _local7)) && (!(_local5)))){ _local4 = 5; }; }; _local8 = 0; while (_local8 < engine.mapheight) { _local10 = 3; while (_local10 < engine.mapwidth) { _local6 = (engine.utypes.params(_local7).flag(UnitFlags.Flying)) ? engine.airworld : engine.world; if (!_local6.getxy(_local10, _local8)){ _local11 = engine.buildUnit(_local7, _local10, _local8, true); if (_local5){ if (UnitTypes.virus == _local11.type){ engine.upgradeUnitToLevel(_local11, (_local2 * 5)); } else { engine.upgradeUnitToLevel(_local11, (_local2 * 10)); }; _local11.deathcost = 100; if (_local11.type == UnitTypes.hijacker){ _local11.damage = 15; } else { _local11.damage = 200; }; } else { engine.upgradeUnitToLevel(_local11, _local2); }; if (_local7 == UnitTypes.hijacker){ _local11.life.move(tpos, false); } else { _local11.life.move(tpos, true); }; _local3++; if (_local3 >= _local4){ if (!_local5){ enemy++; }; return; }; }; _local10 = (_local10 + 3); }; _local8 = (_local8 + 3); }; enemy++; } public function sendNext():void{ if (((!(thinktimer)) || (engine.paused))){ return; }; if (liveCount() > MaxCountForSendNext){ engine.log("Too many invaders"); return; }; if ((((threats.curlevel < threats.nlevels)) && (threats.isNextWaveAcceptable()))){ pause = 1; thinkHandler(null); }; } public function hitSoft(_arg1:Unit):Boolean{ var _local2:int; var _local3:int; if (((!(targetSoft)) || (!(targetSoft.isLive())))){ tpos = retarget(); if (!tpos){ return (false); }; _local2 = engine.comp.camp.units.length; _local3 = 0; while (_local3 < _local2) { if (engine.comp.camp.units[_local3].type != UnitTypes.hijacker){ engine.comp.camp.units[_local3].life.move(tpos, true); }; _local3++; }; return (false); } else { if (!_arg1.pos.isequal(tpos)){ _arg1.life.move(tpos, true); return (false); }; }; engine.playSound(engine.sloader.sounds[UnitTypes.soundshothijack], new Position(50, 100)); engine.hitUnit(_arg1.damage, targetSoft); engine.effect(((targetSoft.pos.x * Consts.cellsize) - (targetSoft.sprite.width / 2)), ((targetSoft.pos.y * Consts.cellsize) - (targetSoft.sprite.height / 2)), UnitTypes.spsofthit); engine.menu.resources.update(); return (true); } public function start():void{ difparams = new DifficultyParams(engine.difficulty); threats = new Threats(engine, difparams.nwaves, engine.menu.riskinfo); engine.globalstage.addChild(threats); threats.x = 133; threats.y = 541; sm = new SecurityMon(); sm.x = 95; sm.y = 560; engine.globalstage.addChild(sm); thinktimer = new Timer(1000, 0); thinktimer.addEventListener(TimerEvent.TIMER, thinkHandler); thinktimer.start(); } public function isRunning():Boolean{ return (!((thinktimer == null))); } private function thinkHandler(_arg1:TimerEvent):void{ var _local2:int; if (!engine.soft.units.length){ engine.menu.gameover(); return; }; _local2 = liveCount(); if (!_local2){ if (threats.curlevel > 0){ threats.fadeOut(); }; if (threats.curlevel >= threats.nlevels){ engine.menu.victory(); return; }; }; if (threats.curlevel < threats.nlevels){ if (pause > 0){ pause--; engine.menu.remaining.text = (pause.toString() + " seconds"); engine.menu.resources.htime.text = pause.toString(); if (pause <= 0){ makeEnemies(); threats.nextWave(); } else { return; }; }; pause = PAUSE; }; } } }//package fai
Section 28
//SmartLoader (fai.SmartLoader) package fai { import flash.display.*; import flash.events.*; import flash.media.*; import flash.utils.*; import mochi.*; public class SmartLoader { public var buttons:Dictionary; public var sounds:Dictionary; public var loaded:Boolean;// = false public var engine:Engine;// = null public var grounds:Dictionary; private var loadendHandler:Function;// = null public var maps:Map; private var loadprocessHandler:Function;// = null public var specials:Dictionary; public var utypes:UnitTypes;// = null public var mimages:Dictionary; private var loadcount:int;// = 0 private var startcount:int;// = 0 public var suites:Dictionary; public static const host:String = "http://www.warspark.com/mostemp/"; public function SmartLoader(){ suites = new Dictionary(); buttons = new Dictionary(); sounds = new Dictionary(); grounds = new Dictionary(); mimages = new Dictionary(); specials = new Dictionary(); maps = new Map(); engine = null; loaded = false; loadcount = 0; startcount = 0; utypes = null; loadendHandler = null; loadprocessHandler = null; super(); } public function getLibSound(_arg1:String):Sound{ return (sounds[_arg1]); } public function getSpecial(_arg1:String):AnimatedBitmap{ var _local2:BitmapData; _local2 = specials[_arg1]; return (new AnimatedBitmap(_local2, _local2.width, _local2.height)); } public function dressUnit(_arg1:Unit, _arg2:String, _arg3:Engine):void{ var _local4:Array; _local4 = suites[_arg2]; _arg1.sprite.setAppearence(_local4[0], _local4[1], null, _local4[2], _local4[3], _arg1.spritewidth); if (!_arg1.attacksound){ if (_arg1.mapid == Consts.myId){ if (_arg1.type == UnitTypes.firewall){ _arg1.attacksound = Sound(getLibSound(UnitTypes.soundshotfirewall)); } else { _arg1.attacksound = Sound(getLibSound(UnitTypes.soundshotanti)); }; } else { if ((((_arg1.mapid == Consts.hostileId)) && ((_arg1.type == UnitTypes.hijacker)))){ _arg1.attacksound = Sound(getLibSound(UnitTypes.soundshothijack)); }; }; }; if (_arg1.flag(UnitFlags.Flying)){ _arg3.airlayer.addChildAt(_arg1.sprite, 0); } else { _arg3.groundlayer.addChildAt(_arg1.sprite, 0); }; } public function saveScore():void{ if (!engine.score){ return; }; MochiScores.showLeaderboard({boardID:"e47deaaa48a749ec", score:engine.score}); engine.score = 0; } public function getBody(_arg1:String):BitmapData{ return (suites[_arg1][0]); } public function dressPeacefulUnit(_arg1:Unit, _arg2:String, _arg3:Engine):void{ var _local4:Array; _local4 = suites[_arg2]; _arg1.sprite.setAppearence(_local4[0], null, null, null, null, _arg1.spritewidth); if (_arg1.flag(UnitFlags.Flying)){ _arg3.airlayer.addChildAt(_arg1.sprite, 0); } else { _arg3.groundlayer.addChildAt(_arg1.sprite, 0); }; } private function loadCompleteHandler(_arg1:Event):void{ loadcount--; if (!loadcount){ loadprocessHandler(100); loaded = true; loadendHandler(); } else { loadprocessHandler((100 - ((loadcount * 100) / startcount))); }; } public function load():void{ suites[UnitTypes.virus] = new Array(5); suites[UnitTypes.virus][0] = new Virusbody(0, 0); suites[UnitTypes.backdoor] = new Array(5); suites[UnitTypes.backdoor][0] = new Backdoorbody(0, 0); suites[UnitTypes.trojan] = new Array(5); suites[UnitTypes.trojan][0] = new Trojanbody(0, 0); suites[UnitTypes.adware] = new Array(5); suites[UnitTypes.adware][0] = new Adwarebody(0, 0); suites[UnitTypes.hijacker] = new Array(5); suites[UnitTypes.hijacker][0] = new Hijackerbody(0, 0); suites[UnitTypes.hijacker][1] = new Hijackerattack(0, 0); suites[UnitTypes.hijacker][2] = new Hijackerbullet(0, 0); suites[UnitTypes.hijacker][3] = new Hijackerbe(0, 0); suites[UnitTypes.keylogger] = new Array(5); suites[UnitTypes.keylogger][0] = new Keyloggerbody(0, 0); suites[UnitTypes.spyware] = new Array(5); suites[UnitTypes.spyware][0] = new Spywarebody(0, 0); suites[UnitTypes.spam] = new Array(5); suites[UnitTypes.spam][0] = new Spambody(0, 0); suites[UnitTypes.antispyware] = new Array(5); suites[UnitTypes.antispyware][0] = new Antispywarebody(0, 0); suites[UnitTypes.antispyware][1] = new Antispywareattack(0, 0); suites[UnitTypes.antispyware][2] = new Antispywarebullet(0, 0); suites[UnitTypes.antispyware][3] = new Antispywarebe(0, 0); suites[UnitTypes.antivirus] = new Array(5); suites[UnitTypes.antivirus][0] = new Antivirusbody(0, 0); suites[UnitTypes.antivirus][1] = new Antivirusattack(0, 0); suites[UnitTypes.antivirus][2] = new Antivirusbullet(0, 0); suites[UnitTypes.antivirus][3] = new Antivirusbe(0, 0); suites[UnitTypes.antiadware] = new Array(5); suites[UnitTypes.antiadware][0] = new Antiadwarebody(0, 0); suites[UnitTypes.antiadware][1] = new Antiadwareattack(0, 0); suites[UnitTypes.antiadware][2] = new Antiadwarebullet(0, 0); suites[UnitTypes.antiadware][3] = new Antiadwarebe(0, 0); suites[UnitTypes.garbagecleaner] = new Array(5); suites[UnitTypes.garbagecleaner][0] = new GarbageCleanerbody(0, 0); suites[UnitTypes.garbagecleaner][1] = new GarbageCleanerattack(0, 0); suites[UnitTypes.garbagecleaner][2] = new GarbageCleanerbullet(0, 0); suites[UnitTypes.garbagecleaner][3] = new GarbageCleanerbe(0, 0); suites[UnitTypes.firewall] = new Array(5); suites[UnitTypes.firewall][0] = new Firewallbody(0, 0); suites[UnitTypes.firewall][1] = new Firewallattack(0, 0); suites[UnitTypes.firewall][2] = new Virusbody(0, 0); suites[UnitTypes.firewall][3] = new Virusbody(0, 0); suites[UnitTypes.browser] = new Array(1); suites[UnitTypes.browser][0] = new Browserbody(0, 0); suites[UnitTypes.cpanel] = new Array(1); suites[UnitTypes.cpanel][0] = new Controlpanelbody(0, 0); suites[UnitTypes.docs] = new Array(1); suites[UnitTypes.docs][0] = new Docsbody(0, 0); suites[UnitTypes.games] = new Array(1); suites[UnitTypes.games][0] = new Gamesbody(0, 0); suites[UnitTypes.mail] = new Array(1); suites[UnitTypes.mail][0] = new Mailbody(0, 0); suites[UnitTypes.messenger] = new Array(1); suites[UnitTypes.messenger][0] = new Messengerbody(0, 0); suites[UnitTypes.musicplayer] = new Array(1); suites[UnitTypes.musicplayer][0] = new MusicPlayerbody(0, 0); suites[UnitTypes.rbin] = new Array(1); suites[UnitTypes.rbin][0] = new RBinbody(0, 0); suites[UnitTypes.registry] = new Array(1); suites[UnitTypes.registry][0] = new Registrybody(0, 0); buttons[UnitTypes.bcancel] = new Buttonbcancel(0, 0); buttons[UnitTypes.bantivirus] = new Buttonbantivirus(0, 0); buttons[UnitTypes.bantispyware] = new Buttonbantispyware(0, 0); buttons[UnitTypes.bantiadware] = new Buttonbantiadware(0, 0); buttons[UnitTypes.bgarbagecleaner] = new Buttonbgarbagecleaner(0, 0); buttons[UnitTypes.bfirewall] = new Buttonbfirewall(0, 0); mimages[UnitTypes.mimoney] = new Menumoney(0, 0); mimages[UnitTypes.miattack] = new Menuattack(0, 0); mimages[UnitTypes.mirange] = new Menurange(0, 0); mimages[UnitTypes.miarmor] = new Menushield(0, 0); mimages[UnitTypes.miheart] = new Menuheart(0, 0); specials[UnitTypes.spdeath1] = new Specialsdeath1(0, 0); specials[UnitTypes.spsofthit] = new Specialssofthit(0, 0); specials[UnitTypes.spdebris] = new Specialsdebris(0, 0); grounds["background.png"] = new Groundbackground(0, 0); grounds["windowheader.png"] = new Groundwindowheader(0, 0); sounds[UnitTypes.soundclick] = new Soundclickerx(); sounds[UnitTypes.sounddeath] = new Sounddeath(); sounds[UnitTypes.soundenemiesappearing] = new Soundenemiesappearing(); sounds[UnitTypes.soundshotanti] = new Soundshot_anti(); sounds[UnitTypes.soundshothijack] = new Soundshot_hijack(); sounds[UnitTypes.soundshotfirewall] = new Soundshot_firewall(); sounds[UnitTypes.soundstartmenu] = new SoundStartMenu(); loadendHandler(); loaded = true; } public function getButton(_arg1:String):AnimatedBitmap{ var _local2:BitmapData; _local2 = buttons[_arg1]; return (new AnimatedBitmap(_local2, _local2.width, _local2.height)); } public function navigateToLeaderboard(_arg1:String=""):void{ MochiScores.showLeaderboard({boardID:"e47deaaa48a749ec"}); } public function getMenuItem(_arg1:String):AnimatedBitmap{ var _local2:BitmapData; _local2 = mimages[_arg1]; return (new AnimatedBitmap(_local2, _local2.width, _local2.height)); } public function startLoading(_arg1:Function, _arg2:Function):void{ var _local3:XML; var _local4:XMLList; var _local5:XML; loadendHandler = _arg2; loadprocessHandler = _arg1; _local3 = new XML(Maps.maps); _local4 = _local3.level; for each (_local5 in _local4) { maps.add(int(_local5.@number), new LevelMap(new XML(_local5.toString()))); }; load(); } public function getGround(_arg1:String):AnimatedBitmap{ var _local2:BitmapData; _local2 = grounds[_arg1]; return (new AnimatedBitmap(_local2, _local2.width, _local2.height)); } } }//package fai
Section 29
//Threats (fai.Threats) package fai { import flash.display.*; import flash.events.*; import flash.text.*; import flash.utils.*; import flash.geom.*; public class Threats extends Sprite { private var riskimage:AnimatedBitmap;// = null private var lparent:Sprite;// = null private var fadeElem;// = null public var curlevel:int;// = 0 private var engine:Engine;// = null public var nlevels:int;// = 0 private var ftm:Timer;// = null private var levels:Array; private var tm:Timer;// = null private var offs:Number;// = 0 private var riskinfo:RiskInfo;// = null public static const colors:Array = [320260, 16555287, 63231, 16744150, 16758904, 13489151, 0xFF0048, 0xFF0000]; public static const enemies:Array = [UnitTypes.adware, UnitTypes.spam, UnitTypes.backdoor, UnitTypes.trojan, UnitTypes.spyware, UnitTypes.keylogger, UnitTypes.hijacker, UnitTypes.virus]; private static var twidth:Number = 0; public function Threats(_arg1:Engine, _arg2:int, _arg3:RiskInfo):void{ var _local4:int; var _local5:TextFormat; var _local6:Boolean; var _local7:int; var _local8:Threat; var _local9:int; nlevels = 0; lparent = null; levels = new Array(); riskinfo = null; tm = null; ftm = null; offs = 0; fadeElem = null; curlevel = 0; engine = null; riskimage = null; super(); engine = _arg1; nlevels = _arg2; lparent = new Sprite(); lparent.x = 2; addChild(lparent); riskinfo = _arg3; scrollRect = new Rectangle(0, 0, 477, 60); _local4 = 0; _local5 = null; _local6 = false; _local7 = 0; while (_local7 < nlevels) { if (_local4 >= enemies.length){ _local4 = 0; _local6 = true; } else { _local6 = false; }; _local8 = new Threat(); lparent.addChild(_local8); twidth = _local8.width; _local8.x = (((_local8.width + 3) * levels.length) + _local8.width); levels.push(_local8); _local9 = 14; if (_local7 >= 99){ _local9 = 10; _local8.level.y = (_local8.level.y + 8); }; if (_local6){ _local5 = _local8.level.defaultTextFormat; _local5.size = _local9; _local5.bold = true; _local5.color = 0xFFFFFF; _local8.level.defaultTextFormat = _local5; _local8.level.text = (_local7 + 1).toString(); _local5 = _local8.title.defaultTextFormat; _local5.size = 12; _local5.bold = true; _local5.color = 0xFFFFFF; _local8.title.defaultTextFormat = _local5; _local8.title.text = "Boss"; } else { _local5 = _local8.level.defaultTextFormat; _local5.size = _local9; _local5.bold = true; _local5.color = colors[_local4]; _local8.level.defaultTextFormat = _local5; _local8.level.text = (_local7 + 1).toString(); _local5 = _local8.title.defaultTextFormat; if ((((_local4 == 5)) || ((_local4 == 2)))){ _local5.size = 10; } else { _local5.size = 11; }; _local5.bold = true; _local5.color = colors[_local4]; _local8.title.defaultTextFormat = _local5; _local8.title.text = enemies[_local4]; }; _local8.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); _local8.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); _local8.cacheAsBitmap = true; if (!_local6){ _local4++; }; _local7++; }; lparent.cacheAsBitmap = true; } private function onMouseOver(_arg1:MouseEvent):void{ var _local2:String; var _local3:Boolean; var _local4:int; var _local5:*; var _local6:int; riskinfo.visible = true; riskinfo.title.text = _arg1.currentTarget.title.text; riskinfo.x = 250; riskinfo.y = 350; _local2 = riskinfo.title.text; _local3 = false; _local4 = 0; if ("Boss" == _local2){ _local6 = ((Math.floor((curlevel / enemies.length)) - 1) % enemies.length); if (_local6 >= enemies.length){ _local6 = (enemies.length - 1); } else { if (_local6 < 0){ _local6 = 0; }; }; _local2 = enemies[_local6]; _local3 = true; }; if (_local3){ _local4 = 1; } else { if (UnitTypes.spam == _local2){ _local4 = 20; } else { _local4 = 10; }; }; riskinfo.quantity.text = _local4.toString(); switch (_local2){ case UnitTypes.adware: riskinfo.desc.text = "Most simple and safe threat, doesn't hurt much"; riskinfo.risklevel.text = "Lowest"; break; case UnitTypes.spam: riskinfo.desc.text = "Weak threat but has large quantity"; riskinfo.risklevel.text = "Low"; break; case UnitTypes.backdoor: riskinfo.desc.text = "Weak threat but has increased life rate"; riskinfo.risklevel.text = "Average"; break; case UnitTypes.trojan: riskinfo.desc.text = "Average risk threat, dangerous on higher levels"; riskinfo.risklevel.text = "Average"; break; case UnitTypes.spyware: riskinfo.desc.text = "Above average threat, very dangerous on higher levels"; riskinfo.risklevel.text = "High"; break; case UnitTypes.keylogger: riskinfo.desc.text = "Above average threat, most fast moving invader"; riskinfo.risklevel.text = "High"; break; case UnitTypes.hijacker: riskinfo.desc.text = "Strong invader, can destroy security tools"; riskinfo.risklevel.text = "Very High"; break; case UnitTypes.virus: riskinfo.desc.text = "Most dangerous invader, moves above security tools"; riskinfo.risklevel.text = "Highest"; break; }; if (_local3){ riskinfo.desc.text = "Very dangerous invader, very high damage rate"; riskinfo.risklevel.text = "Highest"; }; _local5 = engine.sloader.getBody(_local2); if (riskimage){ riskinfo.removeChild(riskimage); riskimage = null; }; riskimage = new AnimatedBitmap(_local5, engine.utypes.params(_local2).spritewidth, _local5.height); riskinfo.addChild(riskimage); riskimage.x = 30; riskimage.y = ((riskinfo.title.y + (riskinfo.title.height / 2)) - (_local5.height / 2)); } public function isNextWaveAcceptable():Boolean{ return ((tm == null)); } private function fadeHandler(_arg1:TimerEvent):void{ if (fadeElem.alpha > 0){ fadeElem.alpha = (fadeElem.alpha - 0.025); } else { ftm.stop(); ftm.removeEventListener(TimerEvent.TIMER, fadeHandler); ftm = null; }; } public function fadeOut():void{ if (((ftm) || ((curlevel > levels.length)))){ return; }; fadeElem = levels[(curlevel - 1)]; if (fadeElem.alpha <= 0){ fadeElem = null; return; }; ftm = new Timer(10, 0); ftm.addEventListener(TimerEvent.TIMER, fadeHandler); ftm.start(); } private function onMouseOut(_arg1:MouseEvent):void{ riskinfo.visible = false; } private function tmHandler(_arg1:TimerEvent):void{ if (offs > 0){ lparent.x = (lparent.x - 3); offs = (offs - 3); } else { if (offs < 0){ lparent.x = (lparent.x + Math.abs(offs)); }; curlevel++; tm.stop(); tm.removeEventListener(TimerEvent.TIMER, tmHandler); tm = null; }; } public function clear():void{ var _local1:Threat; if (riskimage){ riskinfo.removeChild(riskimage); riskimage = null; }; for each (_local1 in levels) { _local1.removeEventListener(MouseEvent.MOUSE_OVER, onMouseOver); _local1.removeEventListener(MouseEvent.MOUSE_OUT, onMouseOut); lparent.removeChild(_local1); }; removeChild(lparent); } public function nextWave():void{ if (tm){ return; }; tm = new Timer(10, 0); tm.addEventListener(TimerEvent.TIMER, tmHandler); tm.start(); offs = (twidth + 3); } } }//package fai
Section 30
//Unit (fai.Unit) package fai { import flash.events.*; import flash.media.*; public class Unit { public var bulletspeed:uint;// = 15 private var attackpos:Position;// = null public var cstate:uint;// = 0 public var flags:uint;// = 0 public var desc:String;// = "Unit Desc." public var spritewidth:int;// = 24 public var rotstep:int;// = 15 private var destangel:int;// = 0 private var movetarget:Position;// = null public var eyerange:uint;// = 8 public var deathsteps:uint;// = 12 public var type:String;// = null public var deathcost:uint;// = 3 public var sprite:UnitSprite;// = null public var attacksound:Sound;// = null public var upgradeLevel:int;// = 0 public var engine:Engine;// = null private var xstep:Number;// = 0 private var ystep:Number;// = 0 public var cost:uint;// = 100 public var armor:uint;// = 1 private var step:uint;// = 0 public var pos:Position; private var attacktarget:Unit;// = null public var health:int;// = 50 public var rotating:Boolean;// = false public var attackssteps:uint;// = 3 public var damage:uint;// = 0 public var movesteps:int;// = 5 public var mapid:uint;// = 0 public var rechargetime:uint;// = 35 public var life:LifeGoal;// = null public var killed:int;// = 0 public function Unit(_arg1:Engine, _arg2:uint, _arg3:String):void{ rotstep = 15; movesteps = 5; attackssteps = 3; deathsteps = 12; type = null; spritewidth = 24; pos = new Position(); sprite = null; cstate = 0; eyerange = 8; damage = 0; armor = 1; health = 50; bulletspeed = 15; rechargetime = 35; deathcost = 3; killed = 0; upgradeLevel = 0; cost = 100; flags = 0; attacksound = null; desc = "Unit Desc."; movetarget = null; attacktarget = null; attackpos = null; engine = null; mapid = 0; xstep = 0; ystep = 0; step = 0; rotating = false; destangel = 0; life = null; super(); engine = _arg1; mapid = _arg2; type = _arg3; sprite = new UnitSprite(this); if (engine){ sprite.addEventListener(MouseEvent.MOUSE_OVER, onmouseover); sprite.addEventListener(MouseEvent.MOUSE_OUT, onmouseout); }; } private function onmouseout(_arg1:MouseEvent):void{ if (((!(isLive())) || (!(engine.isUnitInSelection(this))))){ sprite.select(false); }; } public function destroy():void{ reset(); if (cstate != Consts.DEATH){ cstate = Consts.DEATH; sprite.removeEventListener(MouseEvent.MOUSE_OVER, onmouseover); sprite.removeEventListener(MouseEvent.MOUSE_OUT, onmouseout); }; sprite.select(false); } private function onmouseover(_arg1:MouseEvent):void{ updateHealth(); } public function updateHealth():void{ sprite.select(true); } public function copyProperties(_arg1:Unit):void{ eyerange = _arg1.eyerange; damage = _arg1.damage; armor = _arg1.armor; health = _arg1.health; bulletspeed = _arg1.bulletspeed; rechargetime = _arg1.rechargetime; } public function flag(_arg1:uint):Boolean{ return ((flags & _arg1)); } public function startattack(_arg1:Unit):void{ reset(); attacktarget = _arg1; cstate = Consts.ATTACK; attackpos = new Position(); attackpos.set(attacktarget.sprite.x, attacktarget.sprite.y); if (rotstep){ startrotate((((Math.atan2((attacktarget.sprite.y - sprite.y), (attacktarget.sprite.x - sprite.x)) / Math.PI) * 180) - 90)); }; } public function isLive():Boolean{ return ((health > 0)); } public function startrotate(_arg1:int):void{ destangel = (_arg1 - sprite.body.rotation); if (destangel > 180){ destangel = (destangel - 360); } else { if (destangel < -180){ destangel = (destangel + 360); }; }; if (!destangel){ return; }; rotating = true; } public function attack():void{ if (rotating){ rotate(); return; }; if (!step){ sprite.setAttackSprite(); engine.playSound(attacksound, pos); }; if (step >= attackssteps){ engine.runBullet(this, attacktarget, attackpos); reset(); sprite.setMoveSprite(); } else { step++; sprite.setFrame(((step * sprite.nframes()) / attackssteps)); }; } public function move():void{ if (rotating){ rotate(); return; }; if (!step){ sprite.setMoveSprite(); }; sprite.x = (sprite.x + xstep); sprite.y = (sprite.y + ystep); step++; sprite.setFrame(((step * sprite.nframes()) / movesteps)); if (step >= movesteps){ if ((flags & UnitFlags.Flying)){ engine.airworld.setpos(pos, 0); } else { engine.world.setpos(pos, 0); }; pos = movetarget; reset(); }; } public function reset():void{ cstate = Consts.IDLE; step = (ystep = (xstep = 0)); attacktarget = null; rotating = false; } public function rotate():void{ var _local1:int; if (Math.abs(destangel) < rotstep){ sprite.body.rotation = (sprite.body.rotation + destangel); destangel = 0; rotating = false; } else { _local1 = ((Math.abs(destangel) > rotstep)) ? ((destangel > 0)) ? rotstep : -(rotstep) : destangel; sprite.body.rotation = (sprite.body.rotation + _local1); destangel = (destangel - _local1); }; } public function startmove(_arg1:Position):void{ reset(); movetarget = _arg1; cstate = Consts.MOVING; xstep = (((movetarget.x * Consts.cellsize) - sprite.x) / movesteps); ystep = (((movetarget.y * Consts.cellsize) - sprite.y) / movesteps); if (rotstep){ startrotate((((Math.atan2(ystep, xstep) / Math.PI) * 180) - 90)); }; } public function activate(_arg1:Engine):void{ life = new LifeGoal(_arg1, this); _arg1.goals.push(life); } } }//package fai
Section 31
//UnitFlags (fai.UnitFlags) package fai { public class UnitFlags { public static const Firewall:uint = 32; public static const Peaceful:uint = 1; public static const Building:uint = 2; public static const Antilandforces:uint = 16; public static const Flying:uint = 4; public static const Antiaircraft:uint = 8; public static const Frozenable:uint = 64; } }//package fai
Section 32
//UnitSprite (fai.UnitSprite) package fai { import flash.display.*; public class UnitSprite extends Sprite { public var bullet:BitmapData;// = null private var upgrade:Shape;// = null private var lastulevel:int;// = 0 public var selection:Shape;// = null public var body:Sprite; private var owner:Unit;// = null public var bmind:AnimatedBitmap;// = null public var sprite:AnimatedBitmap;// = null private var lastfrontier:int;// = -1 public var dbuffer:BitmapData;// = null public var bulletexp:BitmapData;// = null public var abuffer:BitmapData;// = null public var mbuffer:BitmapData;// = null public function UnitSprite(_arg1:Unit){ body = new Sprite(); selection = null; sprite = null; bmind = null; owner = null; upgrade = null; mbuffer = null; abuffer = null; dbuffer = null; bullet = null; bulletexp = null; lastfrontier = -1; lastulevel = 0; super(); owner = _arg1; visible = false; } public function select(_arg1:Boolean):void{ var sqcount:*; var fullHealth:*; var hpercent:*; var frontier:*; var diameter:*; var isenemy:*; var rsize:*; var startx:*; var i:*; var enable = _arg1; if (!selection){ selection = new Shape(); addChildAt(selection, 1); selection.x = (selection.x - (sprite.width / 2)); selection.y = (selection.y - (sprite.height / 2)); selection.alpha = 0.5; }; if (enable){ var _local3 = selection; with (_local3) { visible = true; sqcount = 7; fullHealth = owner.engine.utypes.params(owner.type).health; fullHealth = (fullHealth + ((fullHealth * owner.upgradeLevel) * Consts.upgradeHExtra)); hpercent = ((owner.health * 100) / fullHealth); frontier = ((hpercent * sqcount) / 100); if (((!((frontier == lastfrontier))) || (!((owner.upgradeLevel == lastulevel))))){ lastfrontier = frontier; lastulevel = owner.upgradeLevel; diameter = Math.max(sprite.width, sprite.height); graphics.clear(); isenemy = (owner.mapid == Consts.hostileId); if (isenemy){ graphics.lineStyle(1, 0xFF0000); } else { graphics.lineStyle(1, 253443); }; graphics.drawCircle((sprite.width / 2), (sprite.height / 2), (diameter / 2)); rsize = 5; startx = (((-(rsize) * sqcount) / 2) + (sprite.width / 2)); graphics.lineStyle(1, 0); i = 0; i = 0; while (i < sqcount) { if (i < frontier){ if (isenemy){ graphics.beginFill(0xFF0000); } else { graphics.beginFill(0xFF00); }; }; graphics.drawRect(startx, (diameter - rsize), rsize, rsize); if (i < frontier){ graphics.endFill(); }; startx = (startx + rsize); i++; }; }; }; } else { selection.visible = false; }; } public function setFrame(_arg1:uint):void{ sprite.setFrame(_arg1); } public function rotate(_arg1:uint):void{ body.rotation = _arg1; } public function setDeathSprite():void{ sprite.setBuffer(dbuffer); } public function nframes():uint{ return (sprite.nframes); } public function setAttackSprite():void{ sprite.setBuffer(abuffer); } public function update():void{ var rsize:int; var startx:int; if (!owner.isLive()){ if (upgrade){ upgrade.graphics.clear(); removeChild(upgrade); }; return; }; if (((!(upgrade)) && ((owner.upgradeLevel > 0)))){ upgrade = new Shape(); addChild(upgrade); upgrade.x = (upgrade.x - (sprite.width / 2)); upgrade.y = (upgrade.y - ((sprite.height / 2) + 3)); }; if (upgrade){ rsize = 6; startx = 0; var _local2 = upgrade.graphics; with (_local2) { clear(); lineStyle(1, 0); i = 0; while (i < owner.upgradeLevel) { beginFill(0xF600FF); drawRect(startx, 4, rsize, 4); endFill(); startx = (startx + (rsize + 1)); i++; }; }; }; } public function setAppearence(_arg1:BitmapData, _arg2:BitmapData, _arg3:BitmapData, _arg4:BitmapData, _arg5:BitmapData, _arg6:int):void{ mbuffer = _arg1; abuffer = _arg2; dbuffer = _arg3; bullet = _arg4; bulletexp = _arg5; sprite = new AnimatedBitmap(mbuffer, _arg6, mbuffer.height); body.addChild(sprite); sprite.x = (sprite.x - (sprite.width / 2)); sprite.y = (sprite.y - (sprite.height / 2)); addChild(body); } public function setMoveSprite():void{ sprite.setBuffer(mbuffer); } } }//package fai
Section 33
//UnitTypes (fai.UnitTypes) package fai { import flash.utils.*; public class UnitTypes { private var sloader:SmartLoader;// = null private var initiated:Boolean;// = false public var buttonToUnit:Dictionary; public var units:Dictionary; private var unitToButton:Dictionary; public var engine:Engine;// = null public static const firewall:String = "Firewall"; public static const cpanel:String = "Control Panel"; public static const antiadware:String = "AntiAdware"; public static const soundshotanti:String = "shot_anti.mp3"; public static const types:Array = [virus, backdoor, trojan, adware, hijacker, keylogger, spyware, spam, antispyware, antivirus, antiadware, garbagecleaner, firewall, mail, browser, rbin, cpanel, docs, games, messenger, musicplayer, registry]; public static const hijacker:String = "Hijacker"; public static const soundshotfirewall:String = "shot_firewall.mp3"; public static const messenger:String = "Internet Messenger"; public static const backdoor:String = "Backdoor"; public static const antispyware:String = "AntiSpyware"; public static const spdebris:String = "debris.png"; public static const menuimages:Array = [mimoney, miattack, mirange, miarmor, miheart]; public static const adware:String = "Adware"; public static const mirange:String = "range.png"; public static const miarmor:String = "shield.png"; public static const mimoney:String = "money.png"; public static const browser:String = "Browser"; public static const soundshothijack:String = "shot_hijack.mp3"; public static const keylogger:String = "Keylogger"; public static const spsofthit:String = "softhit.png"; public static const soundstartmenu:String = "StartMenu.mp3"; public static const mail:String = "Mail Client"; public static const bantivirus:String = "bantivirus.png"; public static const docs:String = "Documents Folder"; public static const registry:String = "System Registry"; public static const games:String = "Games Folder"; public static const bgarbagecleaner:String = "bgarbagecleaner.png"; public static const sounddeath:String = "death.mp3"; public static const trojan:String = "Trojan"; public static const spyware:String = "Spyware"; public static const spam:String = "Spam"; public static const miheart:String = "heart.png"; public static const musicplayer:String = "Music Player"; public static const rbin:String = "Recycle Bin"; public static const soundenemiesappearing:String = "enemies appearing.mp3"; public static const soundclick:String = "clickerx.mp3"; public static const spdeath1:String = "death1.png"; public static const antivirus:String = "AntiVirus"; public static const bcancel:String = "bcancel.png"; public static const garbagecleaner:String = "Garbage Cleaner"; public static const bfirewall:String = "bfirewall.png"; public static const bantiadware:String = "bantiadware.png"; public static const miattack:String = "attack.png"; public static const bantispyware:String = "bantispyware.png"; public static const virus:String = "Virus"; public function UnitTypes(_arg1:SmartLoader):void{ var _local2:String; units = new Dictionary(); unitToButton = new Dictionary(); buttonToUnit = new Dictionary(); sloader = null; engine = null; initiated = false; super(); sloader = _arg1; sloader.utypes = this; for each (_local2 in types) { units[_local2] = createUnit(_local2); }; initUnitToButton(); initButtonToUnit(); initiated = true; } public function createUnit(_arg1:String):Unit{ var _local2:Unit; _local2 = null; switch (_arg1){ case antispyware: _local2 = new Unit(engine, Consts.myId, _arg1); _local2.health = 300; _local2.damage = 18; _local2.spritewidth = 36; _local2.rotstep = 0; _local2.rechargetime = 15; _local2.eyerange = 9; _local2.cost = 25; _local2.desc = "Antispyware software is designed to detect and destroy majority of the computer spyware and adware."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Antilandforces | UnitFlags.Building)); break; case antivirus: _local2 = new Unit(engine, Consts.myId, _arg1); _local2.health = 500; _local2.damage = 35; _local2.spritewidth = 36; _local2.rotstep = 0; _local2.rechargetime = 5; _local2.eyerange = 12; _local2.cost = 60; _local2.desc = "Antivirus software program helps protect your computer against being infected by a virus."; _local2.armor = 3; _local2.flags = (_local2.flags | (UnitFlags.Antiaircraft | UnitFlags.Building)); break; case antiadware: _local2 = new Unit(engine, Consts.myId, _arg1); _local2.health = 120; _local2.damage = 10; _local2.spritewidth = 36; _local2.rotstep = 0; _local2.cost = 10; _local2.desc = "Antiadware software detects and destroys unwanted and mailicious ads and programs."; _local2.armor = 1; _local2.flags = (_local2.flags | ((UnitFlags.Antiaircraft | UnitFlags.Antilandforces) | UnitFlags.Building)); break; case garbagecleaner: _local2 = new Unit(engine, Consts.myId, _arg1); _local2.health = 250; _local2.damage = 10; _local2.spritewidth = 36; _local2.rotstep = 0; _local2.cost = 50; _local2.desc = "Garbage Cleaner software searches your hard drive and other disks for any known or potential garbage."; _local2.armor = 2; _local2.flags = (_local2.flags | (((UnitFlags.Antiaircraft | UnitFlags.Antilandforces) | UnitFlags.Building) | UnitFlags.Frozenable)); break; case firewall: _local2 = new Unit(engine, Consts.myId, _arg1); _local2.health = 1000; _local2.damage = 25; _local2.spritewidth = 36; _local2.rotstep = 0; _local2.eyerange = 8; _local2.rechargetime = 45; _local2.cost = 100; _local2.desc = "Firewall is a system that secures a network, shielding it from access by unauthorized users."; _local2.armor = 3; _local2.flags = (_local2.flags | ((UnitFlags.Antilandforces | UnitFlags.Building) | UnitFlags.Firewall)); break; case virus: _local2 = new Unit(engine, Consts.hostileId, _arg1); _local2.health = 30; _local2.damage = Consts.SoftShotDamage; _local2.bulletspeed = 100; _local2.spritewidth = 34; _local2.deathcost = 10; _local2.eyerange = 3; _local2.movesteps = 8; _local2.desc = "Virus is a piece of code that is secretly introduced into a system in order to corrupt or destroy it."; _local2.armor = 0; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Flying)); break; case backdoor: _local2 = new Unit(engine, Consts.hostileId, _arg1); _local2.health = 30; _local2.damage = Consts.SoftShotDamage; _local2.bulletspeed = 100; _local2.spritewidth = 27; _local2.deathcost = 3; _local2.eyerange = 3; _local2.desc = "Backdoor is remote admin utility that open infected machines to external control via the Internet."; _local2.armor = 0; _local2.flags = (_local2.flags | UnitFlags.Peaceful); break; case trojan: _local2 = new Unit(engine, Consts.hostileId, _arg1); _local2.health = 30; _local2.damage = Consts.SoftShotDamage; _local2.bulletspeed = 100; _local2.spritewidth = 30; _local2.deathcost = 4; _local2.eyerange = 3; _local2.desc = "Trojan is a program that is hidden in a useful software and actually used to gain access to your PC."; _local2.armor = 1; _local2.flags = (_local2.flags | UnitFlags.Peaceful); break; case adware: _local2 = new Unit(engine, Consts.hostileId, _arg1); _local2.health = 20; _local2.damage = Consts.SoftShotDamage; _local2.bulletspeed = 100; _local2.spritewidth = 29; _local2.deathcost = 1; _local2.eyerange = 3; _local2.desc = "Adware delivers advertising content in a manner that may be unwanted by users."; _local2.armor = 0; _local2.flags = (_local2.flags | UnitFlags.Peaceful); break; case hijacker: _local2 = new Unit(engine, Consts.hostileId, _arg1); _local2.health = 30; _local2.damage = 5; _local2.spritewidth = 22; _local2.eyerange = 5; _local2.rotstep = 0; _local2.bulletspeed = 10; _local2.deathcost = 7; _local2.desc = "Hijacker is software designed to infiltrate or damage a computer system without your consent."; _local2.armor = 1; _local2.flags = UnitFlags.Antilandforces; break; case keylogger: _local2 = new Unit(engine, Consts.hostileId, _arg1); _local2.health = 36; _local2.damage = Consts.SoftShotDamage; _local2.bulletspeed = 100; _local2.spritewidth = 19; _local2.movesteps = 3; _local2.deathcost = 5; _local2.eyerange = 3; _local2.desc = "Keylogger is a computer program which monitors and records your keyboard and other activity."; _local2.armor = 1; _local2.flags = (_local2.flags | UnitFlags.Peaceful); break; case spyware: _local2 = new Unit(engine, Consts.hostileId, _arg1); _local2.health = 36; _local2.damage = Consts.SoftShotDamage; _local2.bulletspeed = 100; _local2.spritewidth = 29; _local2.deathcost = 5; _local2.eyerange = 1; _local2.desc = "This is software that secretly gathers information about a user while he/she navigates the Web."; _local2.armor = 1; _local2.flags = (_local2.flags | UnitFlags.Peaceful); break; case spam: _local2 = new Unit(engine, Consts.hostileId, _arg1); _local2.health = 20; _local2.damage = 10; _local2.bulletspeed = 100; _local2.spritewidth = 37; _local2.deathcost = 1; _local2.eyerange = 3; _local2.desc = "Spam is an inappropriate attempt to use email by sending the same message to numerous people."; _local2.armor = 0; _local2.flags = (_local2.flags | UnitFlags.Peaceful); break; case mail: _local2 = new Unit(engine, Consts.softId, _arg1); _local2.health = 100; _local2.damage = 12; _local2.bulletspeed = 100; _local2.spritewidth = 48; _local2.desc = "Mail Client is an application with which a person reads and sends email."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Building)); break; case browser: _local2 = new Unit(engine, Consts.softId, _arg1); _local2.health = 100; _local2.damage = 12; _local2.bulletspeed = 100; _local2.spritewidth = 48; _local2.desc = "Browser is an application used to view and navigate the World Wide Web and other resources."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Building)); break; case rbin: _local2 = new Unit(engine, Consts.softId, _arg1); _local2.health = 100; _local2.damage = 12; _local2.bulletspeed = 100; _local2.spritewidth = 48; _local2.desc = "Recycle bin is a temporary storage for files that have been deleted in a file manager."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Building)); break; case musicplayer: _local2 = new Unit(engine, Consts.softId, _arg1); _local2.health = 100; _local2.damage = 12; _local2.bulletspeed = 100; _local2.spritewidth = 48; _local2.desc = "Music Player is the software that decompresses the streaming audio using a codec and plays it."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Building)); break; case messenger: _local2 = new Unit(engine, Consts.softId, _arg1); _local2.health = 100; _local2.damage = 12; _local2.bulletspeed = 100; _local2.spritewidth = 48; _local2.desc = "Internet Messenger is a software which allows users to send and receive short messages."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Building)); break; case docs: _local2 = new Unit(engine, Consts.softId, _arg1); _local2.health = 100; _local2.damage = 12; _local2.bulletspeed = 100; _local2.spritewidth = 48; _local2.desc = "The folder where you keep your important documents."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Building)); break; case games: _local2 = new Unit(engine, Consts.softId, _arg1); _local2.health = 100; _local2.damage = 12; _local2.bulletspeed = 100; _local2.spritewidth = 48; _local2.desc = "The folder where you have installed your games."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Building)); break; case cpanel: _local2 = new Unit(engine, Consts.softId, _arg1); _local2.health = 200; _local2.damage = 12; _local2.bulletspeed = 100; _local2.spritewidth = 48; _local2.desc = "Control Panel has a set of utilities that change various aspects of the systems behaviour."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Building)); break; case registry: _local2 = new Unit(engine, Consts.softId, _arg1); _local2.health = 100; _local2.damage = 12; _local2.bulletspeed = 100; _local2.spritewidth = 48; _local2.desc = "System Registry is a database which stores settings and options for the operating system."; _local2.armor = 1; _local2.flags = (_local2.flags | (UnitFlags.Peaceful | UnitFlags.Building)); break; }; if (initiated){ _local2.copyProperties(units[_arg1]); if (_local2.flag(UnitFlags.Peaceful)){ sloader.dressPeacefulUnit(_local2, _arg1, engine); } else { sloader.dressUnit(_local2, _arg1, engine); }; }; return (_local2); } private function initUnitToButton():void{ unitToButton[bantispyware] = antispyware; unitToButton[bantivirus] = antivirus; unitToButton[bantiadware] = antiadware; unitToButton[bgarbagecleaner] = garbagecleaner; unitToButton[bfirewall] = firewall; } public function buttonByUnit(_arg1:String):String{ return (unitToButton[_arg1]); } private function initButtonToUnit():void{ buttonToUnit[bantispyware] = antispyware; buttonToUnit[bantivirus] = antivirus; buttonToUnit[bantiadware] = antiadware; buttonToUnit[bgarbagecleaner] = garbagecleaner; buttonToUnit[bfirewall] = firewall; } public function params(_arg1:String):Unit{ return (units[_arg1]); } } }//package fai
Section 34
//Utils (fai.Utils) package fai { import flash.text.*; public class Utils { public static function drawRect(_arg1, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:Boolean=false, _arg8:int=0, _arg9:int=0):void{ _arg1.graphics.lineStyle(_arg2, _arg3); _arg1.graphics.beginFill(_arg4); if (_arg7){ _arg1.graphics.drawRoundRect(_arg8, _arg9, _arg5, _arg6, (_arg5 / 5), (_arg6 / 5)); } else { _arg1.graphics.drawRect(_arg8, _arg9, _arg5, _arg6); }; _arg1.graphics.endFill(); } public static function createTextField(_arg1:uint, _arg2:uint=10):TextField{ var _local3:TextField; var _local4:TextFormat; _local3 = new TextField(); _local3.autoSize = TextFieldAutoSize.LEFT; _local3.background = false; _local3.border = false; _local3.selectable = false; _local4 = new TextFormat(); _local4.font = "Verdana"; _local4.color = _arg1; _local4.size = _arg2; _local4.bold = true; _local3.defaultTextFormat = _local4; return (_local3); } public static function unitStatus(_arg1:Number):String{ if (_arg1 >= 100){ return ("Very Good"); }; if (_arg1 >= 70){ return ("Well enough"); }; if (_arg1 >= 50){ return ("Could be better"); }; if (_arg1 >= 25){ return ("In bad condition"); }; return ("Poor"); } public static function textrange(_arg1:int):String{ if (_arg1 <= 5){ return ("Small"); }; if (_arg1 <= 7){ return ("Medium"); }; if (_arg1 <= 10){ return ("Good"); }; return ("Big"); } } }//package fai
Section 35
//WebButton (fai.WebButton) package fai { import flash.display.*; import flash.events.*; import flash.text.*; import flash.geom.*; import flash.filters.*; public class WebButton extends Sprite { private var normalshape:Shape;// = null public var txt:TextField;// = null private var selshape:Shape;// = null public function WebButton(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int=16, _arg7:int=40, _arg8:Boolean=true, _arg9:int=8158075, _arg10:int=0, _arg11:int=0x757575, _arg12:int=0x373737):void{ var radius:int; var btnW:int; var btnH:int; var web20Glow:GlowFilter; var web20Filters:Array; var myRssButton:Sprite; var shineRadius:int; var shineW:int; var shineH:int; var shineColors:Array; var shineAlphas:Array; var shineRatios:Array; var shineMatrix:Matrix; var shine:Shape; var s = _arg1; var w = _arg2; var h = _arg3; var r = _arg4; var tcolor = _arg5; var tsize = _arg6; var rr = _arg7; var doShine = _arg8; var ncf = _arg9; var nct = _arg10; var sncf = _arg11; var snct = _arg12; txt = null; selshape = null; normalshape = null; super(); radius = r; btnW = w; btnH = h; web20Glow = new GlowFilter(8303359, 0.8); web20Filters = [web20Glow]; myRssButton = new Sprite(); addChild(myRssButton); myRssButton.x = 20; myRssButton.y = 10; normalshape = createBack(w, h, r, rr, ncf, nct); addChild(normalshape); selshape = createBack(w, h, r, rr, sncf, snct); selshape.visible = false; addChild(selshape); txt = Utils.createTextField(tcolor, tsize); txt.text = s; txt.x = ((width - txt.width) / 2); txt.y = ((height - txt.height) / 2); addChild(txt); if (doShine){ shineRadius = 16; shineW = (w - shineRadius); shineH = (h / 2); shineColors = [0xFFFFFF, 0xFFFFFF]; shineAlphas = [70, 0]; shineRatios = [0, 0xFF]; shineMatrix = new Matrix(); shineMatrix.createGradientBox(shineW, shineH, ((90 / 180) * Math.PI)); shine = new Shape(); addChild(shine); shine.alpha = 0.5; shine.x = 8; shine.y = 3; var _local14 = shine.graphics; with (_local14) { lineStyle(0, 0xFFFFFF, 0); beginGradientFill(GradientType.LINEAR, shineColors, shineAlphas, shineRatios, shineMatrix); drawRoundRect(0, 0, shineW, shineH, 20, 20); endFill(); }; }; normalshape.filters = web20Filters; selshape.filters = web20Filters; addEventListener(MouseEvent.MOUSE_OVER, onover); addEventListener(MouseEvent.MOUSE_OUT, onout); } private function createBack(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):Shape{ var bkg:Shape; var colors:Array; var alphas:Array; var ratios:Array; var matr:Matrix; var w = _arg1; var h = _arg2; var radius = _arg3; var rr = _arg4; var gfrom = _arg5; var gto = _arg6; bkg = new Shape(); colors = [gfrom, gto]; alphas = [100, 100]; ratios = [0, 245]; matr = new Matrix(); matr.createGradientBox(w, h, ((90 / 180) * Math.PI)); var _local8 = bkg.graphics; with (_local8) { lineStyle(0, gto, 100, true, "none", "square", "round"); beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matr, SpreadMethod.PAD); drawRoundRect(0, 0, w, h, rr, rr); endFill(); }; return (bkg); } private function onout(_arg1:MouseEvent):void{ selshape.visible = false; normalshape.visible = true; } private function onover(_arg1:MouseEvent):void{ selshape.visible = true; normalshape.visible = false; } } }//package fai
Section 36
//MochiScores (mochi.MochiScores) package mochi { import flash.display.*; import flash.text.*; public class MochiScores { private static var boardID:String; public static var onErrorHandler:Object; public static var onCloseHandler:Object; public static function showLeaderboard(_arg1:Object=null):void{ var options = _arg1; if (options != null){ if (options.clip != null){ if ((options.clip is Sprite)){ MochiServices.setContainer(options.clip); }; delete options.clip; } else { MochiServices.setContainer(); }; MochiServices.stayOnTop(); if (options.name != null){ if ((options.name is TextField)){ if (options.name.text.length > 0){ options.name = options.name.text; }; }; }; if (options.score != null){ if ((options.score is TextField)){ if (options.score.text.length > 0){ options.score = options.score.text; }; }; }; if (options.onDisplay != null){ options.onDisplay(); } else { if (MochiServices.clip != null){ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; }; } else { options = {}; if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; if (options.onClose != null){ onCloseHandler = options.onClose; } else { onCloseHandler = function ():void{ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.play(); } else { trace("Warning: Container is not a MovieClip, cannot call default onClose."); }; }; }; if (options.onError != null){ onErrorHandler = options.onError; } else { onErrorHandler = null; }; if (options.boardID == null){ if (MochiScores.boardID != null){ options.boardID = MochiScores.boardID; }; }; MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose); } public static function closeLeaderboard():void{ MochiServices.send("scores_closeLeaderboard"); } public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2); } public static function requestList(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_requestList", null, _arg1, _arg2); } public static function scoresArrayToObjects(_arg1:Object):Object{ var _local2:Object; var _local3:Number; var _local4:Number; var _local5:Object; var _local6:Object; var _local7:String; var _local8:String; _local2 = {}; for (_local7 in _arg1) { if (typeof(_arg1[_local7]) == "object"){ if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){ _local2[_local7] = []; _local5 = _arg1[_local7]; _local4 = 0; while (_local4 < _local5.rows.length) { _local6 = {}; _local3 = 0; while (_local3 < _local5.cols.length) { _local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3]; _local3++; }; _local2[_local7].push(_local6); _local4++; }; } else { _local2[_local7] = {}; for (_local8 in _arg1[_local7]) { _local2[_local7][_local8] = _arg1[_local7][_local8]; }; }; } else { _local2[_local7] = _arg1[_local7]; }; }; return (_local2); } public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{ MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4); } public static function onClose(_arg1:Object=null):void{ if (_arg1 != null){ if (_arg1.error != null){ if (_arg1.error == true){ if (onErrorHandler != null){ if (_arg1.errorCode == null){ _arg1.errorCode = "IOError"; }; onErrorHandler(_arg1.errorCode); MochiServices.doClose(); return; }; }; }; }; onCloseHandler(); MochiServices.doClose(); } public static function setBoardID(_arg1:String):void{ MochiScores.boardID = _arg1; MochiServices.send("scores_setBoardID", {boardID:_arg1}); } } }//package mochi
Section 37
//MochiServices (mochi.MochiServices) package mochi { import flash.display.*; import flash.events.*; import flash.utils.*; import flash.net.*; import flash.system.*; public class MochiServices { private static var _container:Object; private static var _connected:Boolean = false; private static var _swfVersion:String; private static var _sendChannel:LocalConnection; private static var _rcvChannelName:String; private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf"; private static var _clip:MovieClip; private static var _loader:Loader; private static var _id:String; private static var _listenChannel:LocalConnection; private static var _timer:Timer; private static var _sendChannelName:String; private static var _startTime:Number; private static var _connecting:Boolean = false; public static var onError:Object; private static var _listenChannelName:String = "__mochiservices"; private static var _rcvChannel:LocalConnection; public static function isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{ if (_connected){ _sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID}); } else { if ((((_clip == null)) || (!(_connecting)))){ onError("NotConnected"); handleError(_arg2, _arg3, _arg4); flush(true); return; }; _clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID}); }; if (_clip != null){ if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){ _clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4}; _clip._nextcallbackID++; }; }; } public static function get connected():Boolean{ return (_connected); } private static function flush(_arg1:Boolean):void{ var _local2:Object; var _local3:Object; if (_clip != null){ if (_clip._queue != null){ while (_clip._queue.length > 0) { _local2 = _clip._queue.shift(); _local3 = null; if (_local2 != null){ if (_local2.callbackID != null){ _local3 = _clip._callbacks[_local2.callbackID]; }; delete _clip._callbacks[_local2.callbackID]; if (((_arg1) && (!((_local3 == null))))){ handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod); }; }; }; }; }; } private static function init(_arg1:String, _arg2:Object):void{ _id = _arg1; if (_arg2 != null){ _container = _arg2; loadCommunicator(_arg1, _container); }; } public static function get childClip():Object{ return (_clip); } public static function get id():String{ return (_id); } public static function stayOnTop():void{ _container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true); if (_clip != null){ _clip.visible = true; }; } public static function getVersion():String{ return ("1.31"); } public static function disconnect():void{ if (((_connected) || (_connecting))){ if (_clip != null){ if (_clip.parent != null){ if ((_clip.parent is Sprite)){ Sprite(_clip.parent).removeChild(_clip); _clip = null; }; }; }; _connecting = (_connected = false); flush(true); try { _listenChannel.close(); _rcvChannel.close(); } catch(error:Error) { }; }; if (_timer != null){ try { _timer.stop(); } catch(error:Error) { }; }; } public static function allowDomains(_arg1:String):String{ var _local2:String; Security.allowDomain("*"); Security.allowInsecureDomain("*"); if (_arg1.indexOf("http://") != -1){ _local2 = _arg1.split("/")[2].split(":")[0]; Security.allowDomain(_local2); Security.allowInsecureDomain(_local2); }; return (_local2); } public static function doClose():void{ _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); if (_clip.parent != null){ Sprite(_clip.parent).removeChild(_clip); }; } public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{ if (_arg1 != null){ if ((_arg1 is Sprite)){ _container = _arg1; }; }; if (_arg2){ if ((_container is Sprite)){ Sprite(_container).addChild(_clip); }; }; } private static function onStatus(_arg1:StatusEvent):void{ switch (_arg1.level){ case "error": _connected = false; _listenChannel.connect(_listenChannelName); break; }; } private static function initComChannels():void{ if (!_connected){ _sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus); _sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"}); _sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()}); _rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus); _clip.onReceive = function (_arg1:Object):void{ var cb:String; var cblst:Object; var method:*; var methodName:String; var obj:Object; var pkg = _arg1; cb = pkg.callbackID; cblst = this.client._callbacks[cb]; if (!cblst){ return; }; method = cblst.callbackMethod; methodName = ""; obj = cblst.callbackObject; if (((obj) && ((typeof(method) == "string")))){ methodName = method; if (obj[method] != null){ method = obj[method]; } else { trace((("Error: Method " + method) + " does not exist.")); }; }; if (method != undefined){ try { method.apply(obj, pkg.args); } catch(error:Error) { trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString())); }; } else { if (obj != null){ try { obj(pkg.args); } catch(error:Error) { trace(("Error invoking method on object: " + error.toString())); }; }; }; delete this.client._callbacks[cb]; }; _clip.onError = function ():void{ MochiServices.onError("IOError"); }; _rcvChannel.connect(_rcvChannelName); trace("connected!"); _connecting = false; _connected = true; _listenChannel.close(); while (_clip._queue.length > 0) { _sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift()); }; }; } private static function listen():void{ _listenChannel = new LocalConnection(); _listenChannel.client = _clip; _clip.handshake = function (_arg1:Object):void{ MochiServices.comChannelName = _arg1.newChannel; }; _listenChannel.allowDomain("*", "localhost"); _listenChannel.allowInsecureDomain("*", "localhost"); _listenChannel.connect(_listenChannelName); trace("Waiting for MochiAds services to connect..."); } private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{ var args = _arg1; var callbackObject = _arg2; var callbackMethod = _arg3; if (args != null){ if (args.onError != null){ args.onError.apply(null, ["NotConnected"]); }; }; if (callbackMethod != null){ args = {}; args.error = true; args.errorCode = "NotConnected"; if (((!((callbackObject == null))) && ((callbackMethod is String)))){ try { var _local5 = callbackObject; _local5[callbackMethod](args); } catch(error:Error) { }; } else { if (callbackMethod != null){ try { callbackMethod.apply(args); } catch(error:Error) { }; }; }; }; } public static function get clip():Object{ return (_container); } public static function set comChannelName(_arg1:String):void{ if (_arg1 != null){ if (_arg1.length > 3){ _sendChannelName = (_arg1 + "_fromgame"); _rcvChannelName = _arg1; initComChannels(); }; }; } private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{ var clipname:String; var f:Function; var req:URLRequest; var id = _arg1; var clip = _arg2; clipname = ("_mochiservices_com_" + id); if (_clip != null){ return (_clip); }; if (!MochiServices.isNetworkAvailable()){ return (null); }; MochiServices.allowDomains(_gatewayURL); _clip = createEmptyMovieClip(clip, clipname, 10336, false); _loader = new Loader(); _timer = new Timer(1000, 0); _startTime = getTimer(); _timer.addEventListener(TimerEvent.TIMER, connectWait); _timer.start(); f = function (_arg1:Object):void{ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); MochiServices.disconnect(); MochiServices.onError("IOError"); }; _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f); req = new URLRequest(_gatewayURL); _loader.load(req); _clip.addChild(_loader); _clip._mochiservices_com = _loader; _sendChannel = new LocalConnection(); _clip._queue = []; _rcvChannel = new LocalConnection(); _rcvChannel.allowDomain("*", "localhost"); _rcvChannel.allowInsecureDomain("*", "localhost"); _rcvChannel.client = _clip; _clip._nextcallbackID = 0; _clip._callbacks = {}; listen(); return (_clip); } public static function bringToTop(_arg1:Event):void{ var e = _arg1; if (MochiServices.clip != null){ if (MochiServices.childClip != null){ try { if (MochiServices.clip.numChildren > 1){ MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1)); }; } catch(errorObject:Error) { trace("Warning: Depth sort error."); _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); }; }; }; } public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{ var id = _arg1; var clip = _arg2; var onError = _arg3; if ((clip is DisplayObject)){ if (((!(_connected)) && ((_clip == null)))){ trace("MochiServices Connecting..."); _connecting = true; init(id, clip); }; } else { trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage."); }; if (onError != null){ MochiServices.onError = onError; } else { if (MochiServices.onError == null){ MochiServices.onError = function (_arg1:String):void{ trace(_arg1); }; }; }; } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{ var mc:MovieClip; var parent = _arg1; var name = _arg2; var depth = _arg3; var doAdd = _arg4; mc = new MovieClip(); if (doAdd){ if (((false) && (depth))){ parent.addChildAt(mc, depth); } else { parent.addChild(mc); }; }; try { parent[name] = mc; } catch(e:Error) { throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic.")); }; mc["_name"] = name; return (mc); } public static function connectWait(_arg1:TimerEvent):void{ if ((getTimer() - _startTime) > 10000){ if (!_connected){ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); MochiServices.disconnect(); MochiServices.onError("IOError"); }; _timer.stop(); }; } } }//package mochi
Section 38
//Adwarebody (Adwarebody) package { import flash.display.*; public dynamic class Adwarebody extends BitmapData { public function Adwarebody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 39
//Antiadwareattack (Antiadwareattack) package { import flash.display.*; public dynamic class Antiadwareattack extends BitmapData { public function Antiadwareattack(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 40
//Antiadwarebe (Antiadwarebe) package { import flash.display.*; public dynamic class Antiadwarebe extends BitmapData { public function Antiadwarebe(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 41
//Antiadwarebody (Antiadwarebody) package { import flash.display.*; public dynamic class Antiadwarebody extends BitmapData { public function Antiadwarebody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 42
//Antiadwarebullet (Antiadwarebullet) package { import flash.display.*; public dynamic class Antiadwarebullet extends BitmapData { public function Antiadwarebullet(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 43
//Antispywareattack (Antispywareattack) package { import flash.display.*; public dynamic class Antispywareattack extends BitmapData { public function Antispywareattack(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 44
//Antispywarebe (Antispywarebe) package { import flash.display.*; public dynamic class Antispywarebe extends BitmapData { public function Antispywarebe(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 45
//Antispywarebody (Antispywarebody) package { import flash.display.*; public dynamic class Antispywarebody extends BitmapData { public function Antispywarebody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 46
//Antispywarebullet (Antispywarebullet) package { import flash.display.*; public dynamic class Antispywarebullet extends BitmapData { public function Antispywarebullet(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 47
//Antivirusattack (Antivirusattack) package { import flash.display.*; public dynamic class Antivirusattack extends BitmapData { public function Antivirusattack(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 48
//Antivirusbe (Antivirusbe) package { import flash.display.*; public dynamic class Antivirusbe extends BitmapData { public function Antivirusbe(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 49
//Antivirusbody (Antivirusbody) package { import flash.display.*; public dynamic class Antivirusbody extends BitmapData { public function Antivirusbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 50
//Antivirusbullet (Antivirusbullet) package { import flash.display.*; public dynamic class Antivirusbullet extends BitmapData { public function Antivirusbullet(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 51
//Backdoorbody (Backdoorbody) package { import flash.display.*; public dynamic class Backdoorbody extends BitmapData { public function Backdoorbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 52
//Blocking (Blocking) package { import flash.display.*; public dynamic class Blocking extends MovieClip { public function Blocking(){ addFrameScript(19, frame20); } function frame20(){ stop(); visible = false; } } }//package
Section 53
//Browserbody (Browserbody) package { import flash.display.*; public dynamic class Browserbody extends BitmapData { public function Browserbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 54
//Buttonbantiadware (Buttonbantiadware) package { import flash.display.*; public dynamic class Buttonbantiadware extends BitmapData { public function Buttonbantiadware(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 55
//Buttonbantispyware (Buttonbantispyware) package { import flash.display.*; public dynamic class Buttonbantispyware extends BitmapData { public function Buttonbantispyware(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 56
//Buttonbantivirus (Buttonbantivirus) package { import flash.display.*; public dynamic class Buttonbantivirus extends BitmapData { public function Buttonbantivirus(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 57
//Buttonbattack (Buttonbattack) package { import flash.display.*; public dynamic class Buttonbattack extends BitmapData { public function Buttonbattack(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 58
//Buttonbcancel (Buttonbcancel) package { import flash.display.*; public dynamic class Buttonbcancel extends BitmapData { public function Buttonbcancel(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 59
//Buttonbfirewall (Buttonbfirewall) package { import flash.display.*; public dynamic class Buttonbfirewall extends BitmapData { public function Buttonbfirewall(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 60
//Buttonbgarbagecleaner (Buttonbgarbagecleaner) package { import flash.display.*; public dynamic class Buttonbgarbagecleaner extends BitmapData { public function Buttonbgarbagecleaner(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 61
//Buttonbstop (Buttonbstop) package { import flash.display.*; public dynamic class Buttonbstop extends BitmapData { public function Buttonbstop(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 62
//Controlpanelbody (Controlpanelbody) package { import flash.display.*; public dynamic class Controlpanelbody extends BitmapData { public function Controlpanelbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 63
//Docsbody (Docsbody) package { import flash.display.*; public dynamic class Docsbody extends BitmapData { public function Docsbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 64
//Firewallattack (Firewallattack) package { import flash.display.*; public dynamic class Firewallattack extends BitmapData { public function Firewallattack(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 65
//Firewallbody (Firewallbody) package { import flash.display.*; public dynamic class Firewallbody extends BitmapData { public function Firewallbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 66
//FirewallCircle (FirewallCircle) package { import flash.display.*; import fai.*; public class FirewallCircle extends MovieClip { private var subject:Unit;// = null private var assaulter:Unit;// = null private var engine:Engine;// = null public function FirewallCircle(_arg1:Engine, _arg2:Unit, _arg3:Unit):void{ engine = null; assaulter = null; subject = null; super(); addFrameScript(12, frame13); engine = _arg1; assaulter = _arg2; subject = _arg3; } private function finalize():void{ var _local1:Array; var _local2:Boolean; var _local3:Unit; _local1 = engine.comp.camp.getNearUnits(assaulter.pos, assaulter.eyerange); _local2 = false; for each (_local3 in _local1) { if (_local3 == subject){ _local2 = true; }; if (!_local3.flag(UnitFlags.Flying)){ engine.hitUnit(assaulter.damage, _local3); }; }; if (!_local2){ engine.hitUnit(assaulter.damage, subject); }; engine.bulletlayer.removeChild(this); } function frame13(){ stop(); finalize(); } } }//package
Section 67
//Gamesbody (Gamesbody) package { import flash.display.*; public dynamic class Gamesbody extends BitmapData { public function Gamesbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 68
//GameStage (GameStage) package { import flash.display.*; import fai.*; import flash.events.*; import flash.text.*; import flash.utils.*; import mochi.*; import flash.system.*; import flash.ui.*; public dynamic class GameStage extends MovieClip { private var kongSplash:Kongintro12fps;// = null private var mochifinished:Boolean;// = false private var loading:Sprite;// = null private var checktimer:Timer;// = null private var menu:GameMenu;// = null private var engine:Engine;// = null private var sloader:SmartLoader;// = null private var loadingText:TextField;// = null private var mochistarted:Boolean;// = false private var kongregate;// = null public function GameStage():void{ var _local1:ContextMenu; sloader = null; engine = null; menu = null; mochifinished = false; mochistarted = false; loading = null; loadingText = null; checktimer = null; kongSplash = null; kongregate = null; super(); stage.scaleMode = StageScaleMode.EXACT_FIT; stage.align = StageAlign.TOP_LEFT; _local1 = new ContextMenu(); _local1.hideBuiltInItems(); contextMenu = _local1; Security.allowDomain("*"); sloader = new SmartLoader(); engine = new Engine(this, sloader); menu = new GameMenu(engine); mochifinished = false; loading = new Sprite(); loadingText = Utils.createTextField(0, 20); addChildAt(loading, 0); addChildAt(loadingText, 1); loadingText.x = 340; loadingText.y = 240; sloader.startLoading(loadprocess, loadcomplete); checktimer = new Timer(300, 0); checktimer.addEventListener("timer", tmfunc); checktimer.start(); } private function mochifin():void{ mochifinished = true; } private function kongLoadComplete(_arg1:Event):void{ kongregate = _arg1.target.content; kongregate.services.connect(); } private function loadcomplete():void{ } private function loadprocess(_arg1:Number):void{ var cbsize:*; var i:*; var percent = _arg1; var _local3 = loading; with (_local3) { cbsize = 8; graphics.clear(); graphics.beginFill((percent * 2.5)); i = 0; while (i <= percent) { graphics.drawRect((i * cbsize), 0, cbsize, engine.gameheight); i++; }; graphics.endFill(); }; loadingText.text = (("loading: " + int(percent).toString()) + "%"); if (100 == percent){ removeChild(loading); removeChild(loadingText); loading = null; loadingText = null; }; } private function tmfunc(_arg1:TimerEvent):void{ if (!kongSplash){ kongSplash = new Kongintro12fps(); kongSplash.x = 400; kongSplash.y = 300; kongSplash.scaleX = (800 / 550); kongSplash.scaleY = (600 / 398); addChild(kongSplash); kongSplash.addEventListener(MouseEvent.MOUSE_DOWN, menu.onplaymoregames); kongSplash.play(); return; }; if (((sloader.loaded) && (kongSplash.finished))){ MochiServices.connect("2a454e21dc1776f1", this); if (!mochifinished){ if (!mochistarted){ mochistarted = true; MochiServices.connect("2a454e21dc1776f1", this); MochiAd.showPreGameAd({clip:this, id:"2a454e21dc1776f1", res:"800x600", ad_finished:mochifin}); }; return; }; kongSplash.removeEventListener(MouseEvent.MOUSE_DOWN, menu.onplaymoregames); removeChild(kongSplash); kongSplash = null; checktimer.stop(); checktimer.removeEventListener("timer", tmfunc); checktimer = null; menu.create(); menu.hide(); engine.loadMap(engine.sloader.maps.get(0)); menu.show(); }; } } }//package
Section 69
//GarbageCleanerattack (GarbageCleanerattack) package { import flash.display.*; public dynamic class GarbageCleanerattack extends BitmapData { public function GarbageCleanerattack(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 70
//GarbageCleanerbe (GarbageCleanerbe) package { import flash.display.*; public dynamic class GarbageCleanerbe extends BitmapData { public function GarbageCleanerbe(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 71
//GarbageCleanerbody (GarbageCleanerbody) package { import flash.display.*; public dynamic class GarbageCleanerbody extends BitmapData { public function GarbageCleanerbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 72
//GarbageCleanerbullet (GarbageCleanerbullet) package { import flash.display.*; public dynamic class GarbageCleanerbullet extends BitmapData { public function GarbageCleanerbullet(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 73
//Groundbackground (Groundbackground) package { import flash.display.*; public dynamic class Groundbackground extends BitmapData { public function Groundbackground(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 74
//Groundwindowheader (Groundwindowheader) package { import flash.display.*; public dynamic class Groundwindowheader extends BitmapData { public function Groundwindowheader(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 75
//Hijackerattack (Hijackerattack) package { import flash.display.*; public dynamic class Hijackerattack extends BitmapData { public function Hijackerattack(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 76
//Hijackerbe (Hijackerbe) package { import flash.display.*; public dynamic class Hijackerbe extends BitmapData { public function Hijackerbe(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 77
//Hijackerbody (Hijackerbody) package { import flash.display.*; public dynamic class Hijackerbody extends BitmapData { public function Hijackerbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 78
//Hijackerbullet (Hijackerbullet) package { import flash.display.*; public dynamic class Hijackerbullet extends BitmapData { public function Hijackerbullet(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 79
//HowToPlay (HowToPlay) package { import flash.display.*; public dynamic class HowToPlay extends MovieClip { } }//package
Section 80
//Keyloggerbody (Keyloggerbody) package { import flash.display.*; public dynamic class Keyloggerbody extends BitmapData { public function Keyloggerbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 81
//Kongintro12fps (Kongintro12fps) package { import flash.display.*; public dynamic class Kongintro12fps extends MovieClip { public var finished:Boolean; public function Kongintro12fps(){ addFrameScript(0, frame1, 88, frame89); } function frame89(){ finished = true; stop(); } function frame1(){ finished = false; } } }//package
Section 82
//Mailbody (Mailbody) package { import flash.display.*; public dynamic class Mailbody extends BitmapData { public function Mailbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 83
//Menuattack (Menuattack) package { import flash.display.*; public dynamic class Menuattack extends BitmapData { public function Menuattack(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 84
//Menuheart (Menuheart) package { import flash.display.*; public dynamic class Menuheart extends BitmapData { public function Menuheart(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 85
//Menumoney (Menumoney) package { import flash.display.*; public dynamic class Menumoney extends BitmapData { public function Menumoney(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 86
//Menurange (Menurange) package { import flash.display.*; public dynamic class Menurange extends BitmapData { public function Menurange(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 87
//Menushield (Menushield) package { import flash.display.*; public dynamic class Menushield extends BitmapData { public function Menushield(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 88
//Messengerbody (Messengerbody) package { import flash.display.*; public dynamic class Messengerbody extends BitmapData { public function Messengerbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 89
//MochiAd (MochiAd) package { import flash.display.*; import flash.events.*; import flash.utils.*; import flash.net.*; import flash.system.*; public class MochiAd { public static function getVersion():String{ return ("2.2"); } public static function showTimedAd(_arg1:Object):void{ MochiAd.showInterLevelAd(_arg1); } public static function _allowDomains(_arg1:String):String{ var _local2:String; _local2 = _arg1.split("/")[2].split(":")[0]; Security.allowDomain("*"); Security.allowDomain(_local2); Security.allowInsecureDomain("*"); Security.allowInsecureDomain(_local2); return (_local2); } public static function load(_arg1:Object):MovieClip{ var DEFAULTS:Object; var clip:Object; var depth:Number; var mc:MovieClip; var wh:Array; var lv:URLVariables; var k:String; var server:String; var hostname:String; var lc:LocalConnection; var name:String; var loader:Loader; var f:Function; var g:Function; var req:URLRequest; var v:Object; var options = _arg1; DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"}; options = MochiAd._parseOptions(options, DEFAULTS); options.swfv = 9; options.mav = MochiAd.getVersion(); clip = options.clip; if (!MochiAd._isNetworkAvailable()){ return (null); }; try { if (clip._mochiad_loaded){ return (null); }; } catch(e:Error) { throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic.")); }; depth = options.depth; delete options.depth; mc = createEmptyMovieClip(clip, "_mochiad", depth); wh = MochiAd._getRes(options, clip); options.res = ((wh[0] + "x") + wh[1]); options.server = (options.server + options.id); delete options.id; clip._mochiad_loaded = true; if (clip.loaderInfo.loaderURL.indexOf("http") == 0){ options.as3_swf = clip.loaderInfo.loaderURL; }; lv = new URLVariables(); for (k in options) { v = options[k]; if (!(v is Function)){ lv[k] = v; }; }; server = lv.server; delete lv.server; hostname = _allowDomains(server); lc = new LocalConnection(); lc.client = mc; name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_"); lc.allowDomain("*", "localhost"); lc.allowInsecureDomain("*", "localhost"); lc.connect(name); mc.lc = lc; lv.lc = name; lv.st = getTimer(); loader = new Loader(); f = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); mc._mochiad_ctr_failed = true; }; loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f); g = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); MochiAd.unload(clip); }; loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g); req = new URLRequest((server + ".swf")); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; loader.load(req); mc.addChild(loader); mc._mochiad_ctr = loader; return (mc); } public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{ var _local4:MovieClip; _local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id}); if (!_local4){ return (false); }; _local4.doSend(["sendHighScore", _arg1], _arg2, _arg3); return (true); } public static function _parseOptions(_arg1:Object, _arg2:Object):Object{ var _local3:Object; var _local4:String; var _local5:Array; var _local6:Number; var _local7:Array; _local3 = {}; for (_local4 in _arg2) { _local3[_local4] = _arg2[_local4]; }; if (_arg1){ for (_local4 in _arg1) { _local3[_local4] = _arg1[_local4]; }; }; if (_local3.clip == undefined){ throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite.")); }; _arg1 = _local3.clip.loaderInfo.parameters.mochiad_options; if (_arg1){ _local5 = _arg1.split("&"); _local6 = 0; while (_local6 < _local5.length) { _local7 = _local5[_local6].split("="); _local3[unescape(_local7[0])] = unescape(_local7[1]); _local6++; }; }; if (_local3.id == "test"){ trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!"); }; return (_local3); } public static function _isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function _cleanup(_arg1:Object):void{ var idx:Number; var k:String; var lc:LocalConnection; var f:Function; var mc = _arg1; if (("lc" in mc)){ lc = mc.lc; f = function ():void{ try { lc.client = null; lc.close(); } catch(e:Error) { }; }; setTimeout(f, 0); }; idx = DisplayObjectContainer(mc).numChildren; while (idx > 0) { idx = (idx - 1); DisplayObjectContainer(mc).removeChildAt(idx); }; for (k in mc) { delete mc[k]; }; } public static function unload(_arg1:Object):Boolean{ if (((_arg1.clip) && (_arg1.clip._mochiad))){ _arg1 = _arg1.clip; }; if (!_arg1._mochiad){ return (false); }; if (_arg1._mochiad.onUnload){ _arg1._mochiad.onUnload(); }; delete _arg1._mochiad_loaded; delete _arg1._mochiad; return (true); } public static function showInterLevelAd(_arg1:Object):void{ var DEFAULTS:Object; var clip:Object; var ad_msec:Number; var ad_timeout:Number; var fadeout_time:Number; var mc:MovieClip; var wh:Array; var w:Number; var h:Number; var chk:MovieClip; var options = _arg1; DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }}; options = MochiAd._parseOptions(options, DEFAULTS); clip = options.clip; ad_msec = 11000; ad_timeout = options.ad_timeout; delete options.ad_timeout; fadeout_time = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); options.ad_finished(); }; wh = MochiAd._getRes(options, clip); w = wh[0]; h = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ var _local1:Number; if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; _local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 0.01); } else { MochiAd.unload(clip); delete this["onEnterFrame"]; }; }; mc.unloadAd = function ():void{ MochiAd.unload(clip); }; mc.adjustProgress = function (_arg1:Number):void{ var _local2:Object; _local2 = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = (_arg1 - 250); }; chk["onEnterFrame"] = function ():void{ var _local1:Object; var _local2:Number; var _local3:Boolean; var _local4:Number; if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; _local1 = this.parent._mochiad_ctr; _local2 = (getTimer() - this.started); _local3 = false; if (!chk.showing){ _local4 = _local1.loaderInfo.bytesTotal; if ((((_local4 > 0)) || (("number" == "undefined")))){ chk.showing = true; chk.started = getTimer(); } else { if (_local2 > chk.ad_timeout){ _local3 = true; }; }; }; if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){ _local3 = true; }; if (_local3){ if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = this.fadeFunction; }; }; }; doOnEnterFrame(chk); } public static function _getRes(_arg1:Object, _arg2:Object):Array{ var _local3:Object; var _local4:Number; var _local5:Number; var _local6:Array; _local3 = _arg2.getBounds(_arg2.root); _local4 = 0; _local5 = 0; if (typeof(_arg1.res) != "undefined"){ _local6 = _arg1.res.split("x"); _local4 = parseFloat(_local6[0]); _local5 = parseFloat(_local6[1]); } else { _local4 = (_local3.xMax - _local3.xMin); _local5 = (_local3.yMax - _local3.yMin); }; if ((((_local4 == 0)) || ((_local5 == 0)))){ _local4 = _arg2.stage.stageWidth; _local5 = _arg2.stage.stageHeight; }; return ([_local4, _local5]); } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{ var _local4:MovieClip; _local4 = new MovieClip(); if (((false) && (_arg3))){ _arg1.addChildAt(_local4, _arg3); } else { _arg1.addChild(_local4); }; _arg1[_arg2] = _local4; _local4["_name"] = _arg2; return (_local4); } public static function _loadCommunicator(_arg1:Object):MovieClip{ var DEFAULTS:Object; var clip:Object; var clipname:String; var server:String; var depth:Number; var mc:MovieClip; var lv:URLVariables; var k:String; var lc:LocalConnection; var name:String; var req:URLRequest; var loader:Loader; var options = _arg1; DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"}; options = MochiAd._parseOptions(options, DEFAULTS); options.swfv = 9; options.mav = MochiAd.getVersion(); clip = options.clip; clipname = ("_mochiad_com_" + options.id); if (!MochiAd._isNetworkAvailable()){ return (null); }; if (clip[clipname]){ return (clip[clipname]); }; server = (options.com_server + options.id); MochiAd._allowDomains(server); delete options.id; delete options.com_server; depth = options.depth; delete options.depth; mc = createEmptyMovieClip(clip, clipname, depth); lv = new URLVariables(); for (k in options) { lv[k] = options[k]; }; lc = new LocalConnection(); lc.client = mc; name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_"); lc.allowDomain("*", "localhost"); lc.allowInsecureDomain("*", "localhost"); lc.connect(name); mc.name = name; mc.lc = lc; lv.lc = name; mc._id = 0; mc._queue = []; mc.rpcResult = function (_arg1:Object):void{ var _local3:Array; var _local4:Array; var _local5:Number; var _local6:Object; var _local7:Object; _arg1 = parseInt(_arg1.toString()); _local3 = mc._callbacks[_arg1]; if (typeof(_local3) == "undefined"){ return; }; delete mc._callbacks[_arg1]; _local4 = []; _local5 = 2; while (_local5 < _local3.length) { _local4.push(_local3[_local5]); _local5++; }; _local5 = 1; while (_local5 < arguments.length) { _local4.push(arguments[_local5]); _local5++; }; _local6 = _local3[1]; _local7 = _local3[0]; if (((_local7) && ((typeof(_local6) == "string")))){ _local6 = _local7[_local6]; }; if (typeof(_local6) == "function"){ _local6.apply(_local7, _local4); }; }; mc._didConnect = function (_arg1:String):void{ var _local2:Array; var _local3:Function; var _local4:Number; var _local5:Array; mc._endpoint = _arg1; _local2 = mc._queue; delete mc._queue; _local3 = mc.doSend; _local4 = 0; while (_local4 < _local2.length) { _local5 = _local2[_local4]; _local3.apply(this, _local5); _local4++; }; }; mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{ var _local5:Number; var _local6:LocalConnection; var _local7:Array; var _local8:Number; if (mc._endpoint == null){ _local7 = []; _local8 = 0; while (_local8 < arguments.length) { _local7.push(arguments[_local8]); _local8++; }; mc._queue.push(_local7); return; }; mc._id = (mc._id + 1); _local5 = mc._id; mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))]; _local6 = new LocalConnection(); _local6.send(mc._endpoint, "rpc", _local5, _arg1); }; mc._callbacks = {}; mc._callbacks[0] = [mc, "_didConnect"]; lv.st = getTimer(); req = new URLRequest((server + ".swf")); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; loader = new Loader(); loader.load(req); mc.addChild(loader); mc._mochiad_com = loader; return (mc); } public static function showPreGameAd(_arg1:Object):void{ var DEFAULTS:Object; var clip:Object; var ad_msec:Number; var ad_timeout:Number; var fadeout_time:Number; var mc:MovieClip; var wh:Array; var w:Number; var h:Number; var chk:MovieClip; var bar:MovieClip; var bar_color:Number; var bar_background:Number; var bar_outline:Number; var backing_mc:MovieClip; var backing:Object; var inside_mc:MovieClip; var inside:Object; var outline_mc:MovieClip; var outline:Object; var complete:Boolean; var unloaded:Boolean; var f:Function; var r:MovieClip; var options = _arg1; DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }}; options = MochiAd._parseOptions(options, DEFAULTS); clip = options.clip; ad_msec = 11000; ad_timeout = options.ad_timeout; delete options.ad_timeout; fadeout_time = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ var fn:Function; MochiAd._cleanup(mc); fn = function ():void{ options.ad_finished(); }; setTimeout(fn, 100); }; wh = MochiAd._getRes(options, clip); w = wh[0]; h = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.x = (w * -0.5); chk.y = (h * -0.5); bar = createEmptyMovieClip(chk, "_mochiad_bar", 4); bar.x = 10; bar.y = (h - 20); bar_color = options.color; delete options.color; bar_background = options.background; delete options.background; bar_outline = options.outline; delete options.outline; backing_mc = createEmptyMovieClip(bar, "_outline", 1); backing = backing_mc.graphics; backing.beginFill(bar_background); backing.moveTo(0, 0); backing.lineTo((w - 20), 0); backing.lineTo((w - 20), 10); backing.lineTo(0, 10); backing.lineTo(0, 0); backing.endFill(); inside_mc = createEmptyMovieClip(bar, "_inside", 2); inside = inside_mc.graphics; inside.beginFill(bar_color); inside.moveTo(0, 0); inside.lineTo((w - 20), 0); inside.lineTo((w - 20), 10); inside.lineTo(0, 10); inside.lineTo(0, 0); inside.endFill(); inside_mc.scaleX = 0; outline_mc = createEmptyMovieClip(bar, "_outline", 3); outline = outline_mc.graphics; outline.lineStyle(0, bar_outline, 100); outline.moveTo(0, 0); outline.lineTo((w - 20), 0); outline.lineTo((w - 20), 10); outline.lineTo(0, 10); outline.lineTo(0, 0); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.last_pcnt = 0; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ var _local1:Number; _local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 0.01); } else { MochiAd.unload(clip); delete this["onEnterFrame"]; }; }; complete = false; unloaded = false; f = function (_arg1:Event):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); complete = true; if (unloaded){ MochiAd.unload(clip); }; }; clip.loaderInfo.addEventListener(Event.COMPLETE, f); if ((clip.root is MovieClip)){ r = (clip.root as MovieClip); if (r.framesLoaded >= r.totalFrames){ complete = true; }; }; mc.unloadAd = function ():void{ unloaded = true; if (complete){ MochiAd.unload(clip); }; }; mc.adjustProgress = function (_arg1:Number):void{ var _local2:Object; _local2 = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = _arg1; }; chk["onEnterFrame"] = function ():void{ var _local1:Object; var _local2:Object; var _local3:Number; var _local4:Boolean; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Object; var _local10:Number; var _local11:Number; if (!this.parent.parent){ delete this["onEnterFrame"]; return; }; _local1 = this.parent.parent.root; _local2 = this.parent._mochiad_ctr; _local3 = (getTimer() - this.started); _local4 = false; _local5 = _local1.loaderInfo.bytesTotal; _local6 = _local1.loaderInfo.bytesLoaded; if (complete){ _local6 = Math.max(1, _local6); _local5 = _local6; }; _local7 = ((100 * _local6) / _local5); _local8 = ((100 * _local3) / chk.ad_msec); _local9 = this._mochiad_bar._inside; _local10 = Math.min(100, Math.min(((_local7) || (0)), _local8)); _local10 = Math.max(this.last_pcnt, _local10); this.last_pcnt = _local10; _local9.scaleX = (_local10 * 0.01); if (!chk.showing){ _local11 = _local2.loaderInfo.bytesTotal; if ((((_local11 > 0)) || (("number" == "undefined")))){ chk.showing = true; chk.started = getTimer(); } else { if (_local3 > chk.ad_timeout){ _local4 = true; }; }; }; if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){ _local4 = true; }; if (((complete) && (_local4))){ if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = chk.fadeFunction; }; }; }; doOnEnterFrame(chk); } public static function showPreloaderAd(_arg1:Object):void{ MochiAd.showPreGameAd(_arg1); } public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{ var _local4:MovieClip; _local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id}); if (!_local4){ return (false); }; _local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3); return (true); } public static function doOnEnterFrame(_arg1:MovieClip):void{ var f:Function; var mc = _arg1; f = function (_arg1:Object):void{ if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){ mc.onEnterFrame(); } else { _arg1.target.removeEventListener(_arg1.type, arguments.callee); }; }; mc.addEventListener(Event.ENTER_FRAME, f); } } }//package
Section 90
//MochiBot (MochiBot) package { import flash.display.*; import flash.net.*; import flash.system.*; public dynamic class MochiBot extends Sprite { public static function track(_arg1:Sprite, _arg2:String):MochiBot{ var _local3:MochiBot; var _local4:String; var _local5:URLVariables; var _local6:String; var _local7:URLRequest; var _local8:Loader; if (Security.sandboxType == "localWithFile"){ return (null); }; _local3 = new (MochiBot); _arg1.addChild(_local3); Security.allowDomain("*"); Security.allowInsecureDomain("*"); _local4 = "http://core.mochibot.com/my/core.swf"; _local5 = new URLVariables(); _local5["sb"] = Security.sandboxType; _local5["v"] = Capabilities.version; _local5["swfid"] = _arg2; _local5["mv"] = "8"; _local5["fv"] = "9"; _local6 = _arg1.loaderInfo.url; if (_local6.indexOf("http") == 0){ _local5["url"] = _local6; } else { _local5["url"] = "local"; }; _local7 = new URLRequest(_local4); _local7.contentType = "application/x-www-form-urlencoded"; _local7.method = URLRequestMethod.POST; _local7.data = _local5; _local8 = new Loader(); _local3.addChild(_local8); _local8.load(_local7); return (_local3); } } }//package
Section 91
//MusicPlayerbody (MusicPlayerbody) package { import flash.display.*; public dynamic class MusicPlayerbody extends BitmapData { public function MusicPlayerbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 92
//RBinbody (RBinbody) package { import flash.display.*; public dynamic class RBinbody extends BitmapData { public function RBinbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 93
//Registrybody (Registrybody) package { import flash.display.*; public dynamic class Registrybody extends BitmapData { public function Registrybody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 94
//Resources (Resources) package { import flash.display.*; import fai.*; import flash.text.*; public final class Resources extends MovieClip { public var htime:TextField; public var health:TextField; private var engine:Engine;// = null public var score:TextField; public var money:TextField; public function Resources(_arg1:Engine):void{ engine = null; super(); engine = _arg1; } public function update():void{ var _local1:int; var _local2:int; money.text = engine.money.toString(); score.text = engine.score.toString(); _local1 = 0; _local2 = 0; while (_local2 < engine.soft.units.length) { _local1 = (_local1 + engine.soft.units[_local2].health); _local2++; }; health.text = _local1.toString(); } } }//package
Section 95
//RiskInfo (RiskInfo) package { import flash.display.*; import flash.text.*; public dynamic class RiskInfo extends MovieClip { public var risklevel:TextField; public var title:TextField; public var desc:TextField; public var quantity:TextField; } }//package
Section 96
//SecurityMon (SecurityMon) package { import flash.display.*; public dynamic class SecurityMon extends MovieClip { } }//package
Section 97
//SoftInfoPanel (SoftInfoPanel) package { import flash.display.*; import fai.*; import flash.text.*; public class SoftInfoPanel extends MovieClip { public var extra:TextField; public var repairButton:WebButton;// = null public var armor:TextField; public var title:TextField; public var health:TextField; public var upgradeButton:WebButton;// = null private var engine:Engine;// = null public var desc:TextField; public var slevel:TextField; public function SoftInfoPanel(_arg1:Engine):void{ var _local2:int; var _local3:int; var _local4:int; var _local5:int; var _local6:int; repairButton = null; upgradeButton = null; engine = null; super(); engine = _arg1; _local2 = -8; _local3 = 0; _local4 = 0x535353; _local5 = 143212; _local6 = 23253; repairButton = new WebButton("Repair (R) - 100$", 170, 23, 20, 11001343, 10, 30, true, _local3, _local4, _local5, _local6); repairButton.y = 275; repairButton.x = _local2; addChild(repairButton); upgradeButton = new WebButton("Update Soft - 1000$", 170, 23, 20, 0xFFFFFF, 10, 30, true, _local3, _local4, _local5, _local6); upgradeButton.y = 310; upgradeButton.x = _local2; addChild(upgradeButton); visible = false; } public function showAbout(_arg1:Unit):void{ var _local2:String; var _local3:int; visible = !((_arg1 == null)); if (_arg1){ _local2 = "Update is available for this software."; if (_arg1.upgradeLevel >= 2){ _local2 = "Software is up to date."; }; _local3 = engine.utypes.params(_arg1.type).health; _local3 = (_local3 + ((_local3 * _arg1.upgradeLevel) * Consts.upgradeHExtra)); title.text = _arg1.type; health.text = ((_arg1.health.toString() + "/") + _local3.toString()); armor.text = _arg1.armor.toString(); desc.text = _arg1.desc; slevel.text = (_arg1.upgradeLevel.toString() + "/2"); extra.text = _local2; }; } } }//package
Section 98
//Soundclickerx (Soundclickerx) package { import flash.media.*; public dynamic class Soundclickerx extends Sound { } }//package
Section 99
//Sounddeath (Sounddeath) package { import flash.media.*; public dynamic class Sounddeath extends Sound { } }//package
Section 100
//Soundenemiesappearing (Soundenemiesappearing) package { import flash.media.*; public dynamic class Soundenemiesappearing extends Sound { } }//package
Section 101
//Soundshot_anti (Soundshot_anti) package { import flash.media.*; public dynamic class Soundshot_anti extends Sound { } }//package
Section 102
//Soundshot_firewall (Soundshot_firewall) package { import flash.media.*; public dynamic class Soundshot_firewall extends Sound { } }//package
Section 103
//Soundshot_hijack (Soundshot_hijack) package { import flash.media.*; public dynamic class Soundshot_hijack extends Sound { } }//package
Section 104
//SoundStartMenu (SoundStartMenu) package { import flash.media.*; public dynamic class SoundStartMenu extends Sound { } }//package
Section 105
//Spambody (Spambody) package { import flash.display.*; public dynamic class Spambody extends BitmapData { public function Spambody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 106
//Specialsdeath1 (Specialsdeath1) package { import flash.display.*; public dynamic class Specialsdeath1 extends BitmapData { public function Specialsdeath1(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 107
//Specialsdebris (Specialsdebris) package { import flash.display.*; public dynamic class Specialsdebris extends BitmapData { public function Specialsdebris(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 108
//Specialssofthit (Specialssofthit) package { import flash.display.*; public dynamic class Specialssofthit extends BitmapData { public function Specialssofthit(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 109
//Spywarebody (Spywarebody) package { import flash.display.*; public dynamic class Spywarebody extends BitmapData { public function Spywarebody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 110
//StartMenu (StartMenu) package { import flash.display.*; import fai.*; import flash.events.*; public class StartMenu extends MovieClip { public var easy:WebButton;// = null public var hs:WebButton;// = null public var hard:WebButton;// = null public var tut:WebButton;// = null public var gregbutton:SimpleButton; private var engine:Engine;// = null public var newgame:WebButton;// = null public var resumegame:WebButton;// = null public var extreme:WebButton;// = null public var normal:WebButton;// = null private static const xoffset:int = 49; public function StartMenu(_arg1:Engine):void{ resumegame = null; newgame = null; easy = null; normal = null; hard = null; extreme = null; hs = null; tut = null; engine = null; super(); engine = _arg1; resumegame = new WebButton("Resume Game", 180, 27, 20, 13490687, 14, 25, true); resumegame.visible = false; addChild(resumegame); resumegame.y = 100; resumegame.x = xoffset; newgame = new WebButton("New Game", 180, 27, 20, 0xFFFFFF, 14, 25, true); newgame.visible = false; addChild(newgame); newgame.y = 140; newgame.x = xoffset; easy = new WebButton("Easy", 180, 27, 20, 13490687, 14, 25, true); addChild(easy); easy.y = 80; easy.x = xoffset; normal = new WebButton("Normal", 180, 27, 20, 0xFFFFFF, 14, 25, true); addChild(normal); normal.y = 115; normal.x = xoffset; hard = new WebButton("Hard", 180, 27, 20, 16772518, 14, 25, true); addChild(hard); hard.y = 150; hard.x = xoffset; extreme = new WebButton("Extreme", 180, 27, 20, 16754342, 14, 25, true); addChild(extreme); extreme.y = 185; extreme.x = xoffset; tut = new WebButton("How to Play", 180, 27, 20, 16768342, 14, 25, true); addChild(tut); tut.y = 237; tut.x = xoffset; hs = new WebButton("Highscores", 180, 27, 20, 16768342, 14, 25, true); addChild(hs); hs.y = 285; hs.x = xoffset; resumegame.addEventListener(MouseEvent.MOUSE_DOWN, onResumeGame); newgame.addEventListener(MouseEvent.MOUSE_DOWN, onNewGame); easy.addEventListener(MouseEvent.MOUSE_DOWN, onEasy); normal.addEventListener(MouseEvent.MOUSE_DOWN, onNormal); hard.addEventListener(MouseEvent.MOUSE_DOWN, onHard); extreme.addEventListener(MouseEvent.MOUSE_DOWN, onExtreme); tut.addEventListener(MouseEvent.MOUSE_DOWN, onTut); hs.addEventListener(MouseEvent.MOUSE_DOWN, onHS); } private function onResumeGame(_arg1:MouseEvent){ engine.playClick(); engine.menu.startMenu(); } private function onHS(_arg1:MouseEvent){ engine.playClick(); engine.sloader.navigateToLeaderboard(); } private function onHard(_arg1:MouseEvent){ engine.playClick(); buttonsVisible(false); engine.loadMap(engine.sloader.maps.get(0)); engine.restart(Consts.Hard); engine.menu.startMenu(); } private function onEasy(_arg1:MouseEvent){ engine.playClick(); buttonsVisible(false); engine.loadMap(engine.sloader.maps.get(0)); engine.restart(Consts.Easy); engine.menu.startMenu(); } private function onNormal(_arg1:MouseEvent){ engine.playClick(); buttonsVisible(false); engine.loadMap(engine.sloader.maps.get(0)); engine.restart(Consts.Normal); engine.menu.startMenu(); } public function buttonsVisible(_arg1:Boolean):void{ easy.visible = _arg1; normal.visible = _arg1; hard.visible = _arg1; extreme.visible = _arg1; resumegame.visible = !(_arg1); newgame.visible = !(_arg1); } private function onTut(_arg1:MouseEvent){ engine.menu.showTutorial(); } private function onExtreme(_arg1:MouseEvent){ engine.playClick(); buttonsVisible(false); engine.loadMap(engine.sloader.maps.get(0)); engine.restart(Consts.Extreme); engine.menu.startMenu(); } private function onNewGame(_arg1:MouseEvent){ engine.playClick(); buttonsVisible(true); } } }//package
Section 111
//StartMenuButton (StartMenuButton) package { import flash.display.*; import fai.*; import flash.events.*; public class StartMenuButton extends MovieClip { private var clicked:Boolean;// = false private var engine:Engine;// = null public function StartMenuButton(_arg1:Engine):void{ clicked = false; engine = null; super(); addFrameScript(6, frame7, 14, frame15); engine = _arg1; addEventListener(MouseEvent.MOUSE_OVER, onOver); addEventListener(MouseEvent.MOUSE_OUT, onOut); addEventListener(MouseEvent.MOUSE_DOWN, onDown); enable(true); } private function onDown(_arg1:MouseEvent):void{ if (!engine.scenario.isRunning()){ return; }; engine.playClick(); engine.menu.startMenu(); } function frame15(){ stop(); } function frame7(){ stop(); } private function onOver(_arg1:MouseEvent):void{ if (!clicked){ gotoAndPlay("start"); }; } public function enable(_arg1:Boolean):void{ clicked = _arg1; if (_arg1){ gotoAndPlay("start"); } else { gotoAndPlay("middle"); }; } private function onOut(_arg1:MouseEvent):void{ if (!clicked){ gotoAndPlay("middle"); }; } } }//package
Section 112
//Statistics (Statistics) package { import flash.display.*; import fai.*; import flash.text.*; public class Statistics extends MovieClip { public var ilost:int;// = 0 public var ikilled:int;// = 0 public var playnext:WebButton;// = null public var subtitle:TextField; public var closebutton:SimpleButton; public var lost:TextField; public var savescore:WebButton;// = null public var restart:WebButton;// = null public var spent:TextField; public var killed:TextField; public var mainmenu:WebButton;// = null public var score:TextField; public var kongbutton:SimpleButton; public var ispent:int;// = 0 public var ibuilt:int;// = 0 public var built:TextField; public var iscore:int;// = 0 public var caption:TextField; public function Statistics():void{ iscore = 0; ikilled = 0; ilost = 0; ispent = 0; ibuilt = 0; restart = null; savescore = null; mainmenu = null; playnext = null; super(); addFrameScript(0, frame1); restart = new WebButton("Restart", 75, 20, 20, 11657215, 10, 20, false); restart.x = 6; restart.y = 280; addChild(restart); mainmenu = new WebButton("Main Menu", 77, 20, 20, 0xFFFFFF, 10, 20, false); mainmenu.x = 90; mainmenu.y = 280; addChild(mainmenu); savescore = new WebButton("Save Score", 80, 20, 20, 0xFFFFFF, 10, 20, false); savescore.x = 175; savescore.y = 280; addChild(savescore); update(); } function frame1(){ MochiBot.track(this, "8fe4271f"); } public function reset():void{ visible = false; iscore = (ikilled = (ilost = (ispent = (ibuilt = 0)))); update(); } public function update():void{ score.text = iscore.toString(); killed.text = ikilled.toString(); lost.text = ilost.toString(); spent.text = ispent.toString(); built.text = ibuilt.toString(); } } }//package
Section 113
//SubmitHighscores (SubmitHighscores) package { import flash.display.*; import flash.text.*; public dynamic class SubmitHighscores extends MovieClip { public var msg:TextField; public var username:TextField; } }//package
Section 114
//Threat (Threat) package { import flash.display.*; import flash.text.*; public dynamic class Threat extends MovieClip { public var title:TextField; public var level:TextField; } }//package
Section 115
//Trojanbody (Trojanbody) package { import flash.display.*; public dynamic class Trojanbody extends BitmapData { public function Trojanbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package
Section 116
//UnitInfoPanel (UnitInfoPanel) package { import flash.display.*; import fai.*; import flash.text.*; public class UnitInfoPanel extends MovieClip { public var extra:TextField; public var repairButton:WebButton;// = null public var costbitmap:MovieClip; public var armor:TextField; public var range:TextField; public var attack:TextField; public var title:TextField; public var health:TextField; public var upgradeButton:WebButton;// = null private var engine:Engine;// = null public var desc:TextField; public var destroyButton:WebButton;// = null public var cost:TextField; public function UnitInfoPanel(_arg1:Engine):void{ var _local2:int; var _local3:int; var _local4:int; var _local5:int; var _local6:int; destroyButton = null; repairButton = null; upgradeButton = null; engine = null; super(); engine = _arg1; _local2 = -8; _local3 = 0; _local4 = 0x535353; _local5 = 143212; _local6 = 23253; destroyButton = new WebButton("Sell for 100$", 170, 20, 20, 0xFFFFFF, 10, 20, false, 16128559, 16613516, 16671601, 16701146); destroyButton.x = _local2; destroyButton.y = 338; addChild(destroyButton); repairButton = new WebButton("Repair (R) - 100$", 170, 23, 20, 11001343, 10, 30, true, _local3, _local4, _local5, _local6); repairButton.y = 275; repairButton.x = _local2; addChild(repairButton); upgradeButton = new WebButton("Upgrade (U) - 1000$", 170, 23, 20, 0xFFFFFF, 10, 30, true, _local3, _local4, _local5, _local6); upgradeButton.y = 303; upgradeButton.x = _local2; addChild(upgradeButton); visible = false; } public function showAbout(_arg1:Unit, _arg2:Boolean):void{ var _local3:int; var _local4:TextFormat; var _local5:int; visible = !((_arg1 == null)); if (_arg1){ if (engine.menu.buttons.selectedUnit != _arg1){ destroyButton.visible = !(_arg2); repairButton.visible = !(_arg2); cost.visible = !(_arg2); costbitmap.visible = !(_arg2); } else { destroyButton.visible = false; repairButton.visible = false; costbitmap.visible = true; cost.visible = true; }; _local3 = 0xFFFFFF; if (_arg2){ _local3 = 0xFF0000; switch (_arg1.type){ case UnitTypes.adware: extra.text = "Most simple and safe threat, doesn't hurt much"; break; case UnitTypes.spam: extra.text = "Weak threat but has large quantity"; break; case UnitTypes.backdoor: extra.text = "Weak threat but has increased life rate"; break; case UnitTypes.trojan: extra.text = "Average risk threat, dangerous on higher levels"; break; case UnitTypes.spyware: extra.text = "Above average threat, very dangerous on higher levels"; break; case UnitTypes.keylogger: extra.text = "Above average threat, most fast moving invader"; break; case UnitTypes.hijacker: extra.text = "Strong invader, can destroy security tools"; break; case UnitTypes.virus: extra.text = "Most dangerous invader, moves above security tools"; break; }; } else { switch (_arg1.type){ case UnitTypes.antiadware: extra.text = "Damages all types of malware."; break; case UnitTypes.antispyware: extra.text = "Damages all except viruses."; break; case UnitTypes.antivirus: extra.text = "Against viruses only. Very good fire speed."; break; case UnitTypes.garbagecleaner: extra.text = "Damages all types of malware. Slows down invaders + chance to stan."; break; case UnitTypes.firewall: extra.text = "Damages all malware within fire range. Does not affect viruses"; break; }; }; _local4 = title.defaultTextFormat; _local4.color = _local3; title.defaultTextFormat = _local4; _local5 = engine.utypes.params(_arg1.type).health; _local5 = (engine.utypes.params(_arg1.type).health + ((_local5 * _arg1.upgradeLevel) * Consts.upgradeHExtra)); title.text = _arg1.type; health.text = ((_arg1.health.toString() + "/") + _local5.toString()); armor.text = _arg1.armor.toString(); range.text = Utils.textrange(_arg1.eyerange); desc.text = _arg1.desc; attack.text = _arg1.damage.toString(); cost.text = _arg1.cost.toString(); }; } } }//package
Section 117
//UpgradeStar (UpgradeStar) package { import flash.display.*; public dynamic class UpgradeStar extends MovieClip { } }//package
Section 118
//Virusbody (Virusbody) package { import flash.display.*; public dynamic class Virusbody extends BitmapData { public function Virusbody(_arg1:Number, _arg2:Number){ super(_arg1, _arg2); } } }//package

Library Items

Symbol 1 Sound {SoundStartMenu}
Symbol 2 Sound {Soundshot_hijack}
Symbol 3 Sound {Soundshot_firewall}
Symbol 4 Sound {Soundshot_anti}
Symbol 5 Sound {Soundenemiesappearing}
Symbol 6 Sound {Sounddeath}
Symbol 7 Sound {Soundclickerx}
Symbol 8 Bitmap {Groundwindowheader}
Symbol 9 Bitmap {Specialssofthit}
Symbol 10 Bitmap {Specialsdebris}
Symbol 11 Bitmap {Specialsdeath1}
Symbol 12 Bitmap {Antiadwarebullet}
Symbol 13 Bitmap {Antispywarebullet}
Symbol 14 Bitmap {GarbageCleanerbullet}
Symbol 15 Bitmap {Antivirusbullet}
Symbol 16 Bitmap {Hijackerbullet}
Symbol 17 Bitmap {Buttonbstop}
Symbol 18 Bitmap {Backdoorbody}
Symbol 19 Bitmap {Spywarebody}
Symbol 20 Bitmap {Trojanbody}
Symbol 21 Bitmap {Mailbody}
Symbol 22 Bitmap {Controlpanelbody}
Symbol 23 Bitmap {Docsbody}
Symbol 24 Bitmap {Gamesbody}
Symbol 25 Bitmap {Messengerbody}
Symbol 26 Bitmap {RBinbody}
Symbol 27 Bitmap {Registrybody}
Symbol 28 Bitmap {MusicPlayerbody}
Symbol 29 Bitmap {Buttonbgarbagecleaner}
Symbol 30 Bitmap {Buttonbfirewall}
Symbol 31 Bitmap {Hijackerbe}
Symbol 32 Bitmap {Antivirusbe}
Symbol 33 Bitmap {GarbageCleanerbe}
Symbol 34 Bitmap {Antispywarebe}
Symbol 35 Bitmap {Antiadwarebe}
Symbol 36 Bitmap {Buttonbcancel}
Symbol 37 Bitmap {Buttonbattack}
Symbol 38 Bitmap {Buttonbantivirus}
Symbol 39 Bitmap {Buttonbantispyware}
Symbol 40 Bitmap {Buttonbantiadware}
Symbol 41 Bitmap {Groundbackground}
Symbol 42 Bitmap {Hijackerattack}
Symbol 43 Bitmap {Firewallattack}
Symbol 44 Bitmap {Antivirusattack}
Symbol 45 Bitmap {GarbageCleanerattack}
Symbol 46 Bitmap {Antispywareattack}
Symbol 47 Bitmap {Antiadwareattack}
Symbol 48 GraphicUsed by:49 77
Symbol 49 MovieClipUses:48Used by:77
Symbol 50 GraphicUsed by:51
Symbol 51 ButtonUses:50Used by:77
Symbol 52 GraphicUsed by:77
Symbol 53 GraphicUsed by:54 159
Symbol 54 MovieClipUses:53Used by:71 77 158
Symbol 55 GraphicUsed by:56
Symbol 56 MovieClipUses:55Used by:70 77
Symbol 57 GraphicUsed by:58
Symbol 58 MovieClipUses:57Used by:65 70 71 77
Symbol 59 GraphicUsed by:60
Symbol 60 MovieClipUses:59Used by:65 70 71 77
Symbol 61 GraphicUsed by:62
Symbol 62 MovieClipUses:61Used by:65 70 71 77
Symbol 63 GraphicUsed by:64
Symbol 64 MovieClipUses:63Used by:65 70 71 77
Symbol 65 MovieClipUses:58 60 62 64Used by:77
Symbol 66 GraphicUsed by:77
Symbol 67 GraphicUsed by:68 77
Symbol 68 MovieClipUses:67Used by:77
Symbol 69 GraphicUsed by:71
Symbol 70 MovieClipUses:56 58 60 62 64Used by:71
Symbol 71 MovieClipUses:69 54 70 58 60 62 64Used by:77
Symbol 72 GraphicUsed by:73
Symbol 73 MovieClipUses:72Used by:77
Symbol 74 FontUsed by:75 175 176 177 178 179 194 196 197 200
Symbol 75 TextUses:74Used by:76
Symbol 76 MovieClipUses:75Used by:77
Symbol 77 MovieClip {Kongintro12fps}Uses:48 49 51 52 54 56 65 66 68 58 60 62 64 71 73 67 76
Symbol 78 GraphicUsed by:79
Symbol 79 MovieClip {UpgradeStar}Uses:78
Symbol 80 GraphicUsed by:85
Symbol 81 FontUsed by:82 83 84 89 92 93 94 95 96 105 106 107 112 119 120 122 125 127 128 129 130 138 144 145 146 147 148 149 150 151 152 153 167 168
Symbol 82 TextUses:81Used by:85
Symbol 83 EditableTextUses:81Used by:85
Symbol 84 EditableTextUses:81Used by:85
Symbol 85 MovieClip {SubmitHighscores}Uses:80 82 83 84
Symbol 86 Bitmap {Menumoney}Used by:99
Symbol 87 Bitmap {Menuattack}Used by:101
Symbol 88 Bitmap {Menurange}Used by:101
Symbol 89 EditableTextUses:81Used by:101
Symbol 90 FontUsed by:91 100 118 126 131 143 167
Symbol 91 EditableTextUses:90Used by:101
Symbol 92 EditableTextUses:81Used by:101
Symbol 93 EditableTextUses:81Used by:101
Symbol 94 EditableTextUses:81Used by:101
Symbol 95 EditableTextUses:81Used by:101
Symbol 96 EditableTextUses:81Used by:101
Symbol 97 Bitmap {Menushield}Used by:101 132
Symbol 98 Bitmap {Menuheart}Used by:101 132
Symbol 99 MovieClipUses:86Used by:101
Symbol 100 EditableTextUses:90Used by:101
Symbol 101 MovieClip {UnitInfoPanel}Uses:89 91 92 93 94 95 96 88 97 87 98 99 100
Symbol 102 GraphicUsed by:113
Symbol 103 FontUsed by:104 180 195 196 198 199 201
Symbol 104 TextUses:103Used by:113
Symbol 105 EditableTextUses:81Used by:113
Symbol 106 EditableTextUses:81Used by:113
Symbol 107 EditableTextUses:81Used by:113
Symbol 108 BitmapUsed by:111
Symbol 109 BitmapUsed by:111
Symbol 110 BitmapUsed by:111
Symbol 111 GraphicUses:108 109 110Used by:113
Symbol 112 EditableTextUses:81Used by:113
Symbol 113 MovieClip {Resources}Uses:102 104 105 106 107 111 112
Symbol 114 BitmapUsed by:115
Symbol 115 GraphicUses:114Used by:121
Symbol 116 GraphicUsed by:117
Symbol 117 MovieClipUses:116Used by:121
Symbol 118 EditableTextUses:90Used by:121
Symbol 119 TextUses:81Used by:121
Symbol 120 EditableTextUses:81Used by:121
Symbol 121 MovieClip {Threat}Uses:115 117 118 119 120
Symbol 122 TextUses:81Used by:124
Symbol 123 GraphicUsed by:124
Symbol 124 MovieClip {SecurityMon}Uses:122 123
Symbol 125 EditableTextUses:81Used by:132
Symbol 126 EditableTextUses:90Used by:132
Symbol 127 EditableTextUses:81Used by:132
Symbol 128 EditableTextUses:81Used by:132
Symbol 129 TextUses:81Used by:132
Symbol 130 EditableTextUses:81Used by:132
Symbol 131 EditableTextUses:90Used by:132
Symbol 132 MovieClip {SoftInfoPanel}Uses:125 126 127 128 97 98 129 130 131
Symbol 133 GraphicUsed by:134
Symbol 134 MovieClipUses:133Used by:135
Symbol 135 MovieClip {FirewallCircle}Uses:134
Symbol 136 BitmapUsed by:137
Symbol 137 GraphicUses:136Used by:160
Symbol 138 EditableTextUses:81Used by:160
Symbol 139 BitmapUsed by:140
Symbol 140 GraphicUses:139Used by:142
Symbol 141 GraphicUsed by:142
Symbol 142 ButtonUses:140 141Used by:160
Symbol 143 EditableTextUses:90Used by:160
Symbol 144 TextUses:81Used by:160
Symbol 145 TextUses:81Used by:160
Symbol 146 TextUses:81Used by:160
Symbol 147 TextUses:81Used by:160
Symbol 148 TextUses:81Used by:160
Symbol 149 EditableTextUses:81Used by:160
Symbol 150 EditableTextUses:81Used by:160
Symbol 151 EditableTextUses:81Used by:160
Symbol 152 EditableTextUses:81Used by:160
Symbol 153 EditableTextUses:81Used by:160
Symbol 154 GraphicUsed by:158 159
Symbol 155 FontUsed by:156
Symbol 156 TextUses:155Used by:158 159
Symbol 157 GraphicUsed by:158 159
Symbol 158 MovieClipUses:154 156 157 54Used by:159
Symbol 159 ButtonUses:158 154 156 157 53Used by:160 169
Symbol 160 MovieClip {Statistics}Uses:137 138 142 143 144 145 146 147 148 149 150 151 152 153 159
Symbol 161 BitmapUsed by:162
Symbol 162 GraphicUses:161Used by:163
Symbol 163 MovieClipUses:162Used by:164
Symbol 164 MovieClip {StartMenuButton}Uses:163
Symbol 165 BitmapUsed by:166
Symbol 166 GraphicUses:165Used by:169
Symbol 167 EditableTextUses:81 90Used by:169
Symbol 168 TextUses:81Used by:169
Symbol 169 MovieClip {StartMenu}Uses:166 159 167 168
Symbol 170 BitmapUsed by:171
Symbol 171 GraphicUses:170Used by:172
Symbol 172 MovieClip {Blocking}Uses:171
Symbol 173 GraphicUsed by:174
Symbol 174 MovieClipUses:173Used by:181
Symbol 175 EditableTextUses:74Used by:181
Symbol 176 TextUses:74Used by:181
Symbol 177 EditableTextUses:74Used by:181
Symbol 178 TextUses:74Used by:181
Symbol 179 EditableTextUses:74Used by:181
Symbol 180 EditableTextUses:103Used by:181
Symbol 181 MovieClip {RiskInfo}Uses:174 175 176 177 178 179 180
Symbol 182 Bitmap {Adwarebody}Used by:203
Symbol 183 Bitmap {Browserbody}Used by:203
Symbol 184 Bitmap {Virusbody}Used by:203
Symbol 185 Bitmap {Hijackerbody}Used by:203
Symbol 186 Bitmap {Keyloggerbody}Used by:203
Symbol 187 Bitmap {Spambody}Used by:203
Symbol 188 Bitmap {Firewallbody}Used by:203
Symbol 189 Bitmap {Antivirusbody}Used by:203
Symbol 190 Bitmap {GarbageCleanerbody}Used by:203
Symbol 191 Bitmap {Antispywarebody}Used by:203
Symbol 192 Bitmap {Antiadwarebody}Used by:203
Symbol 193 GraphicUsed by:203
Symbol 194 TextUses:74Used by:203
Symbol 195 TextUses:103Used by:203
Symbol 196 TextUses:103 74Used by:203
Symbol 197 TextUses:74Used by:203
Symbol 198 TextUses:103Used by:203
Symbol 199 TextUses:103Used by:203
Symbol 200 TextUses:74Used by:203
Symbol 201 TextUses:103Used by:203
Symbol 202 GraphicUsed by:203
Symbol 203 MovieClip {HowToPlay}Uses:193 194 195 196 192 191 190 189 188 197 198 199 200 187 186 185 184 201 183 202 182

Instance Names

"username"Symbol 85 MovieClip {SubmitHighscores} Frame 1Symbol 83 EditableText
"msg"Symbol 85 MovieClip {SubmitHighscores} Frame 1Symbol 84 EditableText
"title"Symbol 101 MovieClip {UnitInfoPanel} Frame 1Symbol 89 EditableText
"desc"Symbol 101 MovieClip {UnitInfoPanel} Frame 1Symbol 91 EditableText
"health"Symbol 101 MovieClip {UnitInfoPanel} Frame 1Symbol 92 EditableText
"attack"Symbol 101 MovieClip {UnitInfoPanel} Frame 1Symbol 93 EditableText
"armor"Symbol 101 MovieClip {UnitInfoPanel} Frame 1Symbol 94 EditableText
"range"Symbol 101 MovieClip {UnitInfoPanel} Frame 1Symbol 95 EditableText
"cost"Symbol 101 MovieClip {UnitInfoPanel} Frame 1Symbol 96 EditableText
"costbitmap"Symbol 101 MovieClip {UnitInfoPanel} Frame 1Symbol 99 MovieClip
"extra"Symbol 101 MovieClip {UnitInfoPanel} Frame 1Symbol 100 EditableText
"score"Symbol 113 MovieClip {Resources} Frame 1Symbol 105 EditableText
"money"Symbol 113 MovieClip {Resources} Frame 1Symbol 106 EditableText
"health"Symbol 113 MovieClip {Resources} Frame 1Symbol 107 EditableText
"htime"Symbol 113 MovieClip {Resources} Frame 1Symbol 112 EditableText
"title"Symbol 121 MovieClip {Threat} Frame 1Symbol 118 EditableText
"level"Symbol 121 MovieClip {Threat} Frame 1Symbol 120 EditableText
"title"Symbol 132 MovieClip {SoftInfoPanel} Frame 1Symbol 125 EditableText
"desc"Symbol 132 MovieClip {SoftInfoPanel} Frame 1Symbol 126 EditableText
"health"Symbol 132 MovieClip {SoftInfoPanel} Frame 1Symbol 127 EditableText
"armor"Symbol 132 MovieClip {SoftInfoPanel} Frame 1Symbol 128 EditableText
"slevel"Symbol 132 MovieClip {SoftInfoPanel} Frame 1Symbol 130 EditableText
"extra"Symbol 132 MovieClip {SoftInfoPanel} Frame 1Symbol 131 EditableText
"caption"Symbol 160 MovieClip {Statistics} Frame 1Symbol 138 EditableText
"closebutton"Symbol 160 MovieClip {Statistics} Frame 1Symbol 142 Button
"subtitle"Symbol 160 MovieClip {Statistics} Frame 1Symbol 143 EditableText
"score"Symbol 160 MovieClip {Statistics} Frame 1Symbol 149 EditableText
"killed"Symbol 160 MovieClip {Statistics} Frame 1Symbol 150 EditableText
"lost"Symbol 160 MovieClip {Statistics} Frame 1Symbol 151 EditableText
"spent"Symbol 160 MovieClip {Statistics} Frame 1Symbol 152 EditableText
"built"Symbol 160 MovieClip {Statistics} Frame 1Symbol 153 EditableText
"kongbutton"Symbol 160 MovieClip {Statistics} Frame 1Symbol 159 Button
"gregbutton"Symbol 169 MovieClip {StartMenu} Frame 1Symbol 159 Button
"desc"Symbol 181 MovieClip {RiskInfo} Frame 1Symbol 175 EditableText
"quantity"Symbol 181 MovieClip {RiskInfo} Frame 1Symbol 177 EditableText
"risklevel"Symbol 181 MovieClip {RiskInfo} Frame 1Symbol 179 EditableText
"title"Symbol 181 MovieClip {RiskInfo} Frame 1Symbol 180 EditableText

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata not present, AS3.
Protect (24)Timeline Frame 131 bytes "..$1$Sw$rNv0I4E8oTE8PjXpMCWoM1."

Labels

"start"Symbol 164 MovieClip {StartMenuButton} Frame 1
"middle"Symbol 164 MovieClip {StartMenuButton} Frame 8
"end"Symbol 164 MovieClip {StartMenuButton} Frame 15
"start"Symbol 172 MovieClip {Blocking} Frame 1




http://swfchan.com/9/41265/info.shtml
Created: 10/5 -2019 10:07:21 Last modified: 10/5 -2019 10:07:21 Server time: 22/12 -2024 10:22:40