Section 1
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 2
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 3
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 4
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 5
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 6
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 7
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 8
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 9
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 10
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 11
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 12
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import com.kongregate.as3.client.services.*;
import com.kongregate.as3.client.events.*;
import flash.system.*;
import flash.errors.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 13
//ISoundLibrary (controller.sound.ISoundLibrary)
package controller.sound {
import flash.media.*;
public interface ISoundLibrary {
function getSound(_arg1:String):Sound;
}
}//package controller.sound
Section 14
//SoundManager (controller.sound.SoundManager)
package controller.sound {
import flash.events.*;
import flash.display.*;
import model.*;
import flash.utils.*;
import view.debug.*;
import flash.media.*;
public class SoundManager extends EventDispatcher {
private var _soundLibrary:ISoundLibrary;
private var _loopingSoundsArray:Array;
private var _swfLoader:Loader;
private static var directoryPattern:RegExp = /\//;
private static var _instance:SoundManager;
private static var wavPattern:RegExp = /.wav/;
public function SoundManager():void{
var _local1:ByteArray;
super();
_loopingSoundsArray = new Array();
_swfLoader = new Loader();
_local1 = ContentManager.getInstance().getByteArray("sound/sound.swf");
_swfLoader.loadBytes(_local1);
_swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
}
public function playSound(_arg1:String, _arg2:Boolean):void{
var noDirectoryArray:Array;
var loopTimes:int;
var tempString:String;
var sound:Sound;
var path = _arg1;
var loop = _arg2;
try {
noDirectoryArray = path.split(directoryPattern);
loopTimes = 0;
for each (tempString in noDirectoryArray) {
if (tempString.search(wavPattern) != -1){
tempString = tempString.replace(wavPattern, ".mp3");
sound = _soundLibrary.getSound(tempString);
if (loop){
stopAllSound();
loopTimes = 100000;
};
sound.play(0, loopTimes, null);
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function stopAllSound():void{
SoundMixer.stopAll();
}
private function onComplete(_arg1:Event):void{
_soundLibrary = (_swfLoader.contentLoaderInfo.content as ISoundLibrary);
dispatchEvent(_arg1);
}
public static function getInstance():SoundManager{
if (_instance == null){
_instance = new (SoundManager);
};
return (_instance);
}
}
}//package controller.sound
Section 15
//Action (controller.Action)
package controller {
import model.*;
import view.debug.*;
public class Action {
private const _spacePattern:RegExp;
private const _setGlobalPattern:RegExp;
private const _locationOffsetPattern:RegExp;
private const _dialoguePattern:RegExp;
private const _locationPattern:RegExp;
private var _actionsArray:Array;
public function Action(_arg1:String){
var _local2:ActionParser;
_dialoguePattern = /loaddialogue/;
_locationPattern = /loadlocation/;
_setGlobalPattern = /setglobal/;
_spacePattern = /\s/g;
_locationOffsetPattern = /locationoffset/;
super();
_local2 = new ActionParser(_arg1);
_actionsArray = _local2.actionsArray;
}
public function actionsForClicked(_arg1:String):Array{
var actionsToPerform:Array;
var locationData:LocationData;
var actionArray:Array;
var clicked:String;
var tempArray:Array;
var i:int;
var action:String;
var dialogueData:DialogueData;
var clickedString = _arg1;
actionsToPerform = new Array();
try {
for each (actionArray in _actionsArray) {
clicked = actionArray[0];
if (clicked.search(clickedString) != -1){
tempArray = new Array();
i = 1;
while (i < actionArray.length) {
action = actionArray[i];
if (action.search(_dialoguePattern) != -1){
tempArray = action.split(_spacePattern);
dialogueData = new DialogueData(tempArray[1]);
actionsToPerform.push(dialogueData);
} else {
if (action.search(_locationPattern) != -1){
tempArray = action.split(_spacePattern);
if (tempArray[1] != undefined){
locationData = new LocationData(tempArray[1], 0, 0);
actionsToPerform.push(locationData);
} else {
throw (new Error("location has no specified path"));
};
} else {
if (action.search(_locationOffsetPattern) != -1){
tempArray = action.split(_spacePattern);
if (locationData != null){
if (((!((tempArray[1] == undefined))) && (!((tempArray[2] == undefined))))){
locationData.xOffset = tempArray[1];
locationData.yOffset = tempArray[2];
} else {
throw (new Error("location offset was not defined"));
};
};
} else {
if (action.search(_setGlobalPattern) != -1){
tempArray = action.split(_spacePattern);
if (((!((tempArray[1] == undefined))) && (!((tempArray[2] == undefined))))){
WorldState.getInstance().addKeyValue(tempArray[1], tempArray[2]);
} else {
throw (new Error("key value pair did not exist"));
};
};
};
};
};
i = (i + 1);
};
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
return (actionsToPerform);
}
}
}//package controller
Section 16
//Camera (controller.Camera)
package controller {
import flash.events.*;
import flash.display.*;
import view.debug.*;
import customEvents.*;
import tweens.*;
public class Camera extends EventDispatcher {
private var _mode:CameraMode;
private var _panTween:AbstractTween;
private var _x:Number;// = 0
private var _y:Number;// = 0
public static const PANCOMPLETE:String = "PANCOMPLETE";
public function Camera(){
_x = 0;
_y = 0;
_mode = CameraMode.FREE;
super();
}
public function get y():Number{
return (_y);
}
public function panToPosition(_arg1:Number, _arg2:Number):void{
var xPos = _arg1;
var yPos = _arg2;
try {
_panTween = new PanToPositionTween(this, xPos, yPos);
_panTween.addEventListener(PanTween.PANCOMPLETE, onPanToPositionComplete, false, 0, false);
_panTween.start();
_mode = CameraMode.PANNINGTOPOSITION;
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function jumpToPosition(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
private function onPanToPositionComplete(_arg1:Event):void{
dispatchEvent(new CameraPanEvent(CameraPanEvent.PANTOPOSITION));
_mode = CameraMode.FREE;
}
public function panToObject(_arg1:DisplayObject):void{
var panObject = _arg1;
try {
_panTween = new PanTween(this, panObject);
_panTween.addEventListener(PanTween.PANCOMPLETE, onPanToObjectComplete, false, 0, false);
_panTween.start();
_mode = CameraMode.PANNINGTOOBJECT;
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function set y(_arg1:Number):void{
_y = _arg1;
}
private function onPanToObjectComplete(_arg1:Event):void{
dispatchEvent(new CameraPanEvent(CameraPanEvent.PANTOOBJECT));
_mode = CameraMode.FREE;
}
public function get mode():CameraMode{
return (_mode);
}
public function set x(_arg1:Number):void{
_x = _arg1;
}
public function get x():Number{
return (_x);
}
}
}//package controller
Section 17
//CameraMode (controller.CameraMode)
package controller {
public class CameraMode {
private var _mode:String;
public static var PANNINGTOPOSITION:CameraMode = new CameraMode("PANNINGTOPOSITION");
;
public static var PANNINGTOOBJECT:CameraMode = new CameraMode("PANNINGTOOBJECT");
;
public static var FREE:CameraMode = new CameraMode("FREE");
;
public function CameraMode(_arg1:String){
_mode = _arg1;
}
public function get mode():String{
return (_mode);
}
}
}//package controller
Section 18
//Dialogue (controller.Dialogue)
package controller {
import flash.events.*;
import model.*;
import view.debug.*;
import minigames.*;
public class Dialogue extends EventDispatcher {
private var _mode:DialogueMode;
private var _langParser:LangParser;
private var _game:Game;
private var _currentSlide:DialogueSlide;
private var _dialogueXML:XML;
private var _nextSlideId:int;
private static const DIALOGUEPATTERN:RegExp = /.dia\Z/g;
public function Dialogue(_arg1:DialogueData, _arg2:Game){
var languagePath:String;
var startSlide:XML;
var dialogueData = _arg1;
var game = _arg2;
_mode = DialogueMode.FIRSTSLIDE;
super();
try {
_game = game;
_dialogueXML = ContentManager.getInstance().getXML(dialogueData.path);
languagePath = dialogueData.path.replace(DIALOGUEPATTERN, ".lang");
_langParser = new LangParser(languagePath);
startSlide = XML(_dialogueXML.DialogueSlide.(@type == "start"));
_nextSlideId = startSlide.@id;
playSlide();
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function getTextWithId(_arg1:String):String{
var _local2:String;
_local2 = _langParser.getText(_arg1);
return (_local2);
}
public function lastSlide():void{
_mode = DialogueMode.FINISHED;
}
public function endDialogue():void{
_mode = DialogueMode.FINISHED;
_game.removeCurrentDialogue();
}
public function playSlide():void{
var dialogueXML:XML;
var dialogueSlide:DialogueSlide;
try {
if ((((_mode == DialogueMode.PLAYING)) || ((_mode == DialogueMode.FIRSTSLIDE)))){
if (_nextSlideId == MiniGameController.CARCHASESLIDEID){
loadMiniGame(MiniGameController.CARCHASE);
} else {
if ((((_currentSlide == null)) || (_currentSlide.finished()))){
dialogueXML = getNextSlideXML(_nextSlideId);
dialogueSlide = new DialogueSlide(dialogueXML, _nextSlideId, this);
_currentSlide = dialogueSlide;
};
_currentSlide.play();
if (_mode == DialogueMode.SHOWCHOICE){
_mode = DialogueMode.INCHOICE;
_currentSlide.showChoice();
};
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function get mode():DialogueMode{
return (_mode);
}
public function playNextSlideOnClick(_arg1:MouseEvent):void{
var event = _arg1;
try {
if ((((_mode == DialogueMode.PLAYING)) || ((_mode == DialogueMode.FIRSTSLIDE)))){
playSlide();
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function newDialogue(_arg1:DialogueData):void{
_mode = DialogueMode.FINISHED;
_game.playDialogue(_arg1);
}
public function endGame():void{
endDialogue();
_game.endGame();
}
public function loadMiniGame(_arg1:String):void{
endDialogue();
_game.loadMiniGame(_arg1);
}
public function panLocation(_arg1:Number, _arg2:Number):void{
_game.panLocationToPosition(_arg1, _arg2);
}
public function newLocation(_arg1:LocationData):void{
_mode = DialogueMode.FINISHED;
_game.changeLocation(_arg1);
}
private function getNextSlideXML(_arg1:int):XML{
var slideXML:XML;
var slideID = _arg1;
slideXML = XML(_dialogueXML.DialogueSlide.(@id == slideID));
return (slideXML);
}
public function setNextSlideId(_arg1:int):void{
var nextSlideId = _arg1;
try {
_nextSlideId = nextSlideId;
_mode = DialogueMode.PLAYING;
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function onChoice():void{
_mode = DialogueMode.SHOWCHOICE;
}
}
}//package controller
Section 19
//DialogueMode (controller.DialogueMode)
package controller {
public class DialogueMode {
private var _mode:String;
public static var FIRSTSLIDE:DialogueMode = new DialogueMode("FIRSTSLIDE");
;
public static var SHOWCHOICE:DialogueMode = new DialogueMode("CHOICE");
;
public static var INCHOICE:DialogueMode = new DialogueMode("CHOICE");
;
public static var FINISHED:DialogueMode = new DialogueMode("FINISHED");
;
public static var PLAYING:DialogueMode = new DialogueMode("PLAYING");
;
public function DialogueMode(_arg1:String){
_mode = _arg1;
}
public function get mode():String{
return (_mode);
}
}
}//package controller
Section 20
//Game (controller.Game)
package controller {
import flash.events.*;
import flash.display.*;
import model.*;
import view.*;
import view.debug.*;
import customEvents.*;
import minigames.*;
public class Game extends EventDispatcher {
private var _miniGameController:MiniGameController;
private var _clickedSelectBoxName:String;
private var _locationParser:LocationParser;
private var _action:Action;
private var _main:Main;
private var _currentDialogue:Dialogue;
public static var gameScale:Number = 2;
public static var mode:GameMode = GameMode.PAN;
public function Game(_arg1:Main){
_main = _arg1;
_main.addChild(MainView.getInstance());
init();
}
private function onWorldStateValueChange(_arg1:NewWorldStateEvent):void{
var event = _arg1;
try {
if (_locationParser.location != null){
_locationParser.updateLocation(event);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function changeLocation(_arg1:LocationData):void{
var csdPattern:RegExp;
var location:Location;
var camera:Camera;
var actionPath:String;
var locationData = _arg1;
try {
if (_currentDialogue != null){
removeCurrentDialogue();
};
csdPattern = /csd/;
_locationParser.createLocation(locationData);
location = _locationParser.location;
camera = location.camera;
camera.addEventListener(CameraPanEvent.PANTOOBJECT, onPanComplete, false, 0, true);
camera.addEventListener(CameraPanEvent.PANTOPOSITION, onPanComplete, false, 0, true);
actionPath = locationData.path.replace(csdPattern, "action");
_action = new Action(actionPath);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function playDialogue(_arg1:DialogueData):void{
var dialogue:Dialogue;
var dialogueData = _arg1;
try {
mode = GameMode.DIALOGUE;
KongregateExtras.isAttentive(dialogueData.path);
dialogue = new Dialogue(dialogueData, this);
if (_currentDialogue != null){
_main.removeEventListener(MouseEvent.MOUSE_DOWN, _currentDialogue.playNextSlideOnClick);
};
_currentDialogue = dialogue;
Main.mainMovie.addEventListener(MouseEvent.MOUSE_DOWN, _currentDialogue.playNextSlideOnClick, true, 0, true);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function init():void{
var dialogueData:DialogueData;
try {
_locationParser = new LocationParser(this);
WorldState.getInstance().addEventListener(NewWorldStateEvent.NEWWORLDSTATEEVENT, onWorldStateValueChange, false, 1, true);
dialogueData = new DialogueData("ch1/dialogues/chapter1_intro_first_part.dia");
playDialogue(dialogueData);
} catch(e:Error) {
};
}
public function panLocationToPosition(_arg1:Number, _arg2:Number):void{
var xPos = _arg1;
var yPos = _arg2;
try {
if (_locationParser.location != null){
_locationParser.location.camera.panToPosition(xPos, yPos);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function onPanComplete(_arg1:CameraPanEvent):void{
if (_arg1.type == CameraPanEvent.PANTOOBJECT){
performActions(_clickedSelectBoxName);
} else {
if (_arg1.type == CameraPanEvent.PANTOPOSITION){
};
};
}
public function onMiniGameOver(_arg1:String):void{
MainView.getInstance().removeCurrentMiniGame();
performActions(_arg1);
}
public function performActions(_arg1:String):void{
var _local2:Array;
var _local3:Object;
var _local4:LocationData;
var _local5:DialogueData;
_local2 = _action.actionsForClicked(_arg1);
for each (_local3 in _local2) {
if ((_local3 is LocationData)){
_local4 = (_local3 as LocationData);
changeLocation(_local4);
} else {
if ((_local3 is DialogueData)){
_local5 = (_local3 as DialogueData);
playDialogue(_local5);
};
};
};
}
public function removeCurrentDialogue():void{
try {
mode = GameMode.PAN;
MainView.getInstance().removeDialogue();
if (_currentDialogue != null){
_main.removeEventListener(MouseEvent.CLICK, _currentDialogue.playNextSlideOnClick);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function onSelectBoxClick(_arg1:String, _arg2:DisplayObject):void{
var activatorName = _arg1;
var activator = _arg2;
try {
if (mode == GameMode.PAN){
mode = GameMode.PANNING;
if (_locationParser.location != null){
_clickedSelectBoxName = activatorName;
_locationParser.location.camera.panToObject(activator);
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function endGame():void{
_main.endGame();
}
public function loadMiniGame(_arg1:String):void{
if (_miniGameController == null){
_miniGameController = new MiniGameController(this);
};
_miniGameController.playMiniGame(_arg1);
_action = new Action(_miniGameController.getAction());
}
}
}//package controller
Section 21
//GameMode (controller.GameMode)
package controller {
public class GameMode {
private var mode:String;
public static var PANNING:GameMode = new GameMode("PANNING");
;
public static var DIALOGUE:GameMode = new GameMode("DIALOGUE");
;
public static var PAN:GameMode = new GameMode("PAN");
;
public function GameMode(_arg1:String){
this.mode = _arg1;
}
}
}//package controller
Section 22
//CameraPanEvent (customEvents.CameraPanEvent)
package customEvents {
import flash.events.*;
public class CameraPanEvent extends Event {
public static const PANTOPOSITION:String = "PANTOPOSITION";
public static const PANTOOBJECT:String = "PANTOOBJECT";
public function CameraPanEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package customEvents
Section 23
//ChoiceEvent (customEvents.ChoiceEvent)
package customEvents {
import flash.events.*;
import model.*;
public class ChoiceEvent extends Event {
private var _choiceData:ChoiceData;
public static const CHOICE:String = "CHOICE";
public function ChoiceEvent(_arg1:ChoiceData, _arg2:String, _arg3:Boolean=false, _arg4:Boolean=false){
_choiceData = _arg1;
super(_arg2, _arg3, _arg4);
}
public function get choiceData():ChoiceData{
return (_choiceData);
}
}
}//package customEvents
Section 24
//GameOverEvent (customEvents.GameOverEvent)
package customEvents {
import flash.events.*;
public class GameOverEvent extends Event {
private var _clickedSelectBox:String;
public static const GAMEOVER:String = "GAMEOVER";
public function GameOverEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=""){
_clickedSelectBox = _arg4;
super(_arg1, _arg2, _arg3);
}
public function get clickedSelectBox():String{
return (_clickedSelectBox);
}
}
}//package customEvents
Section 25
//NewWorldStateEvent (customEvents.NewWorldStateEvent)
package customEvents {
import flash.events.*;
public class NewWorldStateEvent extends Event {
private var _key:String;
private var _value:String;
private var _previousValue:String;
public static const NEWWORLDSTATEEVENT:String = "NEWWORLDSTATEEVENT";
public function NewWorldStateEvent(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Boolean=false, _arg6:Boolean=false){
_key = _arg1;
_value = _arg2;
_previousValue = _arg3;
super(_arg4, _arg5, _arg6);
}
public function get previousValue():String{
return (_previousValue);
}
public function get key():String{
return (_key);
}
public function get value():String{
return (_value);
}
}
}//package customEvents
Section 26
//FZip (deng.fzip.FZip)
package deng.fzip {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class FZip extends EventDispatcher {
private var charEncoding:String;
private var filesDict:Dictionary;
private var currentFile:FZipFile;
private var urlStream:URLStream;
private var parseFunc:Function;
private var filesList:Array;
public function FZip(_arg1:String="utf-8"){
charEncoding = _arg1;
parseFunc = parseIdle;
}
protected function parse(_arg1:IDataInput):Boolean{
do {
} while (parseFunc(_arg1));
return ((parseFunc === parseIdle));
}
private function parseLocalfile(_arg1:IDataInput):Boolean{
if (currentFile.parse(_arg1)){
filesList.push(currentFile);
if (currentFile.filename.toLowerCase()){
filesDict[currentFile.filename.toLowerCase()] = currentFile;
};
dispatchEvent(new FZipEvent(FZipEvent.FILE_LOADED, currentFile));
currentFile = null;
if (parseFunc != parseIdle){
parseFunc = parseSignature;
return (true);
};
};
return (false);
}
public function getFileCount():uint{
return ((filesList) ? filesList.length : 0);
}
public function getFileAt(_arg1:uint):FZipFile{
return ((filesList) ? (filesList[_arg1] as FZipFile) : null);
}
public function addFileFromStringAt(_arg1:uint, _arg2:String, _arg3:String, _arg4:String="utf-8"):FZipFile{
var _local5:FZipFile;
if (filesList == null){
filesList = [];
};
if (filesDict == null){
filesDict = new Dictionary();
} else {
if (filesDict[_arg2]){
throw (new Error((("File already exists: " + _arg2) + ". Please remove first.")));
};
};
_local5 = new FZipFile();
_local5.filename = _arg2;
_local5.setContentAsString(_arg3, _arg4);
if (_arg1 >= filesList.length){
filesList.push(_local5);
} else {
filesList.splice(_arg1, 0, _local5);
};
filesDict[_arg2] = _local5;
return (_local5);
}
public function addFile(_arg1:String, _arg2:ByteArray=null):FZipFile{
return (addFileAt((filesList) ? filesList.length : 0, _arg1, _arg2));
}
protected function removeEventHandlers():void{
urlStream.removeEventListener(Event.COMPLETE, defaultHandler);
urlStream.removeEventListener(Event.OPEN, defaultHandler);
urlStream.removeEventListener(HTTPStatusEvent.HTTP_STATUS, defaultHandler);
urlStream.removeEventListener(IOErrorEvent.IO_ERROR, defaultErrorHandler);
urlStream.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, defaultErrorHandler);
urlStream.removeEventListener(ProgressEvent.PROGRESS, progressHandler);
}
public function addFileAt(_arg1:uint, _arg2:String, _arg3:ByteArray=null):FZipFile{
var _local4:FZipFile;
if (filesList == null){
filesList = [];
};
if (filesDict == null){
filesDict = new Dictionary();
} else {
if (filesDict[_arg2]){
throw (new Error((("File already exists: " + _arg2) + ". Please remove first.")));
};
};
_local4 = new FZipFile();
_local4.filename = _arg2;
_local4.content = _arg3;
if (_arg1 >= filesList.length){
filesList.push(_local4);
} else {
filesList.splice(_arg1, 0, _local4);
};
filesDict[_arg2] = _local4;
return (_local4);
}
public function getFileByName(_arg1:String):FZipFile{
var _local2:String;
_local2 = _arg1.toLowerCase();
return ((filesDict[_local2]) ? (filesDict[_local2] as FZipFile) : null);
}
private function parseSignature(_arg1:IDataInput):Boolean{
var _local2:uint;
if (_arg1.bytesAvailable >= 4){
_local2 = _arg1.readUnsignedInt();
switch (_local2){
case 67324752:
parseFunc = parseLocalfile;
currentFile = new FZipFile(charEncoding);
break;
case 33639248:
case 101010256:
parseFunc = parseIdle;
break;
default:
throw (new Error("Unknown record signature."));
};
return (true);
};
return (false);
}
public function serialize(_arg1:IDataOutput, _arg2:Boolean=false):void{
var _local3:String;
var _local4:ByteArray;
var _local5:uint;
var _local6:uint;
var _local7:int;
var _local8:FZipFile;
if (((!((_arg1 == null))) && ((filesList.length > 0)))){
_local3 = _arg1.endian;
_local4 = new ByteArray();
_arg1.endian = (_local4.endian = Endian.LITTLE_ENDIAN);
_local5 = 0;
_local6 = 0;
_local7 = 0;
while (_local7 < filesList.length) {
_local8 = (filesList[_local7] as FZipFile);
if (_local8 != null){
_local8.serialize(_local4, _arg2, true, _local5);
_local5 = (_local5 + _local8.serialize(_arg1, _arg2));
_local6++;
};
_local7++;
};
if (_local4.length > 0){
_arg1.writeBytes(_local4);
};
_arg1.writeUnsignedInt(101010256);
_arg1.writeShort(0);
_arg1.writeShort(0);
_arg1.writeShort(_local6);
_arg1.writeShort(_local6);
_arg1.writeUnsignedInt(_local4.length);
_arg1.writeUnsignedInt(_local5);
_arg1.writeShort(0);
_arg1.endian = _local3;
};
}
protected function defaultHandler(_arg1:Event):void{
dispatchEvent(_arg1.clone());
}
protected function progressHandler(_arg1:Event):void{
var evt = _arg1;
dispatchEvent(evt.clone());
try {
if (parse(urlStream)){
close();
dispatchEvent(new Event(Event.COMPLETE));
};
} catch(e:Error) {
close();
if (hasEventListener(FZipErrorEvent.PARSE_ERROR)){
dispatchEvent(new FZipErrorEvent(FZipErrorEvent.PARSE_ERROR, e.message));
} else {
throw (e);
};
};
}
public function load(_arg1:URLRequest):void{
if (((!(urlStream)) && ((parseFunc == parseIdle)))){
urlStream = new URLStream();
urlStream.endian = Endian.LITTLE_ENDIAN;
addEventHandlers();
filesList = [];
filesDict = new Dictionary();
parseFunc = parseSignature;
urlStream.load(_arg1);
};
}
private function parseIdle(_arg1:IDataInput):Boolean{
return (false);
}
public function get active():Boolean{
return (!((parseFunc === parseIdle)));
}
protected function addEventHandlers():void{
urlStream.addEventListener(Event.COMPLETE, defaultHandler);
urlStream.addEventListener(Event.OPEN, defaultHandler);
urlStream.addEventListener(HTTPStatusEvent.HTTP_STATUS, defaultHandler);
urlStream.addEventListener(IOErrorEvent.IO_ERROR, defaultErrorHandler);
urlStream.addEventListener(SecurityErrorEvent.SECURITY_ERROR, defaultErrorHandler);
urlStream.addEventListener(ProgressEvent.PROGRESS, progressHandler);
}
protected function defaultErrorHandler(_arg1:Event):void{
close();
dispatchEvent(_arg1.clone());
}
public function close():void{
if (urlStream){
parseFunc = parseIdle;
removeEventHandlers();
urlStream.close();
urlStream = null;
};
}
public function removeFileAt(_arg1:uint):FZipFile{
var _local2:FZipFile;
if (((((!((filesList == null))) && (!((filesDict == null))))) && ((_arg1 < filesList.length)))){
_local2 = (filesList[_arg1] as FZipFile);
if (_local2 != null){
filesList.splice(_arg1, 1);
delete filesDict[_local2.filename];
return (_local2);
};
};
return (null);
}
public function loadBytes(_arg1:ByteArray):void{
if (((!(urlStream)) && ((parseFunc == parseIdle)))){
filesList = [];
filesDict = new Dictionary();
_arg1.position = 0;
_arg1.endian = Endian.LITTLE_ENDIAN;
parseFunc = parseSignature;
if (parse(_arg1)){
parseFunc = parseIdle;
dispatchEvent(new Event(Event.COMPLETE));
} else {
dispatchEvent(new FZipErrorEvent(FZipErrorEvent.PARSE_ERROR, "EOF"));
};
};
}
public function addFileFromString(_arg1:String, _arg2:String, _arg3:String="utf-8"):FZipFile{
return (addFileFromStringAt((filesList) ? filesList.length : 0, _arg1, _arg2, _arg3));
}
}
}//package deng.fzip
Section 27
//FZipErrorEvent (deng.fzip.FZipErrorEvent)
package deng.fzip {
import flash.events.*;
public class FZipErrorEvent extends Event {
public var text:String;
public static const PARSE_ERROR:String = "parseError";
public function FZipErrorEvent(_arg1:String, _arg2:String="", _arg3:Boolean=false, _arg4:Boolean=false){
this.text = _arg2;
super(_arg1, _arg3, _arg4);
}
override public function clone():Event{
return (new FZipErrorEvent(type, text, bubbles, cancelable));
}
}
}//package deng.fzip
Section 28
//FZipEvent (deng.fzip.FZipEvent)
package deng.fzip {
import flash.events.*;
public class FZipEvent extends Event {
public var file:FZipFile;
public static const FILE_LOADED:String = "fileLoaded";
public function FZipEvent(_arg1:String, _arg2:FZipFile=null, _arg3:Boolean=false, _arg4:Boolean=false){
this.file = _arg2;
super(_arg1, _arg3, _arg4);
}
override public function clone():Event{
return (new FZipEvent(type, file, bubbles, cancelable));
}
}
}//package deng.fzip
Section 29
//FZipFile (deng.fzip.FZipFile)
package deng.fzip {
import flash.utils.*;
import deng.utils.*;
public class FZipFile {
private var _sizeCompressed:uint;// = 0
private var _date:Date;
private var _sizeFilename:uint;// = 0
private var _deflateSpeedOption:int;// = -1
private var parseFunc:Function;
private var _implodeShannonFanoTrees:int;// = -1
private var _hasAdler32:Boolean;// = false
private var _extraFields:Dictionary;
private var _comment:String;// = ""
private var _adler32:uint;
private var _content:ByteArray;
private var _sizeExtra:uint;// = 0
private var _crc32:uint;
private var _encrypted:Boolean;// = false
private var _implodeDictSize:int;// = -1
private var _versionNumber:String;// = "2.0"
private var isCompressed:Boolean;// = false
private var _hasCompressedPatchedData:Boolean;// = false
private var _filenameEncoding:String;
private var _sizeUncompressed:uint;// = 0
private var _versionHost:int;// = 0
private var _filename:String;// = ""
private var _compressionMethod:int;// = 8
private var _hasDataDescriptor:Boolean;// = false
public static const COMPRESSION_DEFLATED:int = 8;
public static const COMPRESSION_IMPLODED_PKWARE:int = 10;
public static const COMPRESSION_IMPLODED:int = 6;
public static const COMPRESSION_NONE:int = 0;
public static const COMPRESSION_SHRUNK:int = 1;
public static const COMPRESSION_REDUCED_1:int = 2;
public static const COMPRESSION_REDUCED_2:int = 3;
public static const COMPRESSION_REDUCED_3:int = 4;
public static const COMPRESSION_REDUCED_4:int = 5;
public static const COMPRESSION_DEFLATED_EXT:int = 9;
public static const COMPRESSION_TOKENIZED:int = 7;
private static var HAS_INFLATE:Boolean = describeType(ByteArray).factory.method.(@name == "uncompress").hasComplexContent();
public function FZipFile(_arg1:String="utf-8"){
_versionHost = 0;
_versionNumber = "2.0";
_compressionMethod = 8;
_encrypted = false;
_implodeDictSize = -1;
_implodeShannonFanoTrees = -1;
_deflateSpeedOption = -1;
_hasDataDescriptor = false;
_hasCompressedPatchedData = false;
_hasAdler32 = false;
_sizeCompressed = 0;
_sizeUncompressed = 0;
_sizeFilename = 0;
_sizeExtra = 0;
_filename = "";
_comment = "";
isCompressed = false;
parseFunc = parseFileHead;
super();
_filenameEncoding = _arg1;
_extraFields = new Dictionary();
_content = new ByteArray();
_content.endian = Endian.BIG_ENDIAN;
}
public function get sizeUncompressed():uint{
return (_sizeUncompressed);
}
public function set filename(_arg1:String):void{
_filename = _arg1;
}
function parse(_arg1:IDataInput):Boolean{
do {
} while (((_arg1.bytesAvailable) && (parseFunc(_arg1))));
return ((parseFunc === parseFileIdle));
}
public function get filename():String{
return (_filename);
}
public function get date():Date{
return (_date);
}
protected function parseHead(_arg1:IDataInput):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
_local2 = _arg1.readUnsignedShort();
_versionHost = (_local2 >> 8);
_versionNumber = ((Math.floor(((_local2 & 0xFF) / 10)) + ".") + ((_local2 & 0xFF) % 10));
_local3 = _arg1.readUnsignedShort();
_compressionMethod = _arg1.readUnsignedShort();
_encrypted = !(((_local3 & 1) === 0));
_hasDataDescriptor = !(((_local3 & 8) === 0));
_hasCompressedPatchedData = !(((_local3 & 32) === 0));
if ((_local3 & 800) !== 0){
_filenameEncoding = "utf-8";
};
if (_compressionMethod === COMPRESSION_IMPLODED){
_implodeDictSize = (((_local3 & 2))!==0) ? 0x2000 : 0x1000;
_implodeShannonFanoTrees = (((_local3 & 4))!==0) ? 3 : 2;
} else {
if (_compressionMethod === COMPRESSION_DEFLATED){
_deflateSpeedOption = ((_local3 & 6) >> 1);
};
};
_local4 = _arg1.readUnsignedShort();
_local5 = _arg1.readUnsignedShort();
_local6 = (_local4 & 31);
_local7 = ((_local4 & 2016) >> 5);
_local8 = ((_local4 & 0xF800) >> 11);
_local9 = (_local5 & 31);
_local10 = ((_local5 & 480) >> 5);
_local11 = (((_local5 & 0xFE00) >> 9) + 1980);
_date = new Date(_local11, (_local10 - 1), _local9, _local8, _local7, _local6, 0);
_crc32 = _arg1.readUnsignedInt();
_sizeCompressed = _arg1.readUnsignedInt();
_sizeUncompressed = _arg1.readUnsignedInt();
_sizeFilename = _arg1.readUnsignedShort();
_sizeExtra = _arg1.readUnsignedShort();
}
private function parseFileContent(_arg1:IDataInput):Boolean{
if (_hasDataDescriptor){
parseFunc = parseFileIdle;
throw (new Error("Data descriptors are not supported."));
};
if (_sizeCompressed == 0){
parseFunc = parseFileIdle;
} else {
if (_arg1.bytesAvailable >= _sizeCompressed){
parseContent(_arg1);
parseFunc = parseFileIdle;
} else {
return (false);
};
};
return (true);
}
public function get versionNumber():String{
return (_versionNumber);
}
public function getContentAsString(_arg1:Boolean=true, _arg2:String="utf-8"):String{
var _local3:String;
if (isCompressed){
uncompress();
};
_content.position = 0;
if (_arg2 == "utf-8"){
_local3 = _content.readUTFBytes(_content.bytesAvailable);
} else {
_local3 = _content.readMultiByte(_content.bytesAvailable, _arg2);
};
_content.position = 0;
if (_arg1){
compress();
};
return (_local3);
}
private function parseFileIdle(_arg1:IDataInput):Boolean{
return (false);
}
protected function parseContent(_arg1:IDataInput):void{
var _local2:uint;
if ((((_compressionMethod === COMPRESSION_DEFLATED)) && (!(_encrypted)))){
if (HAS_INFLATE){
_arg1.readBytes(_content, 0, _sizeCompressed);
} else {
if (_hasAdler32){
_content.writeByte(120);
_local2 = ((~(_deflateSpeedOption) << 6) & 192);
_local2 = (_local2 + (31 - (((120 << 8) | _local2) % 31)));
_content.writeByte(_local2);
_arg1.readBytes(_content, 2, _sizeCompressed);
_content.position = _content.length;
_content.writeUnsignedInt(_adler32);
} else {
throw (new Error("Adler32 checksum not found."));
};
};
isCompressed = true;
} else {
if (_compressionMethod == COMPRESSION_NONE){
_arg1.readBytes(_content, 0, _sizeCompressed);
isCompressed = false;
} else {
throw (new Error((("Compression method " + _compressionMethod) + " is not supported.")));
};
};
_content.position = 0;
}
private function parseFileHead(_arg1:IDataInput):Boolean{
if (_arg1.bytesAvailable >= 30){
parseHead(_arg1);
if ((_sizeFilename + _sizeExtra) > 0){
parseFunc = parseFileHeadExt;
} else {
parseFunc = parseFileContent;
};
return (true);
};
return (false);
}
public function setContentAsString(_arg1:String, _arg2:String="utf-8"):void{
_content.length = 0;
_content.position = 0;
isCompressed = false;
if (((!((_arg1 == null))) && ((_arg1.length > 0)))){
if (_arg2 == "utf-8"){
_content.writeUTFBytes(_arg1);
} else {
_content.writeMultiByte(_arg1, _arg2);
};
_crc32 = ChecksumUtil.CRC32(_content);
_hasAdler32 = false;
};
compress();
}
public function set date(_arg1:Date):void{
_date = ((_arg1)!=null) ? _arg1 : new Date();
}
protected function uncompress():void{
if (((isCompressed) && ((_content.length > 0)))){
_content.position = 0;
if (HAS_INFLATE){
_content.uncompress.apply(_content, ["deflate"]);
} else {
_content.uncompress();
};
_content.position = 0;
isCompressed = false;
};
}
public function serialize(_arg1:IDataOutput, _arg2:Boolean, _arg3:Boolean=false, _arg4:uint=0):uint{
var _local5:Date;
var _local6:uint;
var _local7:uint;
var _local8:ByteArray;
var _local9:uint;
var _local10:Object;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:ByteArray;
var _local16:Boolean;
if (_arg1 == null){
return (0);
};
if (_arg3){
_arg1.writeUnsignedInt(33639248);
_arg1.writeShort(((_versionHost << 8) | 20));
} else {
_arg1.writeUnsignedInt(67324752);
};
_arg1.writeShort(((_versionHost << 8) | 20));
_arg1.writeShort(((_filenameEncoding)=="utf-8") ? 0x0800 : 0);
_arg1.writeShort(COMPRESSION_DEFLATED);
_local5 = ((_date)!=null) ? _date : new Date();
_local6 = ((uint(_local5.getSeconds()) | (uint(_local5.getMinutes()) << 5)) | (uint(_local5.getHours()) << 11));
_local7 = ((uint(_local5.getDate()) | (uint((_local5.getMonth() + 1)) << 5)) | (uint((_local5.getFullYear() - 1980)) << 9));
_arg1.writeShort(_local6);
_arg1.writeShort(_local7);
_arg1.writeUnsignedInt(_crc32);
_arg1.writeUnsignedInt(_sizeCompressed);
_arg1.writeUnsignedInt(_sizeUncompressed);
_local8 = new ByteArray();
_local8.endian = Endian.LITTLE_ENDIAN;
if (_filenameEncoding == "utf-8"){
_local8.writeUTFBytes(_filename);
} else {
_local8.writeMultiByte(_filename, _filenameEncoding);
};
_local9 = _local8.position;
for (_local10 in _extraFields) {
_local15 = (_extraFields[_local10] as ByteArray);
if (_local15 != null){
_local8.writeShort(uint(_local10));
_local8.writeShort(uint(_local15.length));
_local8.writeBytes(_local15);
};
};
if (_arg2){
if (!_hasAdler32){
_local16 = isCompressed;
if (_local16){
uncompress();
};
_adler32 = ChecksumUtil.Adler32(_content, 0, _content.length);
_hasAdler32 = true;
if (_local16){
compress();
};
};
_local8.writeShort(0xDADA);
_local8.writeShort(4);
_local8.writeUnsignedInt(_adler32);
};
_local11 = (_local8.position - _local9);
if (((_arg3) && ((_comment.length > 0)))){
if (_filenameEncoding == "utf-8"){
_local8.writeUTFBytes(_comment);
} else {
_local8.writeMultiByte(_comment, _filenameEncoding);
};
};
_local12 = ((_local8.position - _local9) - _local11);
_arg1.writeShort(_local9);
_arg1.writeShort(_local11);
if (_arg3){
_arg1.writeShort(_local12);
_arg1.writeShort(0);
_arg1.writeShort(0);
_arg1.writeUnsignedInt(0);
_arg1.writeUnsignedInt(_arg4);
};
if (((_local9 + _local11) + _local12) > 0){
_arg1.writeBytes(_local8);
};
_local13 = 0;
if (((!(_arg3)) && ((_sizeCompressed > 0)))){
if (HAS_INFLATE){
_local13 = _content.length;
_arg1.writeBytes(_content, 0, _local13);
} else {
_local13 = (_content.length - 6);
_arg1.writeBytes(_content, 2, _local13);
};
};
_local14 = ((((30 + _local9) + _local11) + _local12) + _local13);
if (_arg3){
_local14 = (_local14 + 16);
};
return (_local14);
}
public function get sizeCompressed():uint{
return (_sizeCompressed);
}
protected function compress():void{
if (!isCompressed){
if (_content.length > 0){
_content.position = 0;
_sizeUncompressed = _content.length;
if (HAS_INFLATE){
_content.compress.apply(_content, ["deflate"]);
_sizeCompressed = _content.length;
} else {
_content.compress();
_sizeCompressed = (_content.length - 6);
};
_content.position = 0;
isCompressed = true;
} else {
_sizeCompressed = 0;
_sizeUncompressed = 0;
};
};
}
private function parseFileHeadExt(_arg1:IDataInput):Boolean{
if (_arg1.bytesAvailable >= (_sizeFilename + _sizeExtra)){
parseHeadExt(_arg1);
parseFunc = parseFileContent;
return (true);
};
return (false);
}
protected function parseHeadExt(_arg1:IDataInput):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:ByteArray;
if (_filenameEncoding == "utf-8"){
_filename = _arg1.readUTFBytes(_sizeFilename);
} else {
_filename = _arg1.readMultiByte(_sizeFilename, _filenameEncoding);
};
_local2 = _sizeExtra;
while (_local2 > 4) {
_local3 = _arg1.readUnsignedShort();
_local4 = _arg1.readUnsignedShort();
if (_local4 > _local2){
throw (new Error((("Parse error in file " + _filename) + ": Extra field data size too big.")));
};
if ((((_local3 === 0xDADA)) && ((_local4 === 4)))){
_adler32 = _arg1.readUnsignedInt();
_hasAdler32 = true;
} else {
if (_local4 > 0){
_local5 = new ByteArray();
_arg1.readBytes(_local5, 0, _local4);
_extraFields[_local3] = _local5;
};
};
_local2 = (_local2 - (_local4 + 4));
};
if (_local2 > 0){
_arg1.readBytes(new ByteArray(), 0, _local2);
};
}
public function set content(_arg1:ByteArray):void{
if (((!((_arg1 == null))) && ((_arg1.length > 0)))){
_arg1.position = 0;
_arg1.readBytes(_content, 0, _arg1.length);
_crc32 = ChecksumUtil.CRC32(_content);
_hasAdler32 = false;
} else {
_content.length = 0;
_content.position = 0;
isCompressed = false;
};
compress();
}
public function toString():String{
return ((((((((((((((((((((((((((("[FZipFile]" + "\n name:") + _filename) + "\n date:") + _date) + "\n sizeCompressed:") + _sizeCompressed) + "\n sizeUncompressed:") + _sizeUncompressed) + "\n versionHost:") + _versionHost) + "\n versionNumber:") + _versionNumber) + "\n compressionMethod:") + _compressionMethod) + "\n encrypted:") + _encrypted) + "\n hasDataDescriptor:") + _hasDataDescriptor) + "\n hasCompressedPatchedData:") + _hasCompressedPatchedData) + "\n filenameEncoding:") + _filenameEncoding) + "\n crc32:") + _crc32.toString(16)) + "\n adler32:") + _adler32.toString(16)));
}
public function get content():ByteArray{
if (isCompressed){
uncompress();
};
return (_content);
}
}
}//package deng.fzip
Section 30
//ChecksumUtil (deng.utils.ChecksumUtil)
package deng.utils {
import flash.utils.*;
public class ChecksumUtil {
private static var crcTable:Array = makeCRCTable();
private static function makeCRCTable():Array{
var _local1:Array;
var _local2:uint;
var _local3:uint;
var _local4:uint;
_local1 = [];
_local2 = 0;
while (_local2 < 0x0100) {
_local4 = _local2;
_local3 = 0;
while (_local3 < 8) {
if ((_local4 & 1)){
_local4 = (3988292384 ^ (_local4 >>> 1));
} else {
_local4 = (_local4 >>> 1);
};
_local3++;
};
_local1.push(_local4);
_local2++;
};
return (_local1);
}
public static function CRC32(_arg1:ByteArray, _arg2:uint=0, _arg3:uint=0):uint{
var _local4:uint;
var _local5:uint;
if (_arg2 >= _arg1.length){
_arg2 = _arg1.length;
};
if (_arg3 == 0){
_arg3 = (_arg1.length - _arg2);
};
if ((_arg3 + _arg2) > _arg1.length){
_arg3 = (_arg1.length - _arg2);
};
_local5 = 4294967295;
_local4 = _arg2;
while (_local4 < _arg3) {
_local5 = (uint(crcTable[((_local5 ^ _arg1[_local4]) & 0xFF)]) ^ (_local5 >>> 8));
_local4++;
};
return ((_local5 ^ 4294967295));
}
public static function Adler32(_arg1:ByteArray, _arg2:uint=0, _arg3:uint=0):uint{
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:uint;
if (_arg2 >= _arg1.length){
_arg2 = _arg1.length;
};
if (_arg3 == 0){
_arg3 = (_arg1.length - _arg2);
};
if ((_arg3 + _arg2) > _arg1.length){
_arg3 = (_arg1.length - _arg2);
};
_local4 = _arg2;
_local5 = 1;
_local6 = 0;
while (_arg3) {
_local7 = ((_arg3)>5550) ? 5550 : _arg3;
_arg3 = (_arg3 - _local7);
do {
var _temp1 = _local4;
_local4 = (_local4 + 1);
_local5 = (_local5 + _arg1[_temp1]);
_local6 = (_local6 + _local5);
--_local7;
} while (_local7);
_local5 = ((_local5 & 0xFFFF) + ((_local5 >> 16) * 15));
_local6 = ((_local6 & 0xFFFF) + ((_local6 >> 16) * 15));
};
if (_local5 >= 65521){
_local5 = (_local5 - 65521);
};
_local6 = ((_local6 & 0xFFFF) + ((_local6 >> 16) * 15));
if (_local6 >= 65521){
_local6 = (_local6 - 65521);
};
return (((_local6 << 16) | _local5));
}
}
}//package deng.utils
Section 31
//Background_54 (DirkDaggerFlash_fla.Background_54)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class Background_54 extends MovieClip {
public var chastity:MovieClip;
public var wall1:MovieClip;
public var wall2:MovieClip;
public var wall3:MovieClip;
public var wall4:MovieClip;
public var window:MovieClip;
}
}//package DirkDaggerFlash_fla
Section 32
//BackgroundBlurred_61 (DirkDaggerFlash_fla.BackgroundBlurred_61)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class BackgroundBlurred_61 extends MovieClip {
public var chastity:MovieClip;
public var wall1:MovieClip;
public var wall2:MovieClip;
public var wall3:MovieClip;
public var wall4:MovieClip;
public var window:MovieClip;
}
}//package DirkDaggerFlash_fla
Section 33
//BackgroundMC_53 (DirkDaggerFlash_fla.BackgroundMC_53)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class BackgroundMC_53 extends MovieClip {
public var backgroundBlurred:MovieClip;
public var selector:MovieClip;
}
}//package DirkDaggerFlash_fla
Section 34
//Chastity_55 (DirkDaggerFlash_fla.Chastity_55)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class Chastity_55 extends MovieClip {
public function Chastity_55(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 35
//ChastityBlurred_62 (DirkDaggerFlash_fla.ChastityBlurred_62)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class ChastityBlurred_62 extends MovieClip {
public function ChastityBlurred_62(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 36
//city_34 (DirkDaggerFlash_fla.city_34)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class city_34 extends MovieClip {
public function city_34(){
addFrameScript(601, frame602);
}
function frame602(){
gotoAndPlay(302);
}
}
}//package DirkDaggerFlash_fla
Section 37
//DaphneCabAnim_48 (DirkDaggerFlash_fla.DaphneCabAnim_48)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class DaphneCabAnim_48 extends MovieClip {
public function DaphneCabAnim_48(){
addFrameScript(0, frame1, 109, frame110);
}
function frame1(){
stop();
}
function frame110(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 38
//introbg_22 (DirkDaggerFlash_fla.introbg_22)
package DirkDaggerFlash_fla {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.ui.*;
import flash.system.*;
import flash.geom.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class introbg_22 extends MovieClip {
public var phoneAd:MovieClip;
public var urlButton:SimpleButton;
public function introbg_22(){
addFrameScript(219, frame220, 260, frame261);
}
function frame220(){
phoneAd.ngageURL.useHandCursor = false;
}
function frame261(){
stop();
urlButton = phoneAd.ngageURL;
urlButton.useHandCursor = true;
urlButton.addEventListener(MouseEvent.CLICK, (root as Main).ngageBannerClick, false, 0, true);
}
}
}//package DirkDaggerFlash_fla
Section 39
//loadingBar_29 (DirkDaggerFlash_fla.loadingBar_29)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class loadingBar_29 extends MovieClip {
public function loadingBar_29(){
addFrameScript(0, frame1);
}
function frame1(){
this.buttonMode = false;
}
}
}//package DirkDaggerFlash_fla
Section 40
//loadingbg_27 (DirkDaggerFlash_fla.loadingbg_27)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class loadingbg_27 extends MovieClip {
public var loadingBar:MovieClip;
}
}//package DirkDaggerFlash_fla
Section 41
//phoneAd_25 (DirkDaggerFlash_fla.phoneAd_25)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class phoneAd_25 extends MovieClip {
public var ngageURL:SimpleButton;
}
}//package DirkDaggerFlash_fla
Section 42
//PhotoFlashMC_69 (DirkDaggerFlash_fla.PhotoFlashMC_69)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class PhotoFlashMC_69 extends MovieClip {
public function PhotoFlashMC_69(){
addFrameScript(0, frame1, 29, frame30);
}
function frame1(){
stop();
}
function frame30(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 43
//spotlight_20 (DirkDaggerFlash_fla.spotlight_20)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class spotlight_20 extends MovieClip {
public function spotlight_20(){
addFrameScript(260, frame261);
}
function frame261(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 44
//text_14 (DirkDaggerFlash_fla.text_14)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class text_14 extends MovieClip {
public var ngageURL:SimpleButton;
}
}//package DirkDaggerFlash_fla
Section 45
//Wall1_57 (DirkDaggerFlash_fla.Wall1_57)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class Wall1_57 extends MovieClip {
public function Wall1_57(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 46
//Wall1Blurred_64 (DirkDaggerFlash_fla.Wall1Blurred_64)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class Wall1Blurred_64 extends MovieClip {
public function Wall1Blurred_64(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 47
//Wall3_59 (DirkDaggerFlash_fla.Wall3_59)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class Wall3_59 extends MovieClip {
public function Wall3_59(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 48
//Wall3Blurred_66 (DirkDaggerFlash_fla.Wall3Blurred_66)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class Wall3Blurred_66 extends MovieClip {
public function Wall3Blurred_66(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 49
//Wall4_60 (DirkDaggerFlash_fla.Wall4_60)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class Wall4_60 extends MovieClip {
public function Wall4_60(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 50
//Wall4Blurred_67 (DirkDaggerFlash_fla.Wall4Blurred_67)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class Wall4Blurred_67 extends MovieClip {
public function Wall4Blurred_67(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 51
//Window_56 (DirkDaggerFlash_fla.Window_56)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class Window_56 extends MovieClip {
public function Window_56(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 52
//WindowBlurred_63 (DirkDaggerFlash_fla.WindowBlurred_63)
package DirkDaggerFlash_fla {
import flash.display.*;
public dynamic class WindowBlurred_63 extends MovieClip {
public function WindowBlurred_63(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package DirkDaggerFlash_fla
Section 53
//AbstractMiniGame (minigames.AbstractMiniGame)
package minigames {
import flash.display.*;
public class AbstractMiniGame extends MovieClip {
protected var _actionSelectBox:String;
protected var _action:String;
public function get action():String{
return (_action);
}
public function start():void{
}
public function gameOver():void{
}
}
}//package minigames
Section 54
//CarChaseMain (minigames.CarChaseMain)
package minigames {
import flash.events.*;
import flash.display.*;
import model.*;
import view.debug.*;
import customEvents.*;
public class CarChaseMain extends AbstractMiniGame {
private var _carChaseMC:MovieClip;
private var speed:Number;// = 0.2
private var acc:Number;// = 0.05
public function CarChaseMain(){
acc = 0.05;
speed = 0.2;
super();
_action = "ch1/minigames/carchase.action";
_actionSelectBox = "Endmini";
_carChaseMC = new CarChaseMC();
_carChaseMC.x = 240;
_carChaseMC.y = 240;
this.addChild(_carChaseMC);
start();
}
override public function start():void{
this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler, false, 0, false);
this.addEventListener(MouseEvent.MOUSE_UP, onMouseUpHandler, false, 0, false);
_carChaseMC.daphneCabAnim.gotoAndPlay(2);
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler, false, 0, true);
}
private function onMouseUpHandler(_arg1:MouseEvent):void{
this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
}
override public function gameOver():void{
GoogleAnalyticsCaller.getInstance().track(GoogleAnalyticsCaller.CARCHASEFINISHED);
dispatchEvent(new GameOverEvent(GameOverEvent.GAMEOVER, false, false, _actionSelectBox));
}
private function onEnterFrameHandler(_arg1:Event):void{
var event = _arg1;
try {
_carChaseMC.lowCity.x = (_carChaseMC.lowCity.x + 4.5);
_carChaseMC.road.x = (_carChaseMC.road.x + 8);
_carChaseMC.highCity.x = (_carChaseMC.highCity.x + 2);
speed = (speed + acc);
_carChaseMC.pcCar.x = (_carChaseMC.pcCar.x - speed);
if (_carChaseMC.pcCar.x < -280){
this.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
this.removeEventListener(MouseEvent.MOUSE_UP, onMouseUpHandler);
this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
gameOver();
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
}
}//package minigames
Section 55
//MiniGameController (minigames.MiniGameController)
package minigames {
import flash.events.*;
import view.*;
import view.debug.*;
import customEvents.*;
import controller.*;
public class MiniGameController extends EventDispatcher {
private var _currentMiniGame:AbstractMiniGame;
private var _game:Game;
public static const CARCHASESLIDEID:int = 6713;
public static const PHOTOGAME:String = "photogame";
public static const CARCHASE:String = "carchase";
public function MiniGameController(_arg1:Game){
_game = _arg1;
}
public function getAction():String{
return (_currentMiniGame.action);
}
private function onGameOver(_arg1:GameOverEvent):void{
_currentMiniGame.removeEventListener(GameOverEvent.GAMEOVER, onGameOver);
_game.onMiniGameOver(_arg1.clickedSelectBox);
}
public function playMiniGame(_arg1:String):void{
var miniGameName = _arg1;
try {
if (miniGameName == CARCHASE){
_currentMiniGame = new CarChaseMain();
_currentMiniGame.scaleX = (Game.gameScale * 0.5);
_currentMiniGame.scaleY = (Game.gameScale * 0.5);
_currentMiniGame.addEventListener(GameOverEvent.GAMEOVER, onGameOver, false, 0, true);
MainView.getInstance().newMiniGame(_currentMiniGame);
_currentMiniGame.start();
} else {
if (miniGameName == PHOTOGAME){
_currentMiniGame = new PhotoGameMain();
_currentMiniGame.scaleX = (Game.gameScale * 0.5);
_currentMiniGame.scaleY = (Game.gameScale * 0.5);
_currentMiniGame.addEventListener(GameOverEvent.GAMEOVER, onGameOver, false, 0, true);
MainView.getInstance().newMiniGame(_currentMiniGame);
_currentMiniGame.start();
} else {
throw (new Error((("specified minigame " + miniGameName) + "minigame not found")));
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
}
}//package minigames
Section 56
//PhotoGameMain (minigames.PhotoGameMain)
package minigames {
import flash.events.*;
import flash.display.*;
import model.*;
import view.*;
import customEvents.*;
public class PhotoGameMain extends AbstractMiniGame {
private var friction:Number;// = 0.95
private var _photoGameMC:MovieClip;
private var dialogueShownFrames:int;// = 0
public var mass:Number;// = 1
private var curDialogue:DialogueSlideView;
private var speed:Number;// = 1.5
private var color:uint;
private var _mouseDown:Boolean;
private var t:Number;// = 0
private var focusT:Number;// = 0
private var lastMouseY:Number;// = -1
private var lastMouseX:Number;// = -1
public var radius:Number;
private var _state:int;
public var vx:Number;// = 0
public var vy:Number;// = 0
private var mouseHeldFrames;// = 0
private static var POSITION_GAME = 0;
private static var FOCUS_GAME = 1;
public function PhotoGameMain(){
vx = 0;
vy = 0;
mass = 1;
t = 0;
friction = 0.95;
lastMouseX = -1;
lastMouseY = -1;
speed = 1.5;
_state = POSITION_GAME;
mouseHeldFrames = 0;
dialogueShownFrames = 0;
focusT = 0;
super();
_action = "ch1/minigames/photoChastity.action";
_actionSelectBox = "thePhoto";
_photoGameMC = new PhotoGameMC();
_photoGameMC.photoFlashMC.visible = false;
this.addChild(_photoGameMC);
}
private function showDialogue(_arg1:String):void{
var _local2:Image;
curDialogue = new DialogueSlideView();
curDialogue.setTextToDisplay(_arg1, "top");
_local2 = ContentManager.getInstance().getImage("img/balloons/Balloon_U_Voiceover.png", 0, "", 0, 0);
curDialogue.addBalloon(_local2, "top");
curDialogue.preProcessBeforeDisplay();
this.addChild(curDialogue);
dialogueShownFrames = 0;
}
private function doFocus():Boolean{
_photoGameMC.photoFlashMC.visible = true;
_photoGameMC.photoFlashMC.gotoAndPlay(2);
if (_photoGameMC.backgroundMC.backgroundBlurred.alpha <= 0.6){
gameOver();
return (true);
};
showDialogue("<i>She's not quite in focus.</i>");
_state = POSITION_GAME;
return (false);
}
override public function start():void{
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler, false, 0, true);
Main.mainMovie.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler, false, 0, true);
Main.mainMovie.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUpHandler, false, 0, true);
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
if (curDialogue){
if (dialogueShownFrames > 5){
this.removeChild(curDialogue);
curDialogue = null;
};
} else {
_mouseDown = true;
mouseHeldFrames = 0;
if (_state == POSITION_GAME){
doAim();
} else {
if (_state == FOCUS_GAME){
doFocus();
};
};
};
}
private function doAim():Boolean{
if (_photoGameMC.crossHairDot.hitTestObject(_photoGameMC.backgroundMC.selector)){
_state = FOCUS_GAME;
focusT = 0;
return (true);
};
showDialogue("<i>My aim is off, I need to get a picture of her face.</i>");
return (false);
}
private function onMouseUpHandler(_arg1:MouseEvent):void{
if (curDialogue){
return;
};
_mouseDown = false;
if (_state == POSITION_GAME){
} else {
if (_state == FOCUS_GAME){
if (mouseHeldFrames > 5){
doFocus();
};
};
};
}
override public function gameOver():void{
GoogleAnalyticsCaller.getInstance().track(GoogleAnalyticsCaller.PHOTOGAMEFINISHED);
this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
Main.mainMovie.stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
Main.mainMovie.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUpHandler);
dispatchEvent(new GameOverEvent(GameOverEvent.GAMEOVER, false, false, _actionSelectBox));
}
private function onEnterFrameHandler(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
if (curDialogue){
dialogueShownFrames++;
return;
};
if (_mouseDown == true){
mouseHeldFrames++;
};
if (_state == POSITION_GAME){
_photoGameMC.backgroundMC.backgroundBlurred.alpha = 1;
t = (t + (0.04 * Math.PI));
_local2 = (_photoGameMC.backgroundMC.selector.x + (_photoGameMC.backgroundMC.selector.width / 2));
_local3 = (_photoGameMC.backgroundMC.selector.y + (_photoGameMC.backgroundMC.selector.height / 2));
_photoGameMC.backgroundMC.x = ((_local2 + (Math.cos((0.25 * t)) * 100)) + (Math.cos((3 * t)) * 50));
_photoGameMC.backgroundMC.y = (_local3 + ((Math.cos((1 * t)) * 100) + (Math.sin((3 * t)) * 20)));
} else {
if (_state == FOCUS_GAME){
focusT = (focusT + (0.05 * Math.PI));
_photoGameMC.backgroundMC.backgroundBlurred.alpha = ((Math.sin(focusT) * 0.5) + 0.5);
};
};
}
}
}//package minigames
Section 57
//ActionParser (model.ActionParser)
package model {
import view.debug.*;
public class ActionParser {
private var _actionsArray:Array;
public function ActionParser(_arg1:String){
_actionsArray = new Array();
parseActionString(ContentManager.getInstance().getString(_arg1));
}
private function parseActionString(_arg1:String):void{
var doubleEnterPattern:RegExp;
var singleEnterPattern:RegExp;
var splitArrayDoubleEnterPattern:Array;
var onClick:String;
var splitArraySingleEnterPattern:Array;
var actionString = _arg1;
try {
doubleEnterPattern = /\n\n/;
singleEnterPattern = /\n/;
splitArrayDoubleEnterPattern = actionString.split(doubleEnterPattern);
for each (onClick in splitArrayDoubleEnterPattern) {
splitArraySingleEnterPattern = onClick.split(singleEnterPattern);
if (splitArraySingleEnterPattern[0] != ""){
_actionsArray.push(splitArraySingleEnterPattern);
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function get actionsArray():Array{
return (_actionsArray);
}
}
}//package model
Section 58
//AnimData (model.AnimData)
package model {
import flash.display.*;
public class AnimData {
private var _length:Number;
private var _yPos:Number;
private var _xPos:Number;
private var _image:DisplayObject;
public function AnimData(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number){
_image = _arg1;
_image.x = _arg3;
_image.y = _arg4;
_length = _arg2;
_xPos = _arg3;
_yPos = _arg4;
}
public function get image():DisplayObject{
return (_image);
}
public function get xPos():Number{
return (_xPos);
}
public function get length():Number{
return (_length);
}
public function get yPos():Number{
return (_yPos);
}
}
}//package model
Section 59
//ChoiceData (model.ChoiceData)
package model {
public class ChoiceData extends TextData {
private var _nextSlideId:int;
public function ChoiceData(_arg1:String, _arg2:int){
super(_arg1, italic, bold);
_nextSlideId = _arg2;
}
public function get nextSlideId():int{
return (_nextSlideId);
}
}
}//package model
Section 60
//ContentManager (model.ContentManager)
package model {
import deng.fzip.*;
import view.*;
import flash.utils.*;
import view.debug.*;
public class ContentManager {
private var _zipManager:ZipManager;
private static var _instance:ContentManager;
public function getByteArray(_arg1:String):ByteArray{
var byteArray:ByteArray;
var path = _arg1;
try {
byteArray = _zipManager.getContent(path);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
} finally {
var _local5:* = byteArray;
//unresolved jump
1;
return (_local5);
};
}
public function getImage(_arg1:String, _arg2:int, _arg3:String, _arg4:int, _arg5:int):Image{
var byteArray:ByteArray;
var image:Image;
var path = _arg1;
var depth = _arg2;
var sheet = _arg3;
var xPos = _arg4;
var yPos = _arg5;
try {
byteArray = _zipManager.getContent(path);
if (byteArray != null){
image = new Image(path, byteArray, depth, sheet, xPos, yPos);
} else {
throw (new Error((path + ".png not found")));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
byteArray = _zipManager.getContent("img/ImageNotFound.jpg");
image = new Image(path, byteArray, depth, sheet, xPos, yPos);
} finally {
var _local9:* = image;
//unresolved jump
1;
return (_local9);
};
}
public function getXML(_arg1:String):XML{
var _local2:XML;
_local2 = XML(_zipManager.getContentAsString(_arg1));
return (_local2);
}
public function getString(_arg1:String):String{
var _local2:String;
_local2 = _zipManager.getContentAsString(_arg1);
return (_local2);
}
public function getAnimation(_arg1:String, _arg2:int, _arg3:String, _arg4:int, _arg5:int, _arg6:Boolean=true):Animation{
var _local7:String;
var _local8:Animation;
_local7 = _zipManager.getContentAsString(_arg1);
if (_local7 != null){
_local8 = new Animation(_arg1, _local7, _arg2, _arg3, _arg4, _arg5, _arg6);
return (_local8);
};
DebugHandler.getInstance().displayText((_arg1 + " not found"));
return (_local8);
}
public function setContent(_arg1:FZip):void{
_zipManager = new ZipManager(_arg1);
}
public static function getInstance():ContentManager{
if (_instance == null){
_instance = new (ContentManager);
};
return (_instance);
}
}
}//package model
Section 61
//DialogueData (model.DialogueData)
package model {
public class DialogueData {
private var _path:String;
public function DialogueData(_arg1:String){
_path = _arg1;
}
public function get path():String{
return (_path);
}
}
}//package model
Section 62
//DialogueSlide (model.DialogueSlide)
package model {
import flash.events.*;
import view.*;
import flash.utils.*;
import view.debug.*;
import controller.sound.*;
import customEvents.*;
import controller.*;
import minigames.*;
public class DialogueSlide extends EventDispatcher {
private var _choiceArray:Array;
private var _view:DialogueSlideView;
private var _loadingImagesArray:Array;
private var _defaultWait:int;// = 1400
private var _waitingForTimer:Boolean;// = false
private var _finishedLooping:Boolean;// = false
private var _dialogue:Dialogue;
private var _waitTimer:Timer;
private var _playPosition:int;// = 0
private var _dialogueXML:XML;
private var _dialogueArray:Array;
private var _slideId:int;
private var _autoContinueTimer:Timer;
private var _letterWait:int;// = 55
private static var FWDPATTERN:RegExp = /fwd/g;
private static var postTopTextPattern:RegExp = /#PostTopText\n/g;
private static var spacePattern:RegExp = /\s/g;
private static var preBottomTextPattern:RegExp = /#PreBottomText\n/g;
private static var tabPattern:RegExp = /\t/g;
private static var gadgetPattern2:RegExp = /\n/g;
public function DialogueSlide(_arg1:XML, _arg2:int, _arg3:Dialogue){
var dialogueString:String;
var dialogueXML = _arg1;
var slideId = _arg2;
var dialogue = _arg3;
_playPosition = 0;
_waitingForTimer = false;
_finishedLooping = false;
_letterWait = 55;
_defaultWait = 1400;
super();
try {
_loadingImagesArray = new Array();
_dialogueXML = dialogueXML;
_slideId = slideId;
_dialogue = dialogue;
_view = new DialogueSlideView();
_view.addEventListener(ChoiceEvent.CHOICE, onChoiceClick, false, 0, true);
dialogueString = dialogueXML.toString();
dialogueString = dialogueString.replace(tabPattern, "");
dialogueString = dialogueString.replace(preBottomTextPattern, "");
dialogueString = dialogueString.replace(postTopTextPattern, "");
_dialogueArray = dialogueString.split(gadgetPattern2);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function setBalloon(_arg1:Array):void{
var path:String;
var image:Image;
var position:String;
var balloonArray = _arg1;
try {
path = (balloonArray[1] + ".png");
image = ContentManager.getInstance().getImage(path, 0, "", 0, 0);
image.addEventListener(Event.COMPLETE, checkIfShowOnContentLoaded, false, 0, true);
_loadingImagesArray.push(image);
position = balloonArray[2];
_view.addBalloon(image, position);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function setStinger(_arg1:Array):void{
var path:String;
var xPos:int;
var yPos:int;
var position:String;
var image:Image;
var animationArray = _arg1;
try {
path = (animationArray[3] + ".png");
xPos = animationArray[1];
yPos = animationArray[2];
position = animationArray[4];
image = ContentManager.getInstance().getImage(path, 0, "", xPos, yPos);
image.addEventListener(Event.COMPLETE, checkIfShowOnContentLoaded, false, 0, true);
_loadingImagesArray.push(image);
_view.addStinger(image, position);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function waitFinished(_arg1:TimerEvent):void{
DebugHandler.getInstance().displayText("waitFinished");
_waitingForTimer = false;
_dialogue.playSlide();
}
private function onEndEnterFrameHandler(_arg1:Event):void{
if (_view.alpha < 0){
Main.mainMovie.removeEventListener(Event.ENTER_FRAME, onEndEnterFrameHandler);
_dialogue.endGame();
} else {
_view.alpha = (_view.alpha - 0.01);
};
}
private function clearSheet(_arg1:Array):void{
var _local2:String;
_local2 = _arg1[1];
_view.clearSheet(_local2);
}
private function hideText(_arg1:Array):void{
DebugHandler.getInstance().displayText("hidingtext");
_view.setVisible(_arg1[1], false);
}
private function showIcon(_arg1:Array):void{
var animation:Animation;
var xPos:Number;
var yPos:Number;
var path:String;
var iconArray = _arg1;
try {
xPos = iconArray[2];
yPos = iconArray[3];
path = "";
if (iconArray[1] == "newtask"){
path = "animations/New_quest.anim";
} else {
if (iconArray[1] == "plusmap"){
path = "animations/Plus_map.anim";
} else {
if (iconArray[1] == "plusinv"){
path = "animations/Inv.anim";
} else {
if (iconArray[1] == "taskdone"){
path = "animations/Check.anim";
};
};
};
};
if (path != ""){
animation = createAnimation(path, 0, "", xPos, yPos, false);
_view.addIcon(animation);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function onChoiceClick(_arg1:ChoiceEvent):void{
var event = _arg1;
try {
_dialogue.setNextSlideId(event.choiceData.nextSlideId);
_dialogue.playSlide();
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function setChoice(_arg1:Array):void{
var _local2:String;
var _local3:String;
var _local4:ChoiceData;
if (_choiceArray == null){
_choiceArray = new Array();
_dialogue.onChoice();
};
_local2 = _arg1[2];
_local3 = _dialogue.getTextWithId(_local2);
_local4 = new ChoiceData(_local3, _arg1[1]);
_choiceArray.push(_local4);
}
private function playAnimation(_arg1:Array):void{
var path:String;
var xPos:int;
var yPos:int;
var sheet:String;
var animation:Animation;
var animationArray = _arg1;
try {
path = animationArray[2];
xPos = animationArray[3];
yPos = animationArray[4];
sheet = animationArray[1];
animation = createAnimation(path, 0, sheet, xPos, yPos);
_view.addGraphic(animation);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function play():void{
var _local1:String;
var _local2:Array;
var _local3:String;
if (_waitingForTimer){
return;
};
if (_waitTimer != null){
_waitTimer.stop();
_waitTimer.removeEventListener(TimerEvent.TIMER, waitFinished);
_waitTimer = null;
};
if (_autoContinueTimer != null){
_autoContinueTimer.stop();
_autoContinueTimer.removeEventListener(TimerEvent.TIMER, waitFinished);
_autoContinueTimer = null;
};
_playPosition;
while (_playPosition < _dialogueArray.length) {
_local1 = _dialogueArray[_playPosition];
_local2 = _local1.split(spacePattern);
_local3 = _local2[0];
if (_local3 == "load"){
showImage(_local2);
} else {
if (_local3 == "startaction"){
startAction(_local2);
} else {
if (_local3 == "animation"){
playAnimation(_local2);
} else {
if (_local3 == "clear"){
clearSheet(_local2);
} else {
if (_local3 == "pan"){
panSheet(_local2);
} else {
if (_local3 == "fade"){
fadeSheet(_local2);
} else {
if (_local3 == "play"){
playSound(_local2);
} else {
if (_local3 == "stinger"){
setStinger(_local2);
} else {
if (_local3 == "balloon"){
setBalloon(_local2);
} else {
if (_local3 == "text"){
setTextTT(_local2);
} else {
if (_local3 == "hidetext"){
hideText(_local2);
} else {
if (_local3 == "conditionalchoice"){
conditionalChoice(_local2);
} else {
if (_local3 == "choice"){
setChoice(_local2);
} else {
if (_local3 == "wait"){
DebugHandler.getInstance().displayText("wait");
waitEncountered(_local2);
_playPosition++;
break;
} else {
if (_local3 == "pause"){
DebugHandler.getInstance().displayText("pause");
onPauseEncountered(_local2);
_playPosition++;
break;
} else {
if (_local3 == "icon"){
showIcon(_local2);
} else {
if (_local3 == "continue"){
continueEncountered(_local2);
_playPosition++;
break;
} else {
if (_local3 == "autocontinue"){
autoContinue(_local2);
_playPosition++;
break;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
_playPosition++;
};
_finishedLooping = true;
checkIfShow();
}
private function startAction(_arg1:Array):void{
var valueString:String;
var soundPath:String;
var dialoguePath:String;
var dialogueData:DialogueData;
var locationPath:String;
var locationData:LocationData;
var xPos:Number;
var yPos:Number;
var animName:String;
var startActionArray = _arg1;
try {
if (startActionArray[1] == "\"setglobal"){
valueString = startActionArray[3];
valueString = valueString.replace("\"", "");
WorldState.getInstance().addKeyValue(startActionArray[2], valueString);
} else {
if (startActionArray[1] == "\"return\""){
_dialogue.endDialogue();
} else {
if (startActionArray[1] == "\"play"){
soundPath = startActionArray[3];
soundPath = soundPath.replace("\"", "");
SoundManager.getInstance().playSound(soundPath, false);
} else {
if (startActionArray[1] == "\"loaddialogue"){
dialoguePath = startActionArray[2];
dialoguePath = dialoguePath.replace("\"", "");
dialogueData = new DialogueData(dialoguePath);
_dialogue.newDialogue(dialogueData);
} else {
if (startActionArray[1] == "\"loadlocation"){
locationPath = startActionArray[2];
locationPath = locationPath.replace("\"", "");
locationPath = locationPath.replace(FWDPATTERN, "csd");
locationData = new LocationData(locationPath, 0, 0);
_dialogue.newLocation(locationData);
} else {
if (startActionArray[1] == "\"loadminigame"){
_dialogue.loadMiniGame(MiniGameController.PHOTOGAME);
} else {
if (startActionArray[1] == "\"panlocation"){
xPos = startActionArray[2];
yPos = startActionArray[3];
_dialogue.panLocation(xPos, yPos);
} else {
if (startActionArray[1] == "\"endgame\""){
_dialogue.lastSlide();
_waitingForTimer = true;
Main.mainMovie.addEventListener(Event.ENTER_FRAME, onEndEnterFrameHandler, false, 0, true);
} else {
if (startActionArray[1] == "\"pauseanimation"){
animName = startActionArray[2];
animName = animName.replace("\"", "");
_view.pauseAnimation(animName);
};
};
};
};
};
};
};
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function panSheet(_arg1:Array):void{
var _local2:String;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = _arg1[1];
_local3 = (_arg1[2] * Game.gameScale);
_local4 = (_arg1[3] * Game.gameScale);
_local5 = _arg1[4];
_view.panSheet(_local2, _local3, _local4, _local5);
}
private function fadeSheet(_arg1:Array):void{
var _local2:String;
var _local3:int;
var _local4:int;
_local2 = _arg1[1];
_local3 = _arg1[2];
_local4 = _arg1[3];
_view.fadeSheet(_local2, _local3, _local4);
}
private function autoContineTimer(_arg1:TimerEvent):void{
_dialogue.playSlide();
_autoContinueTimer.removeEventListener(TimerEvent.TIMER, autoContineTimer);
_autoContinueTimer = null;
}
private function conditionalChoice(_arg1:Array):void{
var _local2:String;
var _local3:String;
var _local4:Array;
var _local5:String;
var _local6:int;
var _local7:String;
var _local8:String;
_local2 = _arg1[1];
_local3 = _arg1[2];
if (WorldState.getInstance().hasKeyValue(_local2, _local3)){
_local4 = new Array();
_local5 = _arg1[0];
_local6 = _arg1[3];
_local7 = _arg1[4];
_local8 = _arg1[5];
_local4.push(_local5);
_local4.push(_local6);
_local4.push(_local7);
_local4.push(_local8);
setChoice(_local4);
};
}
private function playSound(_arg1:Array):void{
SoundManager.getInstance().playSound(_arg1[2], false);
}
private function waitEncountered(_arg1:Array):void{
var _local2:int;
_local2 = int(_arg1[1]);
if (_local2 > 0){
_waitTimer = new Timer(((1000 * _local2) / Main.mainMovie.frameRate), 1);
_waitTimer.addEventListener(TimerEvent.TIMER, waitFinished, false, 0, true);
_waitTimer.start();
} else {
_waitTimer = new Timer(((1000 * 50) / Main.mainMovie.frameRate), 1);
_waitTimer.addEventListener(TimerEvent.TIMER, waitFinished, false, 0, true);
_waitTimer.start();
};
}
private function showImage(_arg1:Array):void{
var path:String;
var sheet:String;
var image:Image;
var imageArray = _arg1;
try {
path = (imageArray[2] + ".png");
sheet = imageArray[1];
image = ContentManager.getInstance().getImage(path, 0, sheet, 0, 0);
image.addEventListener(Event.COMPLETE, checkIfShowOnContentLoaded, false, 0, true);
_loadingImagesArray.push(image);
_view.addGraphic(image);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function onPauseEncountered(_arg1:Array):void{
var _local2:int;
_local2 = int(_arg1[1]);
if (_local2 > 0){
_waitTimer = new Timer(((1000 * _local2) / Main.mainMovie.frameRate), 1);
_waitingForTimer = true;
_waitTimer.addEventListener(TimerEvent.TIMER, waitFinished, false, 0, true);
_waitTimer.start();
};
}
private function checkIfShow():void{
var display:Boolean;
var abstractGraphic:AbstractGraphic;
try {
if (_finishedLooping){
display = true;
for each (abstractGraphic in _loadingImagesArray) {
if (!abstractGraphic.ready){
display = false;
break;
};
};
if (display){
if (_dialogue.mode != DialogueMode.FINISHED){
showDialogue();
};
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function continueEncountered(_arg1:Array):void{
_dialogue.setNextSlideId(_arg1[1]);
}
private function setTextTT(_arg1:Array):void{
var _local2:String;
var _local3:String;
_local2 = _arg1[1];
_local3 = _dialogue.getTextWithId(_local2);
_view.setTextToDisplay(_local3, _arg1[2]);
}
public function finished():Boolean{
return ((_playPosition == _dialogueArray.length));
}
private function showDialogue():void{
DebugHandler.getInstance().displayText("showing new slide");
_view.preProcessBeforeDisplay();
dispatchEvent(new Event("play"));
MainView.getInstance().newSlide(_view);
}
private function autoContinue(_arg1:Array):void{
var _local2:int;
_dialogue.setNextSlideId(_arg1[2]);
_local2 = _defaultWait;
if (_view.getTextLength() != -1){
_local2 = (_local2 + (_view.getTextLength() * _letterWait));
};
if (_autoContinueTimer != null){
_autoContinueTimer.stop();
_autoContinueTimer.removeEventListener(TimerEvent.TIMER, autoContineTimer);
_autoContinueTimer = null;
};
DebugHandler.getInstance().displayText(("waitLength is " + String(_local2)));
_autoContinueTimer = new Timer(_local2, 1);
_autoContinueTimer.addEventListener(TimerEvent.TIMER, autoContineTimer, false, 0, true);
_autoContinueTimer.start();
}
private function createAnimation(_arg1:String, _arg2:int, _arg3:String, _arg4:Number, _arg5:Number, _arg6:Boolean=true):Animation{
var _local7:Animation;
_local7 = ContentManager.getInstance().getAnimation(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
this.addEventListener("play", _local7.playAnimation, false, 0, true);
return (_local7);
}
private function checkIfShowOnContentLoaded(_arg1:Event):void{
var eventdispatcher:EventDispatcher;
var event = _arg1;
try {
eventdispatcher = (event.target as EventDispatcher);
eventdispatcher.removeEventListener(Event.COMPLETE, checkIfShowOnContentLoaded);
checkIfShow();
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function showChoice():void{
try {
_view.showChoice(_choiceArray);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
}
}//package model
Section 63
//GoogleAnalyticsCaller (model.GoogleAnalyticsCaller)
package model {
import view.debug.*;
import flash.net.*;
public class GoogleAnalyticsCaller {
private var _on:Boolean;// = true
public static const DIRKDAGGERBANNERCLICK:String = "javascript:pageTracker._trackPageview('/CLICK/DIRKDAGGERBANNER');";
public static const FINISHEDGAME:String = "javascript:pageTracker._trackPageview('/FINISHEDGAME');";
public static const PLAYBUTTONCLICK:String = "javascript:pageTracker._trackPageview('/CLICK/PLAYBUTTON');";
public static const STARTEDLOADINGGAME:String = "javascript:pageTracker._trackPageview('/STARTEDLOADINGGAME');";
public static const CARCHASEFINISHED:String = "javascript:pageTracker._trackPageview('/CARCHASEFINISHED');";
public static const PHOTOGAMEFINISHED:String = "javascript:pageTracker._trackPageview('/PHOTOGAMEFINISHED');";
public static const NGAGEBANNERCLICK:String = "javascript:pageTracker._trackPageview('/CLICK/NGAGEBANNER');";
private static var _instance:GoogleAnalyticsCaller;
public function GoogleAnalyticsCaller(_arg1:SingletonEnforcer){
_on = true;
super();
}
public function set on(_arg1:Boolean):void{
_on = _arg1;
}
public function track(_arg1:String):void{
var request:URLRequest;
var type = _arg1;
try {
if (_on){
request = new URLRequest(type);
navigateToURL(request, "_self");
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public static function getInstance():GoogleAnalyticsCaller{
if (_instance == null){
_instance = new GoogleAnalyticsCaller(new SingletonEnforcer());
};
return (_instance);
}
}
}//package model
class SingletonEnforcer {
private function SingletonEnforcer(){
}
}
Section 64
//LangParser (model.LangParser)
package model {
import view.debug.*;
public class LangParser {
private var _languageArray:Array;
private static const ITALICPATTERNSTART:RegExp = /{I}/g;
private static const RETURNPATTERN:RegExp = /\n/g;
private static const BREAKPATTERNEND:RegExp = /{\/BR}/g;
private static const BOLDPATTERNEND:RegExp = /{\/B}/g;
private static const BREAKPATTERNSTART:RegExp = /{BR}/g;
private static const BOLDPATTERNSTART:RegExp = /{B}/g;
private static const ITALICPATTERNEND:RegExp = /{\/I}/g;
public function LangParser(_arg1:String){
var languageString:String;
var languagePath = _arg1;
super();
try {
languageString = ContentManager.getInstance().getString(languagePath);
if (languageString != null){
_languageArray = languageString.split(RETURNPATTERN);
} else {
throw (new Error("Languages textfile not found!"));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function getText(_arg1:String):String{
var _local2:String;
var _local3:int;
var _local4:Array;
var _local5:String;
_local3 = 0;
while (_local3 < _languageArray.length) {
_local2 = _languageArray[_local3];
if (_local2.search(_arg1) != -1){
_local4 = _local2.split("=");
_local5 = _local4[1];
_local5 = _local5.replace(ITALICPATTERNEND, "</i>");
_local5 = _local5.replace(ITALICPATTERNSTART, "<i>");
_local5 = _local5.replace(BOLDPATTERNEND, "</b>");
_local5 = _local5.replace(BOLDPATTERNSTART, "<b>");
_local5 = _local5.replace(BREAKPATTERNEND, "</br>");
_local5 = _local5.replace(BREAKPATTERNSTART, "<br>");
return (_local5);
};
_local3++;
};
return (null);
}
}
}//package model
Section 65
//LocationData (model.LocationData)
package model {
public class LocationData {
private var _path:String;
private var _xOffset:Number;// = 0
private var _yOffset:Number;// = 0
public function LocationData(_arg1:String, _arg2:Number, _arg3:Number){
_xOffset = 0;
_yOffset = 0;
super();
setCorrectPath(_arg1);
_xOffset = _arg2;
_yOffset = _arg3;
}
public function get path():String{
return (_path);
}
public function get xOffset():Number{
return (_xOffset);
}
private function setCorrectPath(_arg1:String):void{
var _local2:RegExp;
var _local3:String;
var _local4:String;
_local2 = /fwd/;
_local3 = "csd";
_local4 = _arg1.replace(_local2, _local3);
_path = _local4;
}
public function set xOffset(_arg1:Number):void{
_xOffset = _arg1;
}
public function get yOffset():Number{
return (_yOffset);
}
public function set yOffset(_arg1:Number):void{
_yOffset = _arg1;
}
}
}//package model
Section 66
//LocationParser (model.LocationParser)
package model {
import flash.events.*;
import flash.display.*;
import view.*;
import view.debug.*;
import customEvents.*;
import controller.*;
public class LocationParser extends EventDispatcher {
private var _layerList:XMLList;
private var _game:Game;
private var _location:Location;
private var _doneIterating:Boolean;// = false
private var _locationXML:XML;
private var _firstDraw:Boolean;// = true
private var _locationData:LocationData;
private var _processedGraphics:Array;
private static const ANDPATTERN:RegExp = /\^/;
private static const VARIABLEPATTERN:RegExp = /\,/;
public function LocationParser(_arg1:Game){
_processedGraphics = new Array();
_doneIterating = false;
_firstDraw = true;
super();
_game = _arg1;
}
private function graphicFinished(_arg1:Event=null):void{
var _local2:EventDispatcher;
_local2 = (_arg1.target as EventDispatcher);
_local2.removeEventListener(Event.COMPLETE, graphicFinished);
checkIfDraw();
}
private function getAnimation(_arg1:XML):Animation{
var _local2:Animation;
_local2 = ContentManager.getInstance().getAnimation(_arg1.@name, _arg1.@depth, "", _arg1.@x, _arg1.@y);
return (_local2);
}
private function updateLayerOnCondition(_arg1:Layer, _arg2:XML):void{
var valueXMLList:XMLList;
var valueXMLListLength:int;
var valueXML:XML;
var variableString:String;
var variableArray:Array;
var variableArrayLength:int;
var valueString:String;
var valueArray:Array;
var worldStateDataArray:Array;
var graphicXML:XML;
var graphicXMLList:XMLList;
var j:int;
var graphicXMLListLength:int;
var i:Number;
var key:String;
var value:String;
var worldStateData:WorldStateData;
var k:int;
var displayObject:DisplayObject;
var l:int;
var layer = _arg1;
var conditionXML = _arg2;
try {
valueXMLList = conditionXML..value;
valueXMLListLength = valueXMLList.length();
variableString = conditionXML.@variable;
variableArray = variableString.split(ANDPATTERN);
variableArrayLength = variableArray.length;
j = 0;
while (j < valueXMLListLength) {
valueXML = valueXMLList[j];
valueString = valueXML.@value;
graphicXMLList = valueXML.children().children();
graphicXMLListLength = graphicXMLList.length();
valueArray = valueString.split(VARIABLEPATTERN);
worldStateDataArray = new Array();
i = 0;
while (i < variableArrayLength) {
key = variableArray[i];
value = valueArray[i];
worldStateData = new WorldStateData(key, value);
worldStateDataArray.push(worldStateData);
i = (i + 1);
};
if (WorldState.getInstance().hasKeyValues(worldStateDataArray)){
k = 0;
while (k < graphicXMLListLength) {
graphicXML = graphicXMLList[k];
displayObject = createContent(graphicXML);
if (displayObject != null){
layer.addToDrawStack(displayObject);
};
k = (k + 1);
};
} else {
l = 0;
while (l < graphicXMLListLength) {
graphicXML = graphicXMLList[l];
layer.addToRemoveStack(graphicXML.@name);
l = (l + 1);
};
};
j = (j + 1);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function createContent(_arg1:XML):DisplayObject{
var _local2:DisplayObject;
var _local3:Image;
var _local4:Animation;
if (_arg1.name() == "picture"){
_local2 = getImage(_arg1);
_local3 = (_local2 as Image);
_local3.addEventListener(Event.COMPLETE, graphicFinished, false, 0, true);
_processedGraphics.push(_local3);
} else {
if (_arg1.name() == "animation"){
_local2 = getAnimation(_arg1);
_local4 = (_local2 as Animation);
_local4.addEventListener(Event.COMPLETE, graphicFinished, false, 0, true);
_processedGraphics.push(_local4);
_local4.playAnimation();
} else {
if (_arg1.name() == "active"){
_local2 = new Activator(_arg1.@name, _arg1.@x, _arg1.@y, _arg1.@width, _arg1.@height, _arg1.@boundx, _arg1.@boundy, _arg1.@boundw, _arg1.@boundh, _game);
};
};
};
return (_local2);
}
public function createLocation(_arg1:LocationData):void{
var object:DisplayObject;
var xmlLayer:XML;
var soundXML:XML;
var layer:Layer;
var graphicXML:XML;
var locationData = _arg1;
try {
_firstDraw = true;
_locationData = locationData;
_locationXML = ContentManager.getInstance().getXML(locationData.path);
_layerList = _locationXML..layer;
_location = new Location();
for each (xmlLayer in _layerList) {
layer = new Layer(xmlLayer.@name, xmlLayer.@depth, (Number(xmlLayer.@x) + locationData.xOffset), (Number(xmlLayer.@y) + locationData.yOffset), xmlLayer.@scrollx, xmlLayer.@scrollx, xmlLayer.@definespan, xmlLayer.@width, xmlLayer.@height);
_location.addLayer(layer);
for each (graphicXML in xmlLayer.children().children()) {
if (graphicXML.name() == "condition"){
updateLayerOnCondition(layer, graphicXML);
} else {
object = createContent(graphicXML);
if (object != null){
layer.addToDrawStack(object);
};
};
};
};
_doneIterating = true;
checkIfDraw();
for each (soundXML in _locationXML..sound) {
_location.playSound(soundXML.@identifier);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function updateLocation(_arg1:NewWorldStateEvent):void{
var layer:Layer;
var layerXMLListLength:int;
var xmlLayer:XML;
var conditionsXML:XML;
var conditionsXMLListLength:int;
var conditionsXMLList:XMLList;
var i:int;
var j:int;
var event = _arg1;
try {
if (((!((_locationXML == null))) && (!((_location == null))))){
layerXMLListLength = _layerList.length();
i = 0;
while (i < layerXMLListLength) {
xmlLayer = _layerList[i];
conditionsXMLList = xmlLayer..condition;
conditionsXMLListLength = conditionsXMLList.length();
layer = _location.getLayer(xmlLayer.@name);
j = 0;
while (j < conditionsXMLListLength) {
conditionsXML = conditionsXMLList[j];
if (relevantCondition(conditionsXML, event.key)){
updateLayerOnCondition(layer, conditionsXML);
};
j = (j + 1);
};
i = (i + 1);
};
_doneIterating = true;
checkIfDraw();
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function checkIfDraw():void{
var _local1:Boolean;
var _local2:AbstractGraphic;
if (_doneIterating){
_local1 = true;
for each (_local2 in _processedGraphics) {
if (!_local2.ready){
_local1 = false;
break;
};
};
if (_local1){
_doneIterating = false;
_location.updateLayers();
if (_firstDraw){
_firstDraw = false;
MainView.getInstance().newLocation(location);
};
};
};
}
public function get location():Location{
return (_location);
}
private function getImage(_arg1:XML):Image{
var _local2:Image;
_local2 = ContentManager.getInstance().getImage((_arg1.@name + ".png"), _arg1.@depth, "", _arg1.@x, _arg1.@y);
return (_local2);
}
private function relevantCondition(_arg1:XML, _arg2:String):Boolean{
var _local3:String;
var _local4:Array;
var _local5:String;
_local3 = _arg1.@variable;
_local4 = _local3.split(ANDPATTERN);
for each (_local5 in _local4) {
if (_local5 == _arg2){
return (true);
};
};
return (false);
}
}
}//package model
Section 67
//TextData (model.TextData)
package model {
public class TextData {
protected var _bold:Boolean;
protected var _text:String;
protected var _italic:Boolean;
public function TextData(_arg1:String, _arg2:Boolean, _arg3:Boolean){
_text = _arg1;
_italic = _arg2;
_bold = _arg3;
}
public function get bold():Boolean{
return (_bold);
}
public function get text():String{
return (_text);
}
public function get italic():Boolean{
return (_italic);
}
}
}//package model
Section 68
//TextFormatManager (model.TextFormatManager)
package model {
import flash.text.*;
public class TextFormatManager {
public function getDigStripNormal():TextFormat{
var _local1:Font;
var _local2:TextFormat;
_local1 = new DigitalStrip();
_local2 = new TextFormat();
_local2.font = _local1.fontName;
_local2.size = 20;
_local2.align = TextFormatAlign.CENTER;
return (_local2);
}
}
}//package model
Section 69
//WorldState (model.WorldState)
package model {
import flash.events.*;
import view.debug.*;
import customEvents.*;
public class WorldState extends EventDispatcher {
private var _worldStateList:Object;
private static var _instance:WorldState;
private static var NOTPATTERN:RegExp = /\!/;
public function WorldState():void{
_worldStateList = new Object();
}
public function hasKeyValue(_arg1:String, _arg2:String):Boolean{
var _local3:Boolean;
var _local4:String;
if (_arg2.search(NOTPATTERN) != -1){
_local4 = _arg2.replace(NOTPATTERN, "");
_local3 = !(compareValue(_worldStateList[_arg1], _local4));
} else {
_local3 = compareValue(_worldStateList[_arg1], _arg2);
};
return (_local3);
}
public function hasKeyValues(_arg1:Array):Boolean{
var allValuesTrue:Boolean;
var worldStateData:WorldStateData;
var keyValueArray = _arg1;
allValuesTrue = true;
try {
for each (worldStateData in keyValueArray) {
if (!hasKeyValue(worldStateData.key, worldStateData.value)){
allValuesTrue = false;
};
};
} catch(e:Error) {
allValuesTrue = false;
DebugHandler.getInstance().displayError(e);
} finally {
var _local5:* = allValuesTrue;
//unresolved jump
1;
return (_local5);
};
}
public function clear():void{
_worldStateList = new Object();
}
public function addKeyValue(_arg1:String, _arg2:String):void{
var _local3:String;
if (compareValue(_worldStateList[_arg1], _arg2)){
return;
};
_local3 = _worldStateList[_arg1];
_worldStateList[_arg1] = _arg2;
dispatchEvent(new NewWorldStateEvent(_arg1, _arg2, _local3, NewWorldStateEvent.NEWWORLDSTATEEVENT));
}
public static function getInstance():WorldState{
if (_instance == null){
_instance = new (WorldState);
};
return (_instance);
}
private static function compareValue(_arg1:Object, _arg2:String):Boolean{
if (_arg2 == "*"){
return (true);
};
if (_arg1 == _arg2){
return (true);
};
if ((((_arg1 == null)) && ((_arg2 == "null")))){
return (true);
};
return (false);
}
}
}//package model
Section 70
//WorldStateData (model.WorldStateData)
package model {
public class WorldStateData {
private var _key:String;
private var _value:String;
public function WorldStateData(_arg1:String, _arg2:String){
_key = _arg1;
_value = _arg2;
}
public function get key():String{
return (_key);
}
public function get value():String{
return (_value);
}
}
}//package model
Section 71
//ZipManager (model.ZipManager)
package model {
import deng.fzip.*;
import flash.utils.*;
import view.debug.*;
public class ZipManager {
private var _zip:FZip;
public function ZipManager(_arg1:FZip){
_zip = _arg1;
}
public function getContentAsString(_arg1:String):String{
var zipFile:FZipFile;
var path = _arg1;
try {
zipFile = _zip.getFileByName(path);
if (zipFile == null){
throw (new Error((path + " not found in library")));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
} finally {
if (zipFile == null){
var _local5:* = "";
//unresolved jump
1;
return (_local5);
};
_local5 = zipFile.getContentAsString();
//unresolved jump
2;
return (_local5);
};
}
public function getContent(_arg1:String):ByteArray{
var zipFile:FZipFile;
var byteArray:ByteArray;
var path = _arg1;
try {
zipFile = _zip.getFileByName(path);
if (zipFile == null){
throw (new Error((path + " not found in library")));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
} finally {
if (zipFile == null){
byteArray = new ByteArray();
var _local5:* = byteArray;
//unresolved jump
1;
return (_local5);
};
_local5 = zipFile.content;
//unresolved jump
2;
return (_local5);
};
}
}
}//package model
Section 72
//AbstractTween (tweens.AbstractTween)
package tweens {
import flash.events.*;
public class AbstractTween extends EventDispatcher {
public function start():void{
}
}
}//package tweens
Section 73
//PanToPositionTween (tweens.PanToPositionTween)
package tweens {
import flash.events.*;
import flash.utils.*;
import controller.*;
public class PanToPositionTween extends AbstractTween {
private var _camera:Camera;
private var _panTimer:Timer;
private var _xPos:Number;
private var _xChangePerTick:Number;
private var _yPos:Number;
private var _tweenSpeed:Number;// = 15
public function PanToPositionTween(_arg1:Camera, _arg2:Number, _arg3:Number):void{
_tweenSpeed = 15;
super();
_xPos = _arg2;
_yPos = _arg3;
_camera = _arg1;
_panTimer = new Timer(30, _tweenSpeed);
_panTimer.addEventListener(TimerEvent.TIMER, onPanTimer, false, 0, true);
_panTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onPanTimerComplete, false, 0, true);
calculateCameraChangePerTick();
}
private function calculateCameraChangePerTick():void{
var _local1:Number;
_local1 = (_xPos - _camera.x);
_xChangePerTick = (_local1 / _tweenSpeed);
}
override public function start():void{
_panTimer.start();
}
private function onPanTimer(_arg1:TimerEvent):void{
_camera.x = (_camera.x + _xChangePerTick);
}
private function onPanTimerComplete(_arg1:TimerEvent):void{
dispatchEvent(new Event(PanTween.PANCOMPLETE));
}
}
}//package tweens
Section 74
//PanTween (tweens.PanTween)
package tweens {
import flash.events.*;
import flash.display.*;
import view.*;
import flash.utils.*;
import controller.*;
import flash.geom.*;
public class PanTween extends AbstractTween {
private var _camera:Camera;
private var _panTimer:Timer;
private var _xEnd:Number;
private var _xBegin:Number;
private var _tweenSpeed:int;// = 15
private var _panObject:Activator;
public static const PANCOMPLETE:String = "PANCOMPLETE";
public function PanTween(_arg1:Camera, _arg2:DisplayObject){
_tweenSpeed = 15;
super();
_camera = _arg1;
_panTimer = new Timer(30, _tweenSpeed);
_panTimer.addEventListener(TimerEvent.TIMER, onPanTimer, false, 0, true);
_panTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onPanTimerComplete, false, 0, true);
_panObject = (_arg2 as Activator);
calculateCameraChangePerTick();
}
private function calculateCameraChangePerTick():void{
var _local1:Point;
var _local2:Point;
var _local3:Point;
var _local4:Layer;
var _local5:Number;
_local1 = new Point((Main.mainMovie.stageWidth / 2), (Main.mainMovie.stageHeight / 2));
_local2 = new Point((_panObject.selectWidth / 2), (_panObject.selectHeight / 2));
_local3 = _panObject.selector.localToGlobal(_local2);
_local4 = (_panObject.parent.parent as Layer);
_local5 = (_local3.x - _local1.x);
_xBegin = _camera.x;
_xEnd = (_camera.x - (_local5 / (Number(_local4.scrollX) / 100)));
}
override public function start():void{
_panTimer.start();
}
private function onPanTimer(_arg1:TimerEvent):void{
var _local2:Number;
_local2 = (Number(_panTimer.currentCount) / Number(_tweenSpeed));
_camera.x = ((_xBegin * (1 - _local2)) + (_xEnd * _local2));
}
private function onPanTimerComplete(_arg1:TimerEvent):void{
dispatchEvent(new Event(PanTween.PANCOMPLETE));
}
}
}//package tweens
Section 75
//DebugHandler (view.debug.DebugHandler)
package view.debug {
public class DebugHandler {
private static var _instance:DebugHandler;
public function displayError(_arg1:Error):void{
}
public function displayText(_arg1:String):void{
}
public static function getInstance():DebugHandler{
if (_instance == null){
_instance = new (DebugHandler);
};
return (_instance);
}
}
}//package view.debug
Section 76
//AbstractGraphic (view.AbstractGraphic)
package view {
import flash.display.*;
public class AbstractGraphic extends Sprite {
protected var _sheet:String;
protected var _name:String;
protected var _initialXPos:int;
protected var _ready:Boolean;// = false
protected var _initialYPos:int;
protected var _depth:int;
public function AbstractGraphic(){
_ready = false;
super();
}
public function getName():String{
return (_name);
}
public function get initialXPos():int{
return (_initialXPos);
}
public function get sheet():String{
return (_sheet);
}
public function get initialYPos():int{
return (_initialYPos);
}
public function get ready():Boolean{
return (_ready);
}
public function get depth():int{
return (_depth);
}
}
}//package view
Section 77
//Activator (view.Activator)
package view {
import flash.events.*;
import flash.display.*;
import view.debug.*;
import controller.*;
public class Activator extends Sprite {
private var _activateHeight:int;
private var _selectHeight:int;
private var _selector:Selector;
private var _name:String;
private var _selectWidth:int;
private var _selectX:int;
private var _activateWidth:int;
private var _selectY:int;
private var _game:Game;
public function Activator(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int, _arg9:int, _arg10:Game){
x = (_arg6 * Game.gameScale);
y = (_arg7 * Game.gameScale);
_name = _arg1;
_selectX = ((_arg2 * Game.gameScale) - x);
_selectY = ((_arg3 * Game.gameScale) - y);
_selectWidth = (_arg4 * Game.gameScale);
_selectHeight = (_arg5 * Game.gameScale);
_activateWidth = (_arg8 * Game.gameScale);
_activateHeight = (_arg9 * Game.gameScale);
_game = _arg10;
drawActivationBox(0, 0, _activateWidth, _activateHeight);
this.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
}
public function getName():String{
return (_name);
}
private function removeSelectBox():void{
try {
if (_selector != null){
if (_selector.parent == this){
this.removeChild(_selector);
};
_selector.removeEventListener(MouseEvent.CLICK, onSelectBoxClick);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function get selectWidth():int{
return (_selectWidth);
}
private function onRollOutHandler(_arg1:MouseEvent):void{
if (Game.mode == GameMode.PAN){
removeSelectBox();
};
}
public function get selectHeight():int{
return (_selectHeight);
}
private function onRollOverHandler(_arg1:MouseEvent):void{
if (Game.mode == GameMode.PAN){
addSelectBox();
};
}
private function onSelectBoxClick(_arg1:Event):void{
var selector:Selector;
var event = _arg1;
try {
selector = (event.target as Selector);
if (selector != null){
_game.onSelectBoxClick(_name, this);
removeSelectBox();
} else {
throw (new Error("event object was not of class Selector"));
};
} catch(e:Error) {
};
}
private function addSelectBox():void{
var tempWidth:Number;
var tempHeight:Number;
var tempX:Number;
var tempY:Number;
try {
if (_selector == null){
tempWidth = _selectWidth;
tempHeight = _selectHeight;
tempX = _selectX;
tempY = _selectY;
if (tempWidth < 50){
tempWidth = 50;
tempX = (_selectX - 25);
};
if (tempHeight < 50){
tempHeight = 50;
tempY = (_selectY - 25);
};
_selector = new Selector(_selectX, _selectY, _selectWidth, _selectHeight);
_selector.scaleX = (Game.gameScale * 0.5);
_selector.scaleY = (Game.gameScale * 0.5);
};
this.addChild(_selector);
_selector.addEventListener("aClick", onSelectBoxClick, false, 0, true);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function get activateWidth():int{
return (_activateWidth);
}
public function get selector():Selector{
return (_selector);
}
private function drawActivationBox(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
this.graphics.beginFill(0, 0);
this.graphics.drawRect(_arg1, _arg2, _arg3, _arg4);
this.graphics.endFill();
}
public function get activateHeight():int{
return (_activateHeight);
}
}
}//package view
Section 78
//Animation (view.Animation)
package view {
import flash.events.*;
import model.*;
import view.debug.*;
import controller.*;
public class Animation extends AbstractGraphic {
private var _started:Boolean;// = false
private var _loops:Boolean;// = true
private var _animationArray:Array;
private var _looped:Boolean;// = false
private var _currentAnimDataNumber:int;// = 0
private var _ticksSinceImageSwitch:int;// = 0
private var _activeAnimData:AnimData;
private var _animName:String;
private static const IMAGEPATTERN:RegExp = /img/g;
private static const NUMBERPATTERN:RegExp = /[0-9]/g;
private static const SPACEPATTERN:RegExp = /\s/g;
private static const ANIMATIONPATTERN:RegExp = /animations/g;
private static const NAMEPATTERN:RegExp = /name:/;
public function Animation(_arg1:String, _arg2:String, _arg3:int, _arg4:String, _arg5:int, _arg6:int, _arg7:Boolean=true){
_currentAnimDataNumber = 0;
_ticksSinceImageSwitch = 0;
_loops = true;
_looped = false;
_started = false;
super();
_name = _arg1;
_depth = _arg3;
_sheet = _arg4;
_initialXPos = (_arg5 * Game.gameScale);
_initialYPos = (_arg6 * Game.gameScale);
_loops = _arg7;
this.x = _initialXPos;
this.y = _initialYPos;
_animationArray = new Array();
processAnimationInfo(_arg2);
}
public function pause():void{
this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
}
private function onRemovedFromStage(_arg1:Event):void{
var event = _arg1;
try {
this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
this.removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function processAnimationInfo(_arg1:String):void{
var rawArray:Array;
var animData:AnimData;
var imageDataArray:Array;
var image:Image;
var i:int;
var tempString:String;
var animationString = _arg1;
try {
rawArray = animationString.split(SPACEPATTERN);
i = 0;
for each (tempString in rawArray) {
if (tempString.search(ANIMATIONPATTERN) != -1){
imageDataArray = new Array();
image = getImage((tempString + ".png"));
imageDataArray.push(image);
} else {
if (tempString.search(IMAGEPATTERN) != -1){
imageDataArray = new Array();
image = getImage((tempString + ".png"));
imageDataArray.push(image);
} else {
if (tempString.length == 0){
imageDataArray = null;
} else {
if (tempString.search(NAMEPATTERN) != -1){
_animName = rawArray[(i + 1)];
} else {
if (imageDataArray != null){
if (tempString.search(NUMBERPATTERN) != -1){
imageDataArray.push(tempString);
if (imageDataArray.length == 4){
animData = new AnimData(imageDataArray[0], imageDataArray[1], imageDataArray[2], imageDataArray[3]);
_animationArray.push(animData);
};
};
};
};
};
};
};
i = (i + 1);
};
_looped = true;
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function resume():void{
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler, false, 0, true);
}
public function get animName():String{
return (_animName);
}
private function getImage(_arg1:String):Image{
var _local2:Image;
_local2 = ContentManager.getInstance().getImage(_arg1, 0, "", 0, 0);
_local2.addEventListener(Event.COMPLETE, checkIfShow, false, 0, true);
return (_local2);
}
public function playAnimation(_arg1:Event=null):void{
if (!_started){
_started = true;
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler, false, 0, true);
this.addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage, false, 0, true);
_activeAnimData = _animationArray[0];
_activeAnimData.image.x = (_activeAnimData.xPos * Game.gameScale);
_activeAnimData.image.y = (_activeAnimData.yPos * Game.gameScale);
addChild(_activeAnimData.image);
};
}
private function checkIfShow(_arg1:Event):void{
var _local2:Boolean;
var _local3:AnimData;
var _local4:Image;
if (_looped){
_local2 = true;
for each (_local3 in _animationArray) {
_local4 = (_local3.image as Image);
if (!_local4.ready){
_local2 = false;
break;
};
};
if (_local2){
_ready = true;
dispatchEvent(new Event(Event.COMPLETE));
_looped = false;
};
};
}
private function onEnterFrameHandler(_arg1:Event):void{
if (_activeAnimData.length == -1){
this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
} else {
_ticksSinceImageSwitch++;
};
if (_ticksSinceImageSwitch == _activeAnimData.length){
this.removeChild(_activeAnimData.image);
_ticksSinceImageSwitch = 0;
_currentAnimDataNumber++;
if (_currentAnimDataNumber < _animationArray.length){
_activeAnimData = _animationArray[_currentAnimDataNumber];
_activeAnimData.image.x = (_activeAnimData.xPos * Game.gameScale);
_activeAnimData.image.y = (_activeAnimData.yPos * Game.gameScale);
this.addChild(_activeAnimData.image);
} else {
if (_loops){
_currentAnimDataNumber = 0;
_activeAnimData = _animationArray[_currentAnimDataNumber];
_activeAnimData.image.x = (_activeAnimData.xPos * Game.gameScale);
_activeAnimData.image.y = (_activeAnimData.yPos * Game.gameScale);
this.addChild(_activeAnimData.image);
} else {
this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
};
};
};
}
}
}//package view
Section 79
//ChoiceText (view.ChoiceText)
package view {
import flash.events.*;
import model.*;
import controller.*;
public class ChoiceText extends TTText {
private var _choiceData:ChoiceData;
public static const choiceHeight:int = 40;
public function ChoiceText(_arg1:ChoiceData){
_choiceData = _arg1;
super(_choiceData.text);
mouseEnabled = true;
this.buttonMode = true;
this.addEventListener(Event.ADDED_TO_STAGE, onAdded, false, 0, true);
}
private function onRollOutHandler(_arg1:MouseEvent):void{
this.graphics.clear();
}
private function onRollOverHandler(_arg1:MouseEvent):void{
graphics.beginFill(16311448);
graphics.drawRect(Game.gameScale, -(Game.gameScale), (Main.mainMovie.stageWidth - (Game.gameScale * 2)), height);
}
private function onRemove(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, onAdded);
this.removeEventListener(Event.REMOVED_FROM_STAGE, onRemove);
this.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
}
private function onAdded(_arg1:Event):void{
this.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler, false, 0, true);
this.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler, false, 0, true);
this.addEventListener(Event.REMOVED_FROM_STAGE, onRemove, false, 0, true);
}
public function get choiceData():ChoiceData{
return (_choiceData);
}
}
}//package view
Section 80
//DialogueSlideView (view.DialogueSlideView)
package view {
import flash.events.*;
import flash.display.*;
import model.*;
import view.debug.*;
import customEvents.*;
public class DialogueSlideView extends Sprite {
private var _curDialogueSlideType:int;// = -1
private var _stinger:Array;
private var _textIsDisplayed:Boolean;// = false
private var _dialogueLayer:Sprite;
private var _linkBarSpacing:int;// = 30
private var _backgroundLayer:Sprite;
private var _textTT:Array;
private var _background:Array;
private var _sheetLayer:Sprite;
private var _iconLayer:Sprite;
private var _balloon:Array;
private static const BOTTOM_POS:int = 1;
private static const TOP_POS:int = 0;
private static const NPCTALK:int = 1;
private static const INNERDIALOGUE:int = 0;
private static const UNKNOWN:int = -1;
private static const PCTALK:int = 2;
public function DialogueSlideView(){
_curDialogueSlideType = UNKNOWN;
_textIsDisplayed = false;
_stinger = new Array();
_background = new Array();
_balloon = new Array();
_textTT = new Array();
_linkBarSpacing = 30;
super();
_sheetLayer = new Sprite();
_backgroundLayer = new Sprite();
_dialogueLayer = new Sprite();
_iconLayer = new Sprite();
this.addChild(_sheetLayer);
this.addChild(_backgroundLayer);
this.addChild(_dialogueLayer);
this.addChild(_iconLayer);
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
this.addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
public function setTextToDisplay(_arg1:String, _arg2:String):void{
var text = _arg1;
var position = _arg2;
try {
if (((!((curText == null))) && (!(_textIsDisplayed)))){
preProcessBeforeDisplay();
};
if (position == "bottom"){
_curDialogueSlideType = PCTALK;
} else {
_curDialogueSlideType = INNERDIALOGUE;
};
if (curText != null){
_dialogueLayer.removeChild(curText);
};
curText = new TTText(text);
_textIsDisplayed = false;
setVisible(position, true);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function showChoice(_arg1:Array):void{
var _local2:ChoiceText;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:ChoiceData;
_local3 = _dialogueLayer.numChildren;
_local4 = 10;
_curDialogueSlideType = PCTALK;
_local5 = 0;
while (_local5 < _arg1.length) {
_local7 = _arg1[_local5];
_local2 = new ChoiceText(_local7);
_local2.addEventListener(MouseEvent.CLICK, onChoiceClick, false, 0, true);
_dialogueLayer.addChild(_local2);
_local2.y = _local4;
_local4 = (_local4 + _local2.height);
_local5++;
};
_local6 = 0;
while (_local6 < _arg1.length) {
_local2 = (_dialogueLayer.getChildAt((_local3 + _local6)) as ChoiceText);
_local2.y = (_local2.y + ((Main.mainMovie.stageHeight - _local4) - _linkBarSpacing));
_local6++;
};
drawBackground(0xFFFFFF, ((Main.mainMovie.stageHeight - _local4) - _linkBarSpacing), _local4, true);
}
public function addGraphic(_arg1:AbstractGraphic):void{
var tempSheet:Sheet;
var sheetAbove:Sheet;
var children:int;
var sheet:Sheet;
var j:int;
var i:int;
var graphic = _arg1;
try {
children = _sheetLayer.numChildren;
j = 0;
while (j < children) {
tempSheet = (_sheetLayer.getChildAt(j) as Sheet);
if (sameDepth(tempSheet.depth, graphic.sheet)){
clearSheet(tempSheet.depth);
break;
};
j = (j + 1);
};
children = _sheetLayer.numChildren;
i = 0;
while (i < children) {
tempSheet = (_sheetLayer.getChildAt(i) as Sheet);
if (tempSheet != null){
if ((((sheetAbove == null)) && (isAbove(tempSheet.depth, graphic.sheet)))){
sheetAbove = tempSheet;
};
if (sheetAbove != null){
if (((isBelow(tempSheet.depth, sheetAbove.depth)) && (isBelow(graphic.sheet, tempSheet.depth)))){
sheetAbove = tempSheet;
};
};
};
i = (i + 1);
};
if (sheetAbove != null){
sheet = new Sheet(graphic.sheet);
sheet.addAbstractGraphic(graphic);
_sheetLayer.addChildAt(sheet, _sheetLayer.getChildIndex(sheetAbove));
} else {
sheet = new Sheet(graphic.sheet);
sheet.addAbstractGraphic(graphic);
_sheetLayer.addChild(sheet);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function onChoiceClick(_arg1:MouseEvent):void{
var _local2:ChoiceText;
_local2 = (_arg1.target as ChoiceText);
dispatchEvent(new ChoiceEvent(_local2.choiceData, ChoiceEvent.CHOICE, false, false));
}
public function clearSheet(_arg1:String):void{
var sheet:Sheet;
var sheetName = _arg1;
try {
sheet = findSheet(sheetName);
if (sheet != null){
if (sheet.parent == _sheetLayer){
DebugHandler.getInstance().displayText(("removing: " + sheetName));
_sheetLayer.removeChild(sheet);
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function set curText(_arg1:TTText):void{
if (_curDialogueSlideType == INNERDIALOGUE){
_textTT[TOP_POS] = _arg1;
} else {
if (_curDialogueSlideType == NPCTALK){
_textTT[TOP_POS] = _arg1;
} else {
if (_curDialogueSlideType == PCTALK){
_textTT[BOTTOM_POS] = _arg1;
} else {
throw (new Error("error setting text"));
};
};
};
}
private function set curBackground(_arg1:Sprite):void{
if (_curDialogueSlideType == INNERDIALOGUE){
_background[TOP_POS] = _arg1;
} else {
if (_curDialogueSlideType == NPCTALK){
_background[TOP_POS] = _arg1;
} else {
if (_curDialogueSlideType == PCTALK){
_background[BOTTOM_POS] = _arg1;
} else {
throw (new Error("error setting background"));
};
};
};
}
private function findSheet(_arg1:String):Sheet{
var _local2:Sheet;
var _local3:Number;
_local3 = 0;
while (_local3 < _sheetLayer.numChildren) {
_local2 = (_sheetLayer.getChildAt(_local3) as Sheet);
if (_local2.depth == _arg1){
return (_local2);
};
_local3++;
};
return (_local2);
}
private function isBelow(_arg1:String, _arg2:String):Boolean{
if (_arg1.localeCompare(_arg2) > 0){
return (true);
};
return (false);
}
public function pauseAnimation(_arg1:String):void{
var _local2:Sheet;
var _local3:Animation;
var _local4:int;
_local4 = 0;
while (_local4 < _sheetLayer.numChildren) {
_local2 = (_sheetLayer.getChildAt(_local4) as Sheet);
if ((_local2.child is Animation)){
_local3 = (_local2.child as Animation);
if (_local3.animName == _arg1){
DebugHandler.getInstance().displayText("found animation");
_local3.pause();
break;
};
};
_local4++;
};
}
public function fadeSheet(_arg1:String, _arg2:int, _arg3:int):void{
var sheet:Sheet;
var sheetName = _arg1;
var transparency = _arg2;
var frames = _arg3;
try {
sheet = findSheet(sheetName);
if (sheet != null){
sheet.fade(transparency, frames);
} else {
throw (new Error("did not receive a sheet"));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function preProcessBeforeDisplay():void{
var stingerHeight:int;
try {
if (_textIsDisplayed){
return;
};
displayTextTT();
if (curStinger != null){
if (_curDialogueSlideType == PCTALK){
stingerHeight = curStinger.getChildHeight();
curStinger.y = (((((Main.mainMovie.stageHeight - curText.height) - curText.getVerticalPadding()) - stingerHeight) + curStinger.initialYPos) - _linkBarSpacing);
} else {
curStinger.y = ((curText.height + curText.getVerticalPadding()) + curStinger.initialYPos);
};
};
if (curBalloon != null){
if (_curDialogueSlideType == PCTALK){
curBalloon.y = ((((Main.mainMovie.stageHeight - curText.height) - curBalloon.height) - 10) - _linkBarSpacing);
} else {
curBalloon.y = ((curText.height + curText.getVerticalPadding()) + curBalloon.initialYPos);
};
};
_textIsDisplayed = true;
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function addBalloon(_arg1:AbstractGraphic, _arg2:String):void{
var image = _arg1;
var position = _arg2;
try {
if (position == "bottom"){
_curDialogueSlideType = PCTALK;
} else {
if (_curDialogueSlideType != NPCTALK){
_curDialogueSlideType = INNERDIALOGUE;
};
};
if (curBalloon){
_dialogueLayer.removeChild(curBalloon);
};
curBalloon = image;
if (curStinger != null){
_dialogueLayer.addChildAt(image, _dialogueLayer.getChildIndex(curStinger));
} else {
_dialogueLayer.addChild(image);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function addStinger(_arg1:AbstractGraphic, _arg2:String):void{
var image = _arg1;
var position = _arg2;
try {
if (position == "bottom"){
_curDialogueSlideType = PCTALK;
} else {
_curDialogueSlideType = NPCTALK;
};
if (curStinger){
_dialogueLayer.removeChild(curStinger);
};
curStinger = Image(image);
_dialogueLayer.addChild(image);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function get curBackground():Sprite{
if (_curDialogueSlideType == INNERDIALOGUE){
return (_background[TOP_POS]);
};
if (_curDialogueSlideType == NPCTALK){
return (_background[TOP_POS]);
};
if (_curDialogueSlideType == PCTALK){
return (_background[BOTTOM_POS]);
};
return (null);
}
public function getTextLength():int{
var _local1:TTText;
_local1 = curText;
if (_local1 != null){
return (_local1.textF.length);
};
return (-1);
}
private function drawBackground(_arg1:uint, _arg2:int, _arg3:int, _arg4:Boolean):void{
var color = _arg1;
var yPos = _arg2;
var height = _arg3;
var stroke = _arg4;
try {
addBackground();
curBackground.graphics.clear();
curBackground.graphics.beginFill(color, 1);
if (stroke){
curBackground.graphics.lineStyle(4, 0, 1);
};
curBackground.graphics.drawRect(0, yPos, Main.mainMovie.stageWidth, height);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function set curBalloon(_arg1:AbstractGraphic):void{
if (_curDialogueSlideType == NPCTALK){
_balloon[TOP_POS] = _arg1;
} else {
if (_curDialogueSlideType == INNERDIALOGUE){
_balloon[TOP_POS] = _arg1;
} else {
if (_curDialogueSlideType == PCTALK){
_balloon[BOTTOM_POS] = _arg1;
} else {
throw (new Error("error setting balloon"));
};
};
};
}
private function get curText():TTText{
if (_curDialogueSlideType == INNERDIALOGUE){
return (_textTT[TOP_POS]);
};
if (_curDialogueSlideType == NPCTALK){
return (_textTT[TOP_POS]);
};
if (_curDialogueSlideType == PCTALK){
return (_textTT[BOTTOM_POS]);
};
return (null);
}
public function setVisible(_arg1:String, _arg2:Boolean):void{
var _local3:int;
_local3 = ((_arg1 == "bottom")) ? BOTTOM_POS : TOP_POS;
if (_background[_local3]){
(_background[_local3] as DisplayObject).visible = _arg2;
};
if (_stinger[_local3]){
(_stinger[_local3] as DisplayObject).visible = _arg2;
};
if (_balloon[_local3]){
(_balloon[_local3] as DisplayObject).visible = _arg2;
};
if (_textTT[_local3]){
(_textTT[_local3] as DisplayObject).visible = _arg2;
};
}
private function onAddedToStage(_arg1:Event):void{
}
private function isAbove(_arg1:String, _arg2:String):Boolean{
if (_arg1.localeCompare(_arg2) < 0){
return (true);
};
return (false);
}
public function addIcon(_arg1:Animation):void{
_iconLayer.addChild(_arg1);
}
private function addBackground():void{
if (curBackground == null){
curBackground = new Sprite();
_backgroundLayer.addChildAt(curBackground, 0);
};
}
public function panSheet(_arg1:String, _arg2:int, _arg3:int, _arg4:int):void{
var sheet:Sheet;
var sheetName = _arg1;
var xPos = _arg2;
var yPos = _arg3;
var frames = _arg4;
try {
sheet = findSheet(sheetName);
if (sheet != null){
sheet.panToPosition(xPos, yPos, frames);
} else {
throw (new Error("did not receive a sheet"));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function get curBalloon():AbstractGraphic{
if (_curDialogueSlideType == INNERDIALOGUE){
return (_balloon[TOP_POS]);
};
if (_curDialogueSlideType == NPCTALK){
return (_balloon[TOP_POS]);
};
if (_curDialogueSlideType == PCTALK){
return (_balloon[BOTTOM_POS]);
};
return (null);
}
private function displayTextTT():void{
try {
if (curText != null){
if (curText.textF.text != ""){
if (_curDialogueSlideType == PCTALK){
curText.y = ((Main.mainMovie.stageHeight - curText.height) - _linkBarSpacing);
drawBackground(0xFFFFFF, (curText.y - curText.getVerticalPadding()), (curText.height + curText.getVerticalPadding()), false);
} else {
if (_curDialogueSlideType == NPCTALK){
curText.y = curText.getVerticalPadding();
drawBackground(0xFFFFFF, 0, (curText.height + curText.getVerticalPadding()), false);
} else {
if (_curDialogueSlideType == INNERDIALOGUE){
curText.y = curText.getVerticalPadding();
drawBackground(15988394, 0, (curText.height + curText.getVerticalPadding()), false);
};
};
};
_dialogueLayer.addChild(curText);
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function set curStinger(_arg1:Image):void{
if (_curDialogueSlideType == NPCTALK){
_stinger[TOP_POS] = _arg1;
} else {
if (_curDialogueSlideType == PCTALK){
_stinger[BOTTOM_POS] = _arg1;
} else {
throw (new Error("error setting stinger"));
};
};
}
private function get curStinger():Image{
if (_curDialogueSlideType == INNERDIALOGUE){
return (null);
};
if (_curDialogueSlideType == NPCTALK){
return (_stinger[TOP_POS]);
};
if (_curDialogueSlideType == PCTALK){
return (_stinger[BOTTOM_POS]);
};
return (null);
}
private function onRemovedFromStage(_arg1:Event):void{
}
private function sameDepth(_arg1:String, _arg2:String):Boolean{
if (_arg1.localeCompare(_arg2) == 0){
return (true);
};
return (false);
}
}
}//package view
Section 81
//Image (view.Image)
package view {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import view.debug.*;
import controller.*;
public class Image extends AbstractGraphic {
private var _loader:Loader;
public function Image(_arg1:String, _arg2:ByteArray, _arg3:int, _arg4:String, _arg5:int, _arg6:int){
var name = _arg1;
var imageByteArray = _arg2;
var depth = _arg3;
var sheet = _arg4;
var xPos = _arg5;
var yPos = _arg6;
super();
try {
if (imageByteArray != null){
_loader = new Loader();
_loader.loadBytes(imageByteArray);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete, false, 2, true);
_sheet = sheet;
_name = name;
this.mouseChildren = false;
this.mouseEnabled = false;
this.addChild(_loader);
_depth = depth;
_initialXPos = (xPos * Game.gameScale);
_initialYPos = (yPos * Game.gameScale);
this.x = _initialXPos;
this.y = _initialYPos;
} else {
throw (new Error("zipFile didnt exist"));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function getChildHeight():Number{
if (_name.indexOf("Long") != -1){
return (85);
};
return (40);
}
private function onComplete(_arg1:Event):void{
var _local2:Bitmap;
_ready = true;
dispatchEvent(new Event(Event.COMPLETE));
_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onComplete);
_local2 = Bitmap(_loader.contentLoaderInfo.content);
_local2.smoothing = true;
_loader.scaleX = Game.gameScale;
_loader.scaleY = Game.gameScale;
}
}
}//package view
Section 82
//Layer (view.Layer)
package view {
import flash.display.*;
import view.debug.*;
import controller.*;
public class Layer extends Sprite {
private var _scrollX:int;
private var _drawStack:Array;
private var _spanWidth:int;
private var _defineSpan:int;
private var _activatorLayer:Sprite;
private var _name:String;
private var _removeStack:Array;
private var _spanHeight:int;
private var _depth:Number;
private var _offsetX:Number;
private var _scrollY:int;
private var _offsetY:Number;
private var _graphics:Array;
public function Layer(_arg1:String, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int, _arg6:int, _arg7:int, _arg8:int, _arg9:int){
_drawStack = new Array();
_removeStack = new Array();
_activatorLayer = new Sprite();
this.addChild(_activatorLayer);
_name = _arg1;
_depth = _arg2;
_offsetX = (_arg3 * Game.gameScale);
_offsetY = (_arg4 * Game.gameScale);
x = _offsetX;
y = _offsetY;
_scrollX = (_arg5 * Game.gameScale);
_scrollY = (_arg6 * Game.gameScale);
_defineSpan = _arg7;
_spanWidth = (_arg8 * Game.gameScale);
_spanHeight = (_arg9 * Game.gameScale);
_graphics = new Array();
}
private function removeActivator(_arg1:String):void{
var length:int;
var i:int;
var activator:Activator;
var activatorName = _arg1;
try {
length = _activatorLayer.numChildren;
while (i < length) {
activator = (_activatorLayer.getChildAt(i) as Activator);
if (activatorName == activator.getName()){
if (activator.parent == _activatorLayer){
_activatorLayer.removeChild(activator);
};
break;
};
i = (i + 1);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function getName():String{
return (_name);
}
public function addToDrawStack(_arg1:DisplayObject):void{
_drawStack.push(_arg1);
}
private function addGraphic(_arg1:AbstractGraphic):void{
var _local2:AbstractGraphic;
var _local3:AbstractGraphic;
var _local4:int;
var _local5:int;
_local4 = this.numChildren;
_local5 = 0;
while (_local5 < _local4) {
_local2 = (getChildAt(_local5) as AbstractGraphic);
if (_local2 != null){
if ((((_local3 == null)) && ((_arg1.depth > _local2.depth)))){
_local3 = _local2;
};
if (_local3 != null){
if ((((_local2.depth > _local3.depth)) && ((_arg1.depth > _local2.depth)))){
_local3 = _local2;
};
};
};
_local5++;
};
if (_local3 != null){
this.addChildAt(_arg1, getChildIndex(_local3));
_graphics.push(_arg1);
} else {
this.addChildAt(_arg1, this.getChildIndex(_activatorLayer));
_graphics.push(_arg1);
};
}
public function get spanHeight():int{
return (_spanHeight);
}
public function get xOffset():Number{
return (_offsetX);
}
public function get scrollX():int{
return (_scrollX);
}
public function get scrollY():int{
return (_scrollY);
}
private function addActivator(_arg1:Activator):void{
_activatorLayer.addChild(_arg1);
}
public function removeEligableContent():void{
var objectName:String;
try {
for each (objectName in _removeStack) {
removeGraphic(objectName);
removeActivator(objectName);
};
clearRemoveStack();
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function get yOffset():Number{
return (_offsetY);
}
public function hasContent(_arg1:String):Boolean{
var _local2:AbstractGraphic;
for each (_local2 in _graphics) {
if (_arg1 == _local2.getName()){
return (true);
};
};
return (false);
}
public function drawContent():void{
var object:DisplayObject;
try {
for each (object in _drawStack) {
if ((object is AbstractGraphic)){
addGraphic((object as AbstractGraphic));
} else {
if ((object is Activator)){
addActivator((object as Activator));
} else {
throw (new Error("content not graphic or activator"));
};
};
};
_drawStack = null;
_drawStack = new Array();
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function get spanWidth():int{
return (_spanWidth);
}
public function get depth():int{
return (_depth);
}
public function get defineSpan():int{
return (_defineSpan);
}
public function addToRemoveStack(_arg1:String):void{
_removeStack.push(_arg1);
}
public function clearRemoveStack():void{
_removeStack = null;
_removeStack = new Array();
}
private function removeGraphic(_arg1:String):void{
var graphicNameWithPng:String;
var graphic:AbstractGraphic;
var length:int;
var i:int;
var graphicName = _arg1;
try {
graphicNameWithPng = (graphicName + ".png");
length = _graphics.length;
while (i < length) {
graphic = _graphics[i];
if ((((graphicNameWithPng == graphic.getName())) || ((graphicName == graphic.getName())))){
if (graphic.parent == this){
this.removeChild(graphic);
_graphics.splice(i, 1);
i = (i - 1);
};
break;
};
i = (i + 1);
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
}
}//package view
Section 83
//LinkBar (view.LinkBar)
package view {
import flash.events.*;
import flash.display.*;
public class LinkBar extends MovieClip {
private var _ngageBtn:SimpleButton;
private var _dirkDaggerBtn:SimpleButton;
public var dirkDaggerBtn:DirkDaggerLinkButton;
public var ngageBtn:NGAGELinkButton;
public function LinkBar(){
_ngageBtn = ngageBtn;
_ngageBtn.addEventListener(MouseEvent.CLICK, onNGageClick, false, 0, true);
_dirkDaggerBtn = dirkDaggerBtn;
_dirkDaggerBtn.addEventListener(MouseEvent.CLICK, ondirkDaggerClick, false, 0, true);
}
private function ondirkDaggerClick(_arg1:MouseEvent):void{
Main.mainMovie.dirkDaggerBannerClick();
}
private function onNGageClick(_arg1:MouseEvent):void{
Main.mainMovie.ngageBannerClick();
}
}
}//package view
Section 84
//Location (view.Location)
package view {
import flash.events.*;
import flash.display.*;
import view.debug.*;
import controller.sound.*;
import controller.*;
public class Location extends Sprite {
private var zoomArea:Number;// = 0.2
private var _camera:Camera;
private var _speed:Number;// = 0.02
private var _layers:Array;
private var _defineSpanLayer:Layer;
public function Location(){
_speed = 0.02;
zoomArea = 0.2;
super();
_camera = new Camera();
_layers = new Array();
this.addEventListener(Event.ADDED_TO_STAGE, onAdded, false, 0, true);
this.addEventListener(Event.REMOVED_FROM_STAGE, onRemoved, false, 0, true);
}
public function get camera():Camera{
return (_camera);
}
private function xLayerPosOnScreen(_arg1:Layer, _arg2:Number):Number{
return ((((_arg2 - _arg1.xOffset) * 100) / Number(_arg1.scrollX)));
}
public function placeLayers():void{
var _local1:Layer;
var _local2:Number;
var _local3:Number;
var _local4:int;
_local2 = xScreenPosForLayer(_defineSpanLayer, _camera.x);
_local3 = yScreenPosForLayer(_defineSpanLayer, _camera.y);
if (_local2 > 0){
_camera.x = xLayerPosOnScreen(_defineSpanLayer, 0);
} else {
if ((_local2 + _defineSpanLayer.spanWidth) < Main.mainMovie.stageWidth){
_camera.x = xLayerPosOnScreen(_defineSpanLayer, (Main.mainMovie.stageWidth - _defineSpanLayer.spanWidth));
};
};
if (_defineSpanLayer.spanHeight > Main.mainMovie.stageHeight){
if (_local3 > 0){
_camera.y = yLayerPosOnScreen(_defineSpanLayer, 0);
} else {
if ((_local3 + _defineSpanLayer.spanHeight) < Main.mainMovie.stageHeight){
_camera.y = yLayerPosOnScreen(_defineSpanLayer, (Main.mainMovie.stageHeight - _defineSpanLayer.spanHeight));
};
};
};
_local4 = 0;
while (_local4 < _layers.length) {
_local1 = _layers[_local4];
_local1.x = xScreenPosForLayer(_local1, _camera.x);
if (_defineSpanLayer.spanHeight > Main.mainMovie.stageHeight){
_local1.y = yScreenPosForLayer(_local1, _camera.y);
};
_local4++;
};
}
private function yLayerPosOnScreen(_arg1:Layer, _arg2:Number):Number{
return ((((_arg2 - _arg1.yOffset) * 100) / Number(_arg1.scrollY)));
}
public function addLayer(_arg1:Layer):void{
var _local2:Layer;
var _local3:Layer;
var _local4:int;
if (_arg1.defineSpan == 1){
_defineSpanLayer = _arg1;
};
_local4 = 0;
while (_local4 < this.numChildren) {
_local2 = (getChildAt(_local4) as Layer);
if ((((_local3 == null)) && ((_arg1.depth > _local2.depth)))){
_local3 = _local2;
};
if (_local3 != null){
if ((((_local2.depth > _local3.depth)) && ((_arg1.depth > _local2.depth)))){
_local3 = _local2;
};
};
_local4++;
};
if (_local3 != null){
this.addChildAt(_arg1, getChildIndex(_local3));
_layers.push(_arg1);
} else {
this.addChild(_arg1);
_layers.push(_arg1);
};
}
public function playSound(_arg1:String):void{
SoundManager.getInstance().playSound(_arg1, true);
}
public function get layers():Array{
return (_layers);
}
public function updateLayers():void{
var _local1:Layer;
for each (_local1 in _layers) {
_local1.removeEligableContent();
_local1.drawContent();
};
}
private function onAdded(_arg1:Event):void{
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler, false, 0, true);
}
private function onRemoved(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, onAdded);
this.removeEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
}
public function getLayer(_arg1:String):Layer{
var _local2:int;
var _local3:Layer;
var _local4:int;
_local2 = _layers.length;
_local4 = 0;
while (_local4 < _local2) {
_local3 = _layers[_local4];
if (_arg1 == _local3.getName()){
return (_local3);
};
_local4++;
};
return (_local3);
}
private function yScreenPosForLayer(_arg1:Layer, _arg2:Number):Number{
return (((_arg2 * (Number(_arg1.scrollY) / 100)) + _arg1.yOffset));
}
private function xScreenPosForLayer(_arg1:Layer, _arg2:Number):Number{
return (((_arg2 * (Number(_arg1.scrollX) / 100)) + _arg1.xOffset));
}
private function onEnterFrameHandler(_arg1:Event):void{
var zoomWidthInPixels:Number;
var zoomHeightInPixels:Number;
var offSetX:Number;
var offSetY:Number;
var event = _arg1;
try {
if (Game.mode == GameMode.PAN){
zoomWidthInPixels = (stage.stageWidth * zoomArea);
zoomHeightInPixels = (stage.stageHeight * zoomArea);
if (_defineSpanLayer != null){
if (_camera.mode == CameraMode.FREE){
if ((stage.mouseX < zoomWidthInPixels)){
offSetX = (Math.abs((stage.mouseX - zoomWidthInPixels)) * _speed);
_camera.x = (_camera.x + offSetX);
} else {
if (stage.mouseX > (stage.stageWidth - zoomWidthInPixels)){
offSetX = (Math.abs(((stage.stageWidth - zoomWidthInPixels) - stage.mouseX)) * _speed);
_camera.x = (_camera.x - offSetX);
};
};
if (_defineSpanLayer.spanHeight > Main.mainMovie.stageHeight){
if ((stage.mouseY < zoomHeightInPixels)){
offSetY = (Math.abs((stage.mouseY - zoomHeightInPixels)) * _speed);
_camera.y = (_camera.y + offSetY);
} else {
if (stage.mouseY > (stage.stageHeight - zoomHeightInPixels)){
offSetY = (Math.abs(((stage.stageHeight - zoomHeightInPixels) - stage.mouseY)) * _speed);
_camera.y = (_camera.y - offSetY);
};
};
};
};
};
};
placeLayers();
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
}
}//package view
Section 85
//MainView (view.MainView)
package view {
import flash.display.*;
import view.debug.*;
import minigames.*;
public class MainView extends Sprite {
private var _minigameLayer:Sprite;
private var _currentLocation:Location;
private var _currentMinigame:AbstractMiniGame;
private var _dialogueLayer:Sprite;
private var _locationLayer:Sprite;
private var _currentDialogueSlideView:DialogueSlideView;
private static var _instance:MainView;
public function MainView(){
super();
try {
startup();
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function setBackgroundColor(_arg1:uint):void{
this.opaqueBackground = _arg1;
}
public function removeCurrentSlide():void{
try {
if (_currentDialogueSlideView != null){
if (_currentDialogueSlideView.parent == _dialogueLayer){
_dialogueLayer.removeChild(_currentDialogueSlideView);
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function clear():void{
while (this.numChildren > 0) {
this.removeChildAt(0);
};
_currentLocation = null;
_currentDialogueSlideView = null;
_locationLayer = null;
_dialogueLayer = null;
_minigameLayer = null;
_currentMinigame = null;
}
public function removeLocation():void{
try {
if (_currentLocation != null){
if (_currentLocation.parent == _locationLayer){
_locationLayer.removeChild(_currentLocation);
} else {
throw (new Error("location was not a child"));
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function newLocation(_arg1:Location):void{
var location = _arg1;
try {
if (location != null){
removeLocation();
_currentLocation = location;
_locationLayer.addChild(location);
} else {
throw (new Error("did not receive a location"));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function removeCurrentMiniGame():void{
try {
if (_currentMinigame != null){
if (_currentMinigame.parent == _minigameLayer){
_minigameLayer.removeChild(_currentMinigame);
} else {
throw (new Error("minigameLayer wasnt parent"));
};
} else {
throw (new Error("there was no minigame"));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function removeDialogue():void{
try {
if (_dialogueLayer != null){
if (_dialogueLayer.parent == this){
this.removeChild(_dialogueLayer);
_dialogueLayer = new Sprite();
this.addChildAt(_dialogueLayer, 1);
} else {
throw (new Error("dialogue layer had no parent"));
};
} else {
throw (new Error("dialogue layer did not exist"));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function startup():void{
_locationLayer = new Sprite();
_dialogueLayer = new Sprite();
_minigameLayer = new Sprite();
this.addChild(_locationLayer);
this.addChild(_dialogueLayer);
this.addChild(_minigameLayer);
}
public function removeLinkBar():void{
}
public function newMiniGame(_arg1:AbstractMiniGame):void{
var miniGame = _arg1;
try {
this.removeLocation();
this.removeDialogue();
_minigameLayer.addChild(miniGame);
_currentMinigame = miniGame;
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function newSlide(_arg1:DialogueSlideView):void{
var dialogueSlideView = _arg1;
try {
if (dialogueSlideView != null){
if (dialogueSlideView != _currentDialogueSlideView){
removeCurrentSlide();
_currentDialogueSlideView = dialogueSlideView;
_dialogueLayer.addChild(dialogueSlideView);
};
} else {
throw (new Error("dialogueslide was null"));
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public static function getInstance():MainView{
if (_instance == null){
_instance = new (MainView);
};
return (_instance);
}
}
}//package view
Section 86
//Selector (view.Selector)
package view {
import flash.events.*;
import flash.display.*;
import view.debug.*;
public class Selector extends Sprite {
private var _arrow2Animation:MovieClip;
private var _arrow3Animation:MovieClip;
private var _selectArea:Sprite;
private var extraArea:int;// = 50
private var _arrow0Animation:MovieClip;
private var _arrow1Animation:MovieClip;
private var _size:int;// = 1
public function Selector(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
_size = 1;
extraArea = 50;
super();
_selectArea = new Sprite();
this.addChild(_selectArea);
_selectArea.addEventListener(MouseEvent.CLICK, onClickHandler, false, 0, true);
_selectArea.buttonMode = true;
x = _arg1;
y = _arg2;
setArrows(_arg3, _arg4);
_selectArea.graphics.beginFill(0xFF00, 0);
_selectArea.graphics.drawEllipse((0 - (extraArea / 2)), (0 - (extraArea / 2)), (_arg3 + extraArea), (_arg4 + extraArea));
}
private function onClickHandler(_arg1:MouseEvent):void{
dispatchEvent(new Event("aClick"));
}
private function setArrows(_arg1:Number, _arg2:Number):void{
var selectWidth = _arg1;
var selectHeight = _arg2;
try {
_arrow0Animation = new Arrow0();
_arrow1Animation = new Arrow1();
_arrow2Animation = new Arrow2();
_arrow3Animation = new Arrow3();
_arrow1Animation.x = selectWidth;
_arrow2Animation.y = selectHeight;
_arrow3Animation.x = selectWidth;
_arrow3Animation.y = selectHeight;
this.addChild(_arrow0Animation);
this.addChild(_arrow1Animation);
this.addChild(_arrow2Animation);
this.addChild(_arrow3Animation);
_arrow0Animation.mouseEnabled = false;
_arrow1Animation.mouseEnabled = false;
_arrow2Animation.mouseEnabled = false;
_arrow3Animation.mouseEnabled = false;
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
}
}//package view
Section 87
//Sheet (view.Sheet)
package view {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import view.debug.*;
public class Sheet extends Sprite {
private var _child:AbstractGraphic;
private var _panPerTickX:Number;
private var _panPerTickY:Number;
private var _transPerTick:Number;
private var _depth:String;
public function Sheet(_arg1:String){
_depth = _arg1;
}
private function onPanTimerComplete(_arg1:TimerEvent):void{
var _local2:Timer;
_local2 = (_arg1.target as Timer);
_local2.removeEventListener(TimerEvent.TIMER, onPanTimer);
_local2.removeEventListener(TimerEvent.TIMER_COMPLETE, onPanTimerComplete);
}
private function onFadeTimer(_arg1:TimerEvent):void{
var event = _arg1;
try {
_child.alpha = (_child.alpha + _transPerTick);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function get child():AbstractGraphic{
return (_child);
}
public function panToPosition(_arg1:Number, _arg2:Number, _arg3:Number):void{
var ticks:Number;
var timer:Timer;
var xChange:Number;
var yChange:Number;
var xPos = _arg1;
var yPos = _arg2;
var frames = _arg3;
try {
if (this.numChildren == 1){
if (frames > 0){
ticks = (1000 / Main.mainMovie.frameRate);
timer = new Timer(ticks, frames);
timer.addEventListener(TimerEvent.TIMER, onPanTimer, false, 0, true);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, onPanTimerComplete, false, 0, true);
xChange = (xPos - _child.x);
yChange = (yPos - _child.y);
_panPerTickX = (xChange / frames);
_panPerTickY = (yChange / frames);
timer.start();
} else {
_child.x = xPos;
_child.y = yPos;
};
} else {
if (this.numChildren > 1){
throw (new Error("sheet had more than one child"));
} else {
if (this.numChildren < 1){
throw (new Error("tried to pan sheet with more than one child"));
};
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function onFadeTimerComplete(_arg1:TimerEvent):void{
var _local2:Timer;
_local2 = (_arg1.target as Timer);
_local2.removeEventListener(TimerEvent.TIMER, onFadeTimer);
_local2.removeEventListener(TimerEvent.TIMER_COMPLETE, onFadeTimerComplete);
}
public function fade(_arg1:Number, _arg2:Number):void{
var convertedTransparency:Number;
var ticks:Number;
var timer:Timer;
var transChange:Number;
var transparency = _arg1;
var frames = _arg2;
try {
if (this.numChildren == 1){
convertedTransparency = (transparency / 0xFF);
if (frames > 0){
ticks = (1000 / Main.mainMovie.frameRate);
timer = new Timer(ticks, frames);
timer.addEventListener(TimerEvent.TIMER, onFadeTimer, false, 0, true);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, onFadeTimerComplete, false, 0, true);
transChange = (convertedTransparency - _child.alpha);
_transPerTick = (transChange / frames);
timer.start();
} else {
_child.alpha = convertedTransparency;
};
} else {
if (this.numChildren > 1){
throw (new Error("sheet had more than one child"));
} else {
if (this.numChildren < 1){
throw (new Error("tried to pan sheet with more than one child"));
};
};
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function addAbstractGraphic(_arg1:AbstractGraphic):void{
var graphic = _arg1;
try {
_child = graphic;
this.addChild(graphic);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function get depth():String{
return (_depth);
}
private function onPanTimer(_arg1:TimerEvent):void{
var event = _arg1;
try {
_child.x = (_child.x + _panPerTickX);
_child.y = (_child.y + _panPerTickY);
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
}
}//package view
Section 88
//TTText (view.TTText)
package view {
import flash.display.*;
import model.*;
import view.debug.*;
import flash.text.*;
public class TTText extends Sprite {
protected var _textF:TextField;
public static const ITALIC:int = 0;
public static const BOLD:int = 1;
public function TTText(_arg1:String){
_textF = new TextField();
addChild(_textF);
_textF.embedFonts = true;
_textF.x = 10;
_textF.multiline = true;
_textF.mouseEnabled = false;
_textF.wordWrap = true;
_textF.width = (Main.mainMovie.stageWidth - 10);
_textF.antiAliasType = AntiAliasType.ADVANCED;
setTextStyle();
_textF.htmlText = _arg1;
_textF.height = ((_textF.numLines * 23) + getVerticalPadding());
}
protected function setTextStyle():void{
var formatManager:TextFormatManager;
var textFormat:TextFormat;
try {
formatManager = new TextFormatManager();
textFormat = formatManager.getDigStripNormal();
_textF.defaultTextFormat = textFormat;
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
public function getVerticalPadding():int{
return (10);
}
public function get textF():TextField{
return (_textF);
}
}
}//package view
Section 89
//Arrow0 (Arrow0)
package {
import flash.display.*;
public dynamic class Arrow0 extends MovieClip {
public var pic:MovieClip;
}
}//package
Section 90
//Arrow1 (Arrow1)
package {
import flash.display.*;
public dynamic class Arrow1 extends MovieClip {
}
}//package
Section 91
//Arrow2 (Arrow2)
package {
import flash.display.*;
public dynamic class Arrow2 extends MovieClip {
}
}//package
Section 92
//Arrow3 (Arrow3)
package {
import flash.display.*;
public dynamic class Arrow3 extends MovieClip {
}
}//package
Section 93
//Cab3 (Cab3)
package {
import flash.display.*;
public dynamic class Cab3 extends MovieClip {
}
}//package
Section 94
//CarChaseMC (CarChaseMC)
package {
import flash.display.*;
public dynamic class CarChaseMC extends MovieClip {
public var highCity:HighCity;
public var road:Road;
public var daphneCabAnim:MovieClip;
public var pcCar:Cab3;
public var lowCity:LowCity;
}
}//package
Section 95
//CrossHairDot (CrossHairDot)
package {
import flash.display.*;
public dynamic class CrossHairDot extends MovieClip {
}
}//package
Section 96
//DigitalStrip (DigitalStrip)
package {
import flash.text.*;
public dynamic class DigitalStrip extends Font {
}
}//package
Section 97
//DigitalStripBold (DigitalStripBold)
package {
import flash.text.*;
public dynamic class DigitalStripBold extends Font {
}
}//package
Section 98
//DigitalStripItalic (DigitalStripItalic)
package {
import flash.text.*;
public dynamic class DigitalStripItalic extends Font {
}
}//package
Section 99
//DirkDaggerLinkButton (DirkDaggerLinkButton)
package {
import flash.display.*;
public dynamic class DirkDaggerLinkButton extends SimpleButton {
}
}//package
Section 100
//HighCity (HighCity)
package {
import flash.display.*;
public dynamic class HighCity extends MovieClip {
}
}//package
Section 101
//Intro (Intro)
package {
import flash.events.*;
import flash.display.*;
public dynamic class Intro extends MovieClip {
public var loadingBackground:MovieClip;
public var loadingText:MovieClip;
public var playButton:SimpleButton;
public var readyToShowMenu:Boolean;
public var introBackground:MovieClip;
public function Intro(){
addFrameScript(0, frame1, 319, frame320, 360, frame361, 440, frame441);
}
function frame320(){
stop();
}
function frame441(){
stop();
}
function frame1(){
loadingBackground.mask = loadingText;
readyToShowMenu = false;
this.addEventListener(Event.ENTER_FRAME, handler, false, 0, true);
}
public function handler(_arg1:Event):void{
if (this.currentLabel == "finalLoadingFrame"){
if (readyToShowMenu){
gotoAndPlay("loadingComplete");
this.removeEventListener(Event.ENTER_FRAME, handler);
};
};
}
function frame361(){
if (((root) && ((root as Main)))){
(root as Main).playTheme();
playButton.addEventListener(MouseEvent.CLICK, onClick);
};
}
public function showPlayMenu():void{
readyToShowMenu = true;
}
public function onClick(_arg1:Event):void{
(root as Main).startGame();
}
}
}//package
Section 102
//KongregateExtras (KongregateExtras)
package {
import com.kongregate.as3.client.*;
public class KongregateExtras {
public static const cookie:String = "attentiveUser";
public static const on:Boolean = false;
private static const attentiveUser:String = "diner_fortune_8_empty_bowl.dia";
public static const finishedGame:String = "finishedGame";
public static function isAttentive(_arg1:String):void{
if (_arg1.search(attentiveUser) != -1){
sendScore(KongregateExtras.cookie, 1);
};
}
public static function sendScore(_arg1:String, _arg2:int):void{
if (on){
KongregateAPI.getInstance().stats.submit(_arg1, _arg2);
};
}
}
}//package
Section 103
//LowCity (LowCity)
package {
import flash.display.*;
public dynamic class LowCity extends MovieClip {
}
}//package
Section 104
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import model.*;
import deng.fzip.*;
import view.*;
import view.debug.*;
import flash.net.*;
import controller.sound.*;
import controller.*;
import com.kongregate.as3.client.*;
import flash.ui.*;
import com.kongregate.as3.client.events.*;
public class Main extends MovieClip {
private var _zipArchive:FZip;
private var _usingGoogleAnalytics:Boolean;// = false
private var _contentManager:ContentManager;
private var _kongregateLoaded:Boolean;// = false
private var _outroMovie:Outro;
private var _soundManager:SoundManager;
private var _linkBar:LinkBar;
private var _introMovie:Intro;
private var _game:Game;
public static var NGAGELINK:String = "http://www.n-gage.com/ngi/ngage/web/g0/en/showroom/gamedetail.205.GameDetail.html?cmp=BAC-SE-DirkDaggerFlashGame&ATTR=placement1";
public static var DIRKDAGGERLINK:String = "http://www.dirkdagger.com?cmp=BAC-SE-DirkDaggerFlashGame&ATTR=placement1";
private static var NGAGECONTEXTMENUCAPTION:String = "n-gage.com";
public static var mainMovie:Main;
private static var DIRKDAGGERLINKCONTEXTMENUCAPTION:String = "dirkdagger.com";
public function Main(){
_kongregateLoaded = false;
_usingGoogleAnalytics = false;
super();
addFrameScript(0, frame1);
stage.scaleMode = StageScaleMode.NO_SCALE;
setRightButtonView();
GoogleAnalyticsCaller.getInstance().on = _usingGoogleAnalytics;
if (KongregateExtras.on){
setupKongregate();
};
mainMovie = this;
GoogleAnalyticsCaller.getInstance().track(GoogleAnalyticsCaller.STARTEDLOADINGGAME);
load();
if (_linkBar != null){
if (_linkBar.parent == this){
this.removeChild(_linkBar);
};
};
_introMovie = new Intro();
this.addChild(_introMovie);
_introMovie.scaleX = (Game.gameScale * 0.5);
_introMovie.scaleY = (Game.gameScale * 0.5);
}
public function playTheme():void{
_soundManager.playSound("Theme_main.wav", false);
}
public function ngageBannerClick(_arg1:Event=null):void{
var _local2:URLRequest;
GoogleAnalyticsCaller.getInstance().track(GoogleAnalyticsCaller.NGAGEBANNERCLICK);
_local2 = new URLRequest(NGAGELINK);
navigateToURL(_local2);
}
private function setupKongregate():void{
var _local1:KongregateAPI;
_local1 = new KongregateAPI();
_local1.addEventListener(KongregateEvent.COMPLETE, onKongregateLoaded);
this.addChild(_local1);
}
public function dirkDaggerBannerClick(_arg1:Event=null):void{
var _local2:URLRequest;
GoogleAnalyticsCaller.getInstance().track(GoogleAnalyticsCaller.DIRKDAGGERBANNERCLICK);
_local2 = new URLRequest(DIRKDAGGERLINK);
navigateToURL(_local2);
}
function frame1(){
MochiBot.track(this, "d84a1333");
}
public function endGame():void{
var _local1:int;
GoogleAnalyticsCaller.getInstance().track(GoogleAnalyticsCaller.FINISHEDGAME);
SoundManager.getInstance().stopAllSound();
MainView.getInstance().clear();
this.removeChild(MainView.getInstance());
MainView.getInstance().startup();
MainView.getInstance().setBackgroundColor(0xFFFFFF);
WorldState.getInstance().clear();
KongregateExtras.sendScore(KongregateExtras.finishedGame, 1);
_game = null;
_outroMovie = new Outro();
_outroMovie.scaleX = (Game.gameScale * 0.5);
_outroMovie.scaleY = (Game.gameScale * 0.5);
if (this.contains(_linkBar)){
_local1 = this.getChildIndex(_linkBar);
this.addChildAt(_outroMovie, _local1);
} else {
this.addChild(_outroMovie);
};
}
private function setRightButtonView():void{
var _local1:ContextMenu;
_local1 = new ContextMenu();
_local1.hideBuiltInItems();
addCustomMenuItems(NGAGECONTEXTMENUCAPTION, _local1);
addCustomMenuItems(DIRKDAGGERLINKCONTEXTMENUCAPTION, _local1);
this.contextMenu = _local1;
}
private function zipProgress(_arg1:ProgressEvent):void{
var _local2:Number;
if (_introMovie){
_local2 = ((_arg1.bytesLoaded * 100) / _arg1.bytesTotal);
_introMovie.loadingBackground.loadingBar.x = (-230 + (_local2 * 2.1));
};
}
public function get stageWidth():int{
return (stage.stageWidth);
}
public function startGame(_arg1:Event=null):void{
if (_introMovie != null){
if (_introMovie.parent == this){
this.removeChild(_introMovie);
};
_introMovie = null;
};
if (_outroMovie != null){
if (_outroMovie.parent == this){
this.removeChild(_outroMovie);
};
_outroMovie = null;
};
MainView.getInstance().setBackgroundColor(0);
_game = new Game(this);
_linkBar = new LinkBar();
this.addChild(_linkBar);
_linkBar.y = (stageHeight - 30);
}
private function addCustomMenuItems(_arg1:String, _arg2:ContextMenu):void{
var _local3:ContextMenuItem;
_local3 = new ContextMenuItem(_arg1);
_arg2.customItems.push(_local3);
_local3.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
}
private function zipLoaded(_arg1:Event):void{
_contentManager = ContentManager.getInstance();
_contentManager.setContent(_zipArchive);
_soundManager = SoundManager.getInstance();
_soundManager.addEventListener(Event.COMPLETE, contentReady, false, 0, true);
}
private function contentReady(_arg1:Event):void{
if (_introMovie){
_introMovie.showPlayMenu();
} else {
startGame();
};
}
public function get stageHeight():int{
return (stage.stageHeight);
}
private function onKongregateLoaded(_arg1:KongregateEvent):void{
_kongregateLoaded = true;
}
public function get kongregateLoaded():Boolean{
return (_kongregateLoaded);
}
private function menuItemSelectHandler(_arg1:ContextMenuEvent):void{
var contextMenuItem:ContextMenuItem;
var event = _arg1;
try {
contextMenuItem = (event.target as ContextMenuItem);
switch (contextMenuItem.caption){
case NGAGECONTEXTMENUCAPTION:
ngageBannerClick();
break;
case DIRKDAGGERLINKCONTEXTMENUCAPTION:
dirkDaggerBannerClick();
break;
};
} catch(e:Error) {
DebugHandler.getInstance().displayError(e);
};
}
private function load():void{
var _local1:URLRequest;
_local1 = new URLRequest("http://www.jadestone.se/uploads/images/Mobile/Dirk_Dagger/contents.zip");
_zipArchive = new FZip();
_zipArchive.addEventListener(Event.COMPLETE, zipLoaded);
_zipArchive.addEventListener(ProgressEvent.PROGRESS, zipProgress);
_zipArchive.load(_local1);
}
public function get frameRate():Number{
return (stage.frameRate);
}
}
}//package
Section 105
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 106
//NGAGELinkButton (NGAGELinkButton)
package {
import flash.display.*;
public dynamic class NGAGELinkButton extends SimpleButton {
}
}//package
Section 107
//Outro (Outro)
package {
import flash.events.*;
import flash.display.*;
public dynamic class Outro extends MovieClip {
public var replayBtn:SimpleButton;
public var urlButton:SimpleButton;
public var ngageURL:SimpleButton;
public function Outro(){
addFrameScript(60, frame61, 109, frame110);
}
function frame110(){
stop();
replayBtn.addEventListener(MouseEvent.CLICK, (root as Main).startGame, false, 0, true);
}
function frame61(){
urlButton = ngageURL;
urlButton.useHandCursor = true;
urlButton.addEventListener(MouseEvent.CLICK, (root as Main).ngageBannerClick, false, 0, true);
}
}
}//package
Section 108
//PhotoFlash (PhotoFlash)
package {
import flash.display.*;
public dynamic class PhotoFlash extends MovieClip {
}
}//package
Section 109
//PhotoGameMC (PhotoGameMC)
package {
import flash.display.*;
public dynamic class PhotoGameMC extends MovieClip {
public var photoFlashMC:MovieClip;
public var backgroundMC:MovieClip;
public var crossHairDot:CrossHairDot;
}
}//package
Section 110
//Road (Road)
package {
import flash.display.*;
public dynamic class Road extends MovieClip {
}
}//package
Section 111
//Sights (Sights)
package {
import flash.display.*;
public dynamic class Sights extends MovieClip {
}
}//package
Section 112
//SkyLine (SkyLine)
package {
import flash.display.*;
public dynamic class SkyLine extends MovieClip {
}
}//package