Section 1
//JSON (com.adobe.serialization.json.JSON)
package com.adobe.serialization.json {
public class JSON {
public static function decode(_arg1:String){
var _local2:JSONDecoder = new JSONDecoder(_arg1);
return (_local2.getValue());
}
public static function encode(_arg1:Object):String{
var _local2:JSONEncoder = new JSONEncoder(_arg1);
return (_local2.getString());
}
}
}//package com.adobe.serialization.json
Section 2
//JSONDecoder (com.adobe.serialization.json.JSONDecoder)
package com.adobe.serialization.json {
public class JSONDecoder {
private var value;
private var tokenizer:JSONTokenizer;
private var token:JSONToken;
public function JSONDecoder(_arg1:String){
tokenizer = new JSONTokenizer(_arg1);
nextToken();
value = parseValue();
}
private function parseObject():Object{
var _local2:String;
var _local1:Object = new Object();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
while (true) {
if (token.type == JSONTokenType.STRING){
_local2 = String(token.value);
nextToken();
if (token.type == JSONTokenType.COLON){
nextToken();
_local1[_local2] = parseValue();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
if (token.type == JSONTokenType.COMMA){
nextToken();
} else {
tokenizer.parseError(("Expecting } or , but found " + token.value));
};
} else {
tokenizer.parseError(("Expecting : but found " + token.value));
};
} else {
tokenizer.parseError(("Expecting string but found " + token.value));
};
};
return (null);
}
private function parseValue():Object{
switch (token.type){
case JSONTokenType.LEFT_BRACE:
return (parseObject());
case JSONTokenType.LEFT_BRACKET:
return (parseArray());
case JSONTokenType.STRING:
case JSONTokenType.NUMBER:
case JSONTokenType.TRUE:
case JSONTokenType.FALSE:
case JSONTokenType.NULL:
return (token.value);
default:
tokenizer.parseError(("Unexpected " + token.value));
};
return (null);
}
private function nextToken():JSONToken{
return ((token = tokenizer.getNextToken()));
}
public function getValue(){
return (value);
}
private function parseArray():Array{
var _local1:Array = new Array();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
while (true) {
_local1.push(parseValue());
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
if (token.type == JSONTokenType.COMMA){
nextToken();
} else {
tokenizer.parseError(("Expecting ] or , but found " + token.value));
};
};
return (null);
}
}
}//package com.adobe.serialization.json
Section 3
//JSONEncoder (com.adobe.serialization.json.JSONEncoder)
package com.adobe.serialization.json {
import flash.utils.*;
public class JSONEncoder {
private var jsonString:String;
public function JSONEncoder(_arg1){
jsonString = convertToString(_arg1);
}
private function escapeString(_arg1:String):String{
var _local3:String;
var _local6:String;
var _local7:String;
var _local2 = "";
var _local4:Number = _arg1.length;
var _local5:int;
while (_local5 < _local4) {
_local3 = _arg1.charAt(_local5);
switch (_local3){
case "\"":
_local2 = (_local2 + "\\\"");
break;
case "\\":
_local2 = (_local2 + "\\\\");
break;
case "\b":
_local2 = (_local2 + "\\b");
break;
case "\f":
_local2 = (_local2 + "\\f");
break;
case "\n":
_local2 = (_local2 + "\\n");
break;
case "\r":
_local2 = (_local2 + "\\r");
break;
case "\t":
_local2 = (_local2 + "\\t");
break;
default:
if (_local3 < " "){
_local6 = _local3.charCodeAt(0).toString(16);
_local7 = ((_local6.length == 2)) ? "00" : "000";
_local2 = (_local2 + (("\\u" + _local7) + _local6));
} else {
_local2 = (_local2 + _local3);
};
};
_local5++;
};
return ((("\"" + _local2) + "\""));
}
private function arrayToString(_arg1:Array):String{
var _local2 = "";
var _local3:int;
while (_local3 < _arg1.length) {
if (_local2.length > 0){
_local2 = (_local2 + ",");
};
_local2 = (_local2 + convertToString(_arg1[_local3]));
_local3++;
};
return ((("[" + _local2) + "]"));
}
public function getString():String{
return (jsonString);
}
private function objectToString(_arg1:Object):String{
var value:Object;
var key:String;
var v:XML;
var o = _arg1;
var s = "";
var classInfo:XML = describeType(o);
if (classInfo.@name.toString() == "Object"){
for (key in o) {
value = o[key];
if ((value is Function)){
} else {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((escapeString(key) + ":") + convertToString(value)));
};
};
} else {
for each (v in classInfo..*.(((name() == "variable")) || ((name() == "accessor")))) {
if (((v.metadata) && ((v.metadata.(@name == "Transient").length() > 0)))){
} else {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((escapeString(v.@name.toString()) + ":") + convertToString(o[v.@name])));
};
};
};
return ((("{" + s) + "}"));
}
private function convertToString(_arg1):String{
if ((_arg1 is String)){
return (escapeString((_arg1 as String)));
};
if ((_arg1 is Number)){
return ((isFinite((_arg1 as Number))) ? _arg1.toString() : "null");
} else {
if ((_arg1 is Boolean)){
return ((_arg1) ? "true" : "false");
} else {
if ((_arg1 is Array)){
return (arrayToString((_arg1 as Array)));
};
if ((((_arg1 is Object)) && (!((_arg1 == null))))){
return (objectToString(_arg1));
};
};
};
return ("null");
}
}
}//package com.adobe.serialization.json
Section 4
//JSONParseError (com.adobe.serialization.json.JSONParseError)
package com.adobe.serialization.json {
public class JSONParseError extends Error {
private var _location:int;
private var _text:String;
public function JSONParseError(_arg1:String="", _arg2:int=0, _arg3:String=""){
super(_arg1);
_location = _arg2;
_text = _arg3;
}
public function get location():int{
return (_location);
}
public function get text():String{
return (_text);
}
}
}//package com.adobe.serialization.json
Section 5
//JSONToken (com.adobe.serialization.json.JSONToken)
package com.adobe.serialization.json {
public class JSONToken {
private var _value:Object;
private var _type:int;
public function JSONToken(_arg1:int=-1, _arg2:Object=null){
_type = _arg1;
_value = _arg2;
}
public function get value():Object{
return (_value);
}
public function get type():int{
return (_type);
}
public function set type(_arg1:int):void{
_type = _arg1;
}
public function set value(_arg1:Object):void{
_value = _arg1;
}
}
}//package com.adobe.serialization.json
Section 6
//JSONTokenizer (com.adobe.serialization.json.JSONTokenizer)
package com.adobe.serialization.json {
public class JSONTokenizer {
private var loc:int;
private var ch:String;
private var obj:Object;
private var jsonString:String;
public function JSONTokenizer(_arg1:String){
jsonString = _arg1;
loc = 0;
nextChar();
}
private function skipComments():void{
if (ch == "/"){
nextChar();
switch (ch){
case "/":
do {
nextChar();
} while (((!((ch == "\n"))) && (!((ch == "")))));
nextChar();
break;
case "*":
nextChar();
while (true) {
if (ch == "*"){
nextChar();
if (ch == "/"){
nextChar();
break;
};
} else {
nextChar();
};
if (ch == ""){
parseError("Multi-line comment not closed");
};
};
break;
default:
parseError((("Unexpected " + ch) + " encountered (expecting '/' or '*' )"));
};
};
}
private function isDigit(_arg1:String):Boolean{
return ((((_arg1 >= "0")) && ((_arg1 <= "9"))));
}
private function readString():JSONToken{
var _local3:String;
var _local4:int;
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.STRING;
var _local2 = "";
nextChar();
while (((!((ch == "\""))) && (!((ch == ""))))) {
if (ch == "\\"){
nextChar();
switch (ch){
case "\"":
_local2 = (_local2 + "\"");
break;
case "/":
_local2 = (_local2 + "/");
break;
case "\\":
_local2 = (_local2 + "\\");
break;
case "b":
_local2 = (_local2 + "\b");
break;
case "f":
_local2 = (_local2 + "\f");
break;
case "n":
_local2 = (_local2 + "\n");
break;
case "r":
_local2 = (_local2 + "\r");
break;
case "t":
_local2 = (_local2 + "\t");
break;
case "u":
_local3 = "";
_local4 = 0;
while (_local4 < 4) {
if (!isHexDigit(nextChar())){
parseError((" Excepted a hex digit, but found: " + ch));
};
_local3 = (_local3 + ch);
_local4++;
};
_local2 = (_local2 + String.fromCharCode(parseInt(_local3, 16)));
break;
default:
_local2 = (_local2 + ("\\" + ch));
};
} else {
_local2 = (_local2 + ch);
};
nextChar();
};
if (ch == ""){
parseError("Unterminated string literal");
};
nextChar();
_local1.value = _local2;
return (_local1);
}
private function nextChar():String{
return ((ch = jsonString.charAt(loc++)));
}
public function getNextToken():JSONToken{
var _local2:String;
var _local3:String;
var _local4:String;
var _local1:JSONToken = new JSONToken();
skipIgnored();
switch (ch){
case "{":
_local1.type = JSONTokenType.LEFT_BRACE;
_local1.value = "{";
nextChar();
break;
case "}":
_local1.type = JSONTokenType.RIGHT_BRACE;
_local1.value = "}";
nextChar();
break;
case "[":
_local1.type = JSONTokenType.LEFT_BRACKET;
_local1.value = "[";
nextChar();
break;
case "]":
_local1.type = JSONTokenType.RIGHT_BRACKET;
_local1.value = "]";
nextChar();
break;
case ",":
_local1.type = JSONTokenType.COMMA;
_local1.value = ",";
nextChar();
break;
case ":":
_local1.type = JSONTokenType.COLON;
_local1.value = ":";
nextChar();
break;
case "t":
_local2 = ((("t" + nextChar()) + nextChar()) + nextChar());
if (_local2 == "true"){
_local1.type = JSONTokenType.TRUE;
_local1.value = true;
nextChar();
} else {
parseError(("Expecting 'true' but found " + _local2));
};
break;
case "f":
_local3 = (((("f" + nextChar()) + nextChar()) + nextChar()) + nextChar());
if (_local3 == "false"){
_local1.type = JSONTokenType.FALSE;
_local1.value = false;
nextChar();
} else {
parseError(("Expecting 'false' but found " + _local3));
};
break;
case "n":
_local4 = ((("n" + nextChar()) + nextChar()) + nextChar());
if (_local4 == "null"){
_local1.type = JSONTokenType.NULL;
_local1.value = null;
nextChar();
} else {
parseError(("Expecting 'null' but found " + _local4));
};
break;
case "\"":
_local1 = readString();
break;
default:
if (((isDigit(ch)) || ((ch == "-")))){
_local1 = readNumber();
} else {
if (ch == ""){
return (null);
};
parseError((("Unexpected " + ch) + " encountered"));
};
};
return (_local1);
}
private function skipWhite():void{
while (isWhiteSpace(ch)) {
nextChar();
};
}
public function parseError(_arg1:String):void{
throw (new JSONParseError(_arg1, loc, jsonString));
}
private function isWhiteSpace(_arg1:String):Boolean{
return ((((((_arg1 == " ")) || ((_arg1 == "\t")))) || ((_arg1 == "\n"))));
}
private function skipIgnored():void{
skipWhite();
skipComments();
skipWhite();
}
private function isHexDigit(_arg1:String):Boolean{
var _local2:String = _arg1.toUpperCase();
return (((isDigit(_arg1)) || ((((_local2 >= "A")) && ((_local2 <= "F"))))));
}
private function readNumber():JSONToken{
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.NUMBER;
var _local2 = "";
if (ch == "-"){
_local2 = (_local2 + "-");
nextChar();
};
if (!isDigit(ch)){
parseError("Expecting a digit");
};
if (ch == "0"){
_local2 = (_local2 + ch);
nextChar();
if (isDigit(ch)){
parseError("A digit cannot immediately follow 0");
};
} else {
while (isDigit(ch)) {
_local2 = (_local2 + ch);
nextChar();
};
};
if (ch == "."){
_local2 = (_local2 + ".");
nextChar();
if (!isDigit(ch)){
parseError("Expecting a digit");
};
while (isDigit(ch)) {
_local2 = (_local2 + ch);
nextChar();
};
};
if ((((ch == "e")) || ((ch == "E")))){
_local2 = (_local2 + "e");
nextChar();
if ((((ch == "+")) || ((ch == "-")))){
_local2 = (_local2 + ch);
nextChar();
};
if (!isDigit(ch)){
parseError("Scientific notation number needs exponent value");
};
while (isDigit(ch)) {
_local2 = (_local2 + ch);
nextChar();
};
};
var _local3:Number = Number(_local2);
if (((isFinite(_local3)) && (!(isNaN(_local3))))){
_local1.value = _local3;
return (_local1);
};
parseError((("Number " + _local3) + " is not valid!"));
return (null);
}
}
}//package com.adobe.serialization.json
Section 7
//JSONTokenType (com.adobe.serialization.json.JSONTokenType)
package com.adobe.serialization.json {
public class JSONTokenType {
public static const NUMBER:int = 11;
public static const FALSE:int = 8;
public static const RIGHT_BRACKET:int = 4;
public static const NULL:int = 9;
public static const TRUE:int = 7;
public static const RIGHT_BRACE:int = 2;
public static const UNKNOWN:int = -1;
public static const COMMA:int = 0;
public static const LEFT_BRACKET:int = 3;
public static const STRING:int = 10;
public static const LEFT_BRACE:int = 1;
public static const COLON:int = 6;
}
}//package com.adobe.serialization.json
Section 8
//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 9
//AnalyticsServiceShadow (com.kongregate.as3.client.services.AnalyticsServiceShadow)
package com.kongregate.as3.client.services {
public class AnalyticsServiceShadow extends AbstractShadowService implements IAnalyticsServices {
public function setCommonProperties(_arg1:Object):void{
alert("analytics", "setCommonProperties");
}
public function startPurchase(_arg1, _arg2:Object):void{
alert("analytics", "startPurchase");
}
public function addEvent(_arg1:String, _arg2:Object):void{
alert("analytics", "addEvent");
}
public function finishPurchase(_arg1:String, _arg2:String, _arg3:Object):void{
alert("analytics", "finishPurchase");
}
public function setFilterType(_arg1:String):void{
alert("analytics", "setFilterType");
}
public function getAutoLongLongProperty(_arg1:String):Number{
alert("analytics", "getAutoLongLongProperty");
return (0);
}
public function getAutoStringProperty(_arg1:String):String{
alert("analytics", "getAutoStringProperty");
return (null);
}
public function getAutoPropertiesJSON():String{
alert("analytics", "getAutoPropertiesJSON()");
return (null);
}
public function addFilterType(_arg1:String):void{
alert("analytics", "addFilterType");
}
public function getAutoDoubleProperty(_arg1:String):Number{
alert("analytics", "getAutoDoubleProperty");
return (0);
}
public function getAutoBoolProperty(_arg1:String):Boolean{
alert("analytics", "getAutoBoolProperty");
return (false);
}
public function setAutomaticVariablesListener(_arg1:Function):void{
alert("analytics", "setAutomaticVariablesListener");
}
public function updateCommonProperties():void{
alert("analytics", "updateCommonProperties");
}
public function setCommonPropsCallback(_arg1:Function):void{
alert("analytics", "setCommonPropsCallback");
}
public function getAutoLongProperty(_arg1:String):Number{
alert("analytics", "getAutoLongProperty");
return (0);
}
public function start():void{
alert("analytics", "start");
}
public function getAutoUTCProperty(_arg1:String):String{
alert("analytics", "getAutoUTCProperty");
return (null);
}
public function getAutoIntProperty(_arg1:String):int{
alert("analytics", "getAutoIntProperty");
return (0);
}
}
}//package com.kongregate.as3.client.services
Section 10
//ChatServiceShadow (com.kongregate.as3.client.services.ChatServiceShadow)
package com.kongregate.as3.client.services {
public class ChatServiceShadow extends AbstractShadowService implements IChatServices {
public function removeCanvasObject(_arg1:String):void{
alert("IChatServices", "removeCanvasObject", arguments);
}
public function positionCanvasObject(_arg1:String, _arg2:Object):void{
alert("IChatServices", "positionCanvasObject", arguments);
}
public function displayCanvasText(_arg1:String, _arg2:String, _arg3:Object, _arg4:Object):void{
alert("IChatServices", "displayCanvasText", arguments);
}
public function displayCanvasImage(_arg1:String, _arg2:String, _arg3:Object):void{
alert("IChatServices", "displayCanvasImage", arguments);
}
public function displayMessage(_arg1:String, _arg2:String):void{
alert("IChatServices", "displayMessage", arguments);
}
public function showSignInBox():void{
alert("IChatServices", "showSignInBox", arguments);
}
public function drawCanvasObject(_arg1:String, _arg2:Array):void{
alert("IChatServices", "drawCanvasObject", arguments);
}
public function showTab(_arg1:String, _arg2:String, _arg3:Object=null):void{
alert("IChatServices", "showTab", arguments);
}
public function clearMessages():void{
alert("IChatServices", "clearMessages", arguments);
}
public function closeTab():void{
alert("IChatServices", "closeTab", arguments);
}
public function getCanvasSize():Object{
alert("IChatServices", "getCanvasSize", arguments);
return ({width:0, height:0});
}
}
}//package com.kongregate.as3.client.services
Section 11
//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 setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
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});
}
}
}//package com.kongregate.as3.client.services
Section 12
//IAnalyticsServices (com.kongregate.as3.client.services.IAnalyticsServices)
package com.kongregate.as3.client.services {
public interface IAnalyticsServices {
function setCommonProperties(_arg1:Object):void;
function setAutomaticVariablesListener(_arg1:Function):void;
function startPurchase(_arg1, _arg2:Object):void;
function getAutoBoolProperty(_arg1:String):Boolean;
function updateCommonProperties():void;
function setCommonPropsCallback(_arg1:Function):void;
function start():void;
function getAutoDoubleProperty(_arg1:String):Number;
function getAutoPropertiesJSON():String;
function getAutoLongLongProperty(_arg1:String):Number;
function addFilterType(_arg1:String):void;
function getAutoUTCProperty(_arg1:String):String;
function getAutoLongProperty(_arg1:String):Number;
function addEvent(_arg1:String, _arg2:Object):void;
function getAutoStringProperty(_arg1:String):String;
function finishPurchase(_arg1:String, _arg2:String, _arg3:Object):void;
function getAutoIntProperty(_arg1:String):int;
}
}//package com.kongregate.as3.client.services
Section 13
//IChatServices (com.kongregate.as3.client.services.IChatServices)
package com.kongregate.as3.client.services {
public interface IChatServices {
function positionCanvasObject(_arg1:String, _arg2:Object):void;
function displayCanvasImage(_arg1:String, _arg2:String, _arg3:Object):void;
function removeCanvasObject(_arg1:String):void;
function displayMessage(_arg1:String, _arg2:String):void;
function displayCanvasText(_arg1:String, _arg2:String, _arg3:Object, _arg4:Object):void;
function showSignInBox():void;
function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void;
function getCanvasSize():Object;
function showTab(_arg1:String, _arg2:String, _arg3:Object=null):void;
function clearMessages():void;
function drawCanvasObject(_arg1:String, _arg2:Array):void;
function closeTab():void;
}
}//package com.kongregate.as3.client.services
Section 14
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function submit(_arg1:Number, _arg2:String=null):void;
function setMode(_arg1:String):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 15
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function setConnection(_arg1):void;
function getPlayerInfo(_arg1:Function):void;
function setMultiplayerConnection(_arg1:String, _arg2, _arg3:Object):void;
function connect(_arg1:Number=-1):Boolean;
function connectExternal(_arg1:Object=null):Boolean;
}
}//package com.kongregate.as3.client.services
Section 16
//IMicrotransactionServices (com.kongregate.as3.client.services.IMicrotransactionServices)
package com.kongregate.as3.client.services {
public interface IMicrotransactionServices {
function requestItemList(_arg1:Array, _arg2:Function):void;
function purchaseItemsRemote(_arg1:String, _arg2:Function):void;
function purchaseItems(_arg1:Array, _arg2:Function):void;
function showIncentivizedAd():void;
function requestUserItemList(_arg1:String, _arg2:Function):void;
function showKredPurchaseDialog(_arg1:String):void;
function initializeIncentivizedAds():void;
function useItemInstance(_arg1:Number, _arg2:Function):void;
}
}//package com.kongregate.as3.client.services
Section 17
//ISharedContentServices (com.kongregate.as3.client.services.ISharedContentServices)
package com.kongregate.as3.client.services {
public interface ISharedContentServices {
function browse(_arg1:String, _arg2:String=null, _arg3:String=null):void;
function addLoadListener(_arg1:String, _arg2:Function):void;
function save(_arg1:String, _arg2:String, _arg3:Function, _arg4=null, _arg5:String=null):void;
}
}//package com.kongregate.as3.client.services
Section 18
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function gameStart():void;
function submitArray(_arg1:Array):void;
function gameMute():void;
function gameUnmute():void;
function gamePause():void;
function submit(_arg1:String, _arg2:Number):void;
function gameEnd():void;
function gameUnpause():void;
function gameBreak():void;
}
}//package com.kongregate.as3.client.services
Section 19
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getSessionStamp():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 20
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
import com.kongregate.as3.common.util.*;
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function setConnection(_arg1):void{
Log.info("Connection set");
}
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function getGameAuthToken():String{
return ("");
}
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());
}
public function isGuest():Boolean{
return (true);
}
public function getUsername():String{
return ("Guest");
}
public function setMultiplayerConnection(_arg1:String, _arg2, _arg3:Object):void{
alert("Multiplayer connection set", "setMultiplayerConnection");
}
public function showSignInBox():void{
alert("KongregateServices", "showSignInBox");
}
public function connectExternal(_arg1:Object=null):Boolean{
alert("IKongregateServices", "connectExternal", arguments);
return (true);
}
}
}//package com.kongregate.as3.client.services
Section 21
//MicrotransactionServiceShadow (com.kongregate.as3.client.services.MicrotransactionServiceShadow)
package com.kongregate.as3.client.services {
public class MicrotransactionServiceShadow extends AbstractShadowService implements IMicrotransactionServices {
public function requestItemList(_arg1:Array, _arg2:Function):void{
alert("IMicrotransactionServices", "requestItemList", arguments);
}
public function purchaseItemsRemote(_arg1:String, _arg2:Function):void{
alert("IMicrotransactionServices", "purchaseItemsRemote", arguments);
}
public function showIncentivizedAd():void{
alert("IMicrotransactionServices", "showIncentivizedAd", arguments);
}
public function showKredPurchaseDialog(_arg1:String):void{
alert("IMicrotransactionServices", "showKredPurchaseDialog", arguments);
}
public function requestUserItemList(_arg1:String, _arg2:Function):void{
alert("IMicrotransactionServices", "requestUserItemList", arguments);
}
public function useItemInstance(_arg1:Number, _arg2:Function):void{
alert("IMicrotransactionServices", "useItemInstance", arguments);
}
public function initializeIncentivizedAds():void{
alert("IMicrotransactionServices", "initializeIncentivizedAds", arguments);
}
public function purchaseItems(_arg1:Array, _arg2:Function):void{
alert("IMicrotransactionServices", "purchaseItems", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 22
//SharedContentServiceShadow (com.kongregate.as3.client.services.SharedContentServiceShadow)
package com.kongregate.as3.client.services {
import com.kongregate.as3.common.util.*;
public class SharedContentServiceShadow extends AbstractShadowService implements ISharedContentServices {
public function addLoadListener(_arg1:String, _arg2:Function):void{
Log.info(("SharedContentService#addLoadListener - contentType:" + _arg1));
}
public function save(_arg1:String, _arg2:String, _arg3:Function, _arg4=null, _arg5:String=null):void{
Log.info(((((("SharedContentService#save - contentType:" + _arg1) + ", value:") + _arg2) + ", label:") + _arg5));
_arg3({success:false});
}
public function browse(_arg1:String, _arg2:String=null, _arg3:String=null):void{
Log.info(((((("SharedContentService#browse - contentType:" + _arg1) + ", sortOrder: ") + _arg2.toString()) + ", label: ") + _arg3));
}
}
}//package com.kongregate.as3.client.services
Section 23
//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 gameMute():void{
alert("IStatServices", "gameMute", arguments);
}
public function gamePause():void{
alert("IStatServices", "gamePause", arguments);
}
public function gameUnmute():void{
alert("IStatServices", "gameUnmute", arguments);
}
public function gameEnd():void{
alert("IStatServices", "gameEnd", arguments);
}
public function gameStart():void{
alert("IStatServices", "gameStart", arguments);
}
public function gameUnpause():void{
alert("IStatServices", "gameUnpause", arguments);
}
public function gameBreak():void{
alert("IStatServices", "gameBreak", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 24
//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 getSessionStamp():String{
alert("UserService", "getSessionStamp");
return ("");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMod:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 25
//APIBootstrapShadow (com.kongregate.as3.client.APIBootstrapShadow)
package com.kongregate.as3.client {
import com.kongregate.as3.client.services.*;
import flash.events.*;
import flash.display.*;
import flash.system.*;
public class APIBootstrapShadow extends Sprite implements IGameServices {
private static var _statServices:StatServiceShadow;
private static var _analyticsServices:IAnalyticsServices;
private static var _userServices:IUserServices;
private static var _scoreServices:IHighScoreServices;
private static var _sharedContentServices:ISharedContentServices;
private static var _chatServices:IChatServices;
private static var _kongregateServices:IKongregateServices;
private static var _mtxServices:IMicrotransactionServices;
public function APIBootstrapShadow(){
Security.allowDomain("*");
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get scores():IHighScoreServices{
return (_scoreServices);
}
public function get loaded():Boolean{
return (true);
}
public function get stats():IStatServices{
return (_statServices);
}
public function get connected():Boolean{
return (true);
}
public function get analytics():IAnalyticsServices{
return (_analyticsServices);
}
public function init(_arg1:Event=null, _arg2:Stage=null):void{
trace("Alert: Kongregate API shadow services loaded due to local testing. API will load when the game is uploaded.");
_kongregateServices = new KongregateServiceShadow();
_scoreServices = new HighScoreServiceShadow();
_sharedContentServices = new SharedContentServiceShadow();
_statServices = new StatServiceShadow();
_userServices = new UserServiceShadow();
_mtxServices = new MicrotransactionServiceShadow();
_chatServices = new ChatServiceShadow();
_analyticsServices = new AnalyticsServiceShadow();
}
public function get mtx():IMicrotransactionServices{
return (_mtxServices);
}
public function get user():IUserServices{
return (_userServices);
}
public function get sharedContent():ISharedContentServices{
return (_sharedContentServices);
}
public function get chat():IChatServices{
return (_chatServices);
}
public function get events():Class{
return (null);
}
public function get services():IKongregateServices{
return (_kongregateServices);
}
}
}//package com.kongregate.as3.client
Section 26
//IGameServices (com.kongregate.as3.client.IGameServices)
package com.kongregate.as3.client {
import com.kongregate.as3.client.services.*;
public interface IGameServices {
function get scores():IHighScoreServices;
function get loaded():Boolean;
function get connected():Boolean;
function get user():IUserServices;
function get stats():IStatServices;
}
}//package com.kongregate.as3.client
Section 27
//LogEvent (com.kongregate.as3.common.events.LogEvent)
package com.kongregate.as3.common.events {
import flash.events.*;
public class LogEvent extends Event {
private var _text;
public static const WARN:String = "Warn";
public static const ERROR:String = "Error";
public static const SPAM:String = "Spam";
public static const INFO:String = "Info";
public static const DEBUG:String = "Debug";
public static const TYPE_ALL:String = "All";
public function LogEvent(_arg1:String, _arg2){
super(_arg1);
_text = _arg2;
}
public function get text(){
return (_text);
}
}
}//package com.kongregate.as3.common.events
Section 28
//Log (com.kongregate.as3.common.util.Log)
package com.kongregate.as3.common.util {
import flash.events.*;
import com.kongregate.as3.common.events.*;
import com.adobe.serialization.json.*;
import flash.system.*;
import flash.external.*;
public class Log extends EventDispatcher {
private var mLogName:String;// = ""
private var mInitialized:Boolean;// = false
private var mLogLevel:Number;// = 0
private var mLogEntries:Array;
public static const MAX_LOG_ENTRIES:Number = 250;
private static var gInstance:Log;
public static var LEVELS_MAP:Object = {Error:1, Warn:2, Info:3, Debug:4, Spam:5};
public static var LEVELS:Array = ["Error", "Warn", "Info", "Debug", "Spam"];
private function getName():String{
return (mLogName);
}
public function getOSInfo():String{
return (((((((("OS: " + Capabilities.os) + ", ") + Capabilities.screenResolutionX) + "x") + Capabilities.screenResolutionY) + ", current version: ") + Capabilities.version));
}
private function isDebug():Boolean{
return ((mLogLevel >= 4));
}
private function setName(_arg1:String):void{
mLogName = _arg1;
}
public function addLogEntry(_arg1:String, _arg2):void{
if ((_arg2 is String)){
if (mLogEntries.length > MAX_LOG_ENTRIES){
mLogEntries.splice(0, 1);
};
mLogEntries.push({type:_arg1, time:getTimestamp(), text:sanitize(_arg2)});
};
}
private function init():void{
if (!mInitialized){
mInitialized = true;
this.addEventListener(LogEvent.DEBUG, onDebugMessage);
this.addEventListener(LogEvent.INFO, onInfoMessage);
this.addEventListener(LogEvent.WARN, onWarnMessage);
this.addEventListener(LogEvent.ERROR, onErrorMessage);
this.addEventListener(LogEvent.SPAM, onSpamMessage);
mLogEntries = new Array();
Log.info("kongregate log initialized.");
Log.info(getOSInfo());
};
}
private function onWarnMessage(_arg1:LogEvent):void{
logToFirebug("warn", _arg1.text);
}
private function log(_arg1:int, _arg2):void{
var _local3:String;
if (_arg1 < LEVELS_MAP.Spam){
addLogEntry(_local3, _arg2);
};
if (mLogLevel >= _arg1){
_local3 = getLevelString(_arg1);
dispatch(_local3, _arg2);
trace(((("[" + _local3) + "] ") + _arg2));
};
}
private function onDebugMessage(_arg1:LogEvent):void{
logToFirebug("log", _arg1.text);
}
private function onErrorMessage(_arg1:LogEvent):void{
var _local2:* = _arg1.text;
if ((_local2 is Error)){
_local2 = ((_local2.message + "\n") + _local2.getStackTrace());
logToFirebug("warn", _local2);
} else {
_local2 = _arg1.text;
logToFirebug("warn", _local2);
};
}
private function onSpamMessage(_arg1:LogEvent):void{
logToFirebug("log", _arg1.text);
}
private function getTimestamp():String{
var _local1:Date = new Date();
return (_local1.toString().split("GMT")[0]);
}
private function onInfoMessage(_arg1:LogEvent):void{
logToFirebug("info", _arg1.text);
}
public function setLogLevel(_arg1:Number):void{
mLogLevel = _arg1;
}
private function getErrorReport():Array{
return (mLogEntries);
}
private function sanitize(_arg1:String):String{
return (_arg1.split("<").join("<"));
}
private function logToFirebug(_arg1:String, _arg2):void{
var json:String;
var f:String;
var type = _arg1;
var text = _arg2;
var oldMarshalExceptions:Boolean = ExternalInterface.marshallExceptions;
ExternalInterface.marshallExceptions = true;
try {
if ((text is String)){
text = text.replace(/\\/g, "\\\\");
} else {
try {
json = escape(JSON.encode(text));
f = "function(s,l){try{console[l].apply(console, [JSON.parse(unescape(s))]);}catch(e){}}";
ExternalInterface.call(f, json, type);
//unresolved jump
0;
return;
} catch(e:Error) {
ExternalInterface.call("window.console.error", "Error while logging: failed to convert to JSON");
};
};
ExternalInterface.call(("window.console." + type), text);
} catch(e:Error) {
} finally {
ExternalInterface.marshallExceptions = oldMarshalExceptions;
};
}
private function dispatch(_arg1:String, _arg2):Boolean{
if (((!((mLogName == null))) && ((mLogName.length > 0)))){
if ((_arg2 is String)){
_arg2 = ((("[" + mLogName) + "] ") + _arg2);
};
};
var _local3:Boolean = dispatchEvent(new LogEvent(_arg1, _arg2));
return (_local3);
}
private function getLevelString(_arg1:int):String{
return (LEVELS[(_arg1 - 1)]);
}
public static function getName():String{
return (getInstance().getName());
}
public static function hasEventListener(_arg1:String):Boolean{
return (getInstance().hasEventListener(_arg1));
}
public static function warn(_arg1):void{
getInstance().log(2, _arg1);
}
public static function error(_arg1):void{
getInstance().log(1, _arg1);
}
public static function isDebug():Boolean{
return (getInstance().isDebug());
}
public static function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
getInstance().removeEventListener(_arg1, _arg2, _arg3);
}
public static function getInstance():Log{
if (gInstance == null){
gInstance = new (Log);
gInstance.init();
};
return (gInstance);
}
public static function spam(_arg1):void{
getInstance().log(5, _arg1);
}
public static function debug(_arg1):void{
getInstance().log(4, _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
getInstance().addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public static function getLogLevel():Number{
return (getInstance().mLogLevel);
}
public static function init():void{
getInstance().init();
}
public static function setName(_arg1:String):void{
getInstance().setName(_arg1);
}
public static function getErrorReport():Array{
return (getInstance().getErrorReport());
}
public static function setLogLevel(_arg1:Number):void{
getInstance().setLogLevel(_arg1);
}
public static function info(_arg1):void{
getInstance().log(3, _arg1);
}
}
}//package com.kongregate.as3.common.util
Section 29
//as3_api_local (as3_api_local)
package {
import com.kongregate.as3.client.*;
import flash.system.*;
public class as3_api_local extends APIBootstrapShadow {
public function as3_api_local(){
Security.allowDomain("*");
super();
}
}
}//package