initial commit, kind of working.
This commit is contained in:
@@ -0,0 +1,225 @@
|
||||
package Playtomic
|
||||
{
|
||||
public final class Data
|
||||
{
|
||||
|
||||
private static var SECTION:String;
|
||||
|
||||
private static var VIEWS:String;
|
||||
|
||||
private static var PLAYS:String;
|
||||
|
||||
private static var PLAYTIME:String;
|
||||
|
||||
private static var CUSTOMMETRIC:String;
|
||||
|
||||
private static var LEVELCOUNTERMETRIC:String;
|
||||
|
||||
private static var LEVELRANGEDMETRIC:String;
|
||||
|
||||
private static var LEVELAVERAGEMETRIC:String;
|
||||
|
||||
public function Data()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
internal static function Initialise(param1:String) : void
|
||||
{
|
||||
SECTION = Encode.MD5("data-" + param1);
|
||||
VIEWS = Encode.MD5("data-views-" + param1);
|
||||
PLAYS = Encode.MD5("data-plays-" + param1);
|
||||
PLAYTIME = Encode.MD5("data-playtime-" + param1);
|
||||
CUSTOMMETRIC = Encode.MD5("data-custommetric-" + param1);
|
||||
LEVELCOUNTERMETRIC = Encode.MD5("data-levelcountermetric-" + param1);
|
||||
LEVELRANGEDMETRIC = Encode.MD5("data-levelrangedmetric-" + param1);
|
||||
LEVELAVERAGEMETRIC = Encode.MD5("data-levelaveragemetric-" + param1);
|
||||
}
|
||||
|
||||
public static function Views(param1:Function, param2:Object = null) : void
|
||||
{
|
||||
General(VIEWS,"Views",param1,param2);
|
||||
}
|
||||
|
||||
public static function Plays(param1:Function, param2:Object = null) : void
|
||||
{
|
||||
General(PLAYS,"Plays",param1,param2);
|
||||
}
|
||||
|
||||
public static function PlayTime(param1:Function, param2:Object = null) : void
|
||||
{
|
||||
General(PLAYTIME,"Playtime",param1,param2);
|
||||
}
|
||||
|
||||
private static function General(param1:String, param2:String, param3:Function, param4:Object) : void
|
||||
{
|
||||
if(param4 == null)
|
||||
{
|
||||
param4 = new Object();
|
||||
}
|
||||
var _loc5_:Object = new Object();
|
||||
_loc5_["type"] = param2;
|
||||
_loc5_["day"] = param4.hasOwnProperty("day") ? param4["day"] : 0;
|
||||
_loc5_["month"] = param4.hasOwnProperty("month") ? param4["month"] : 0;
|
||||
_loc5_["year"] = param4.hasOwnProperty("year") ? param4["year"] : 0;
|
||||
Request.Load(SECTION,param1,GeneralComplete,param3,_loc5_);
|
||||
}
|
||||
|
||||
private static function GeneralComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:Object = new Object();
|
||||
if(param4.Success == 1)
|
||||
{
|
||||
_loc5_["Name"] = param2["type"];
|
||||
_loc5_["Day"] = param2["day"];
|
||||
_loc5_["Month"] = param2["month"];
|
||||
_loc5_["Year"] = param2["year"];
|
||||
_loc5_["Value"] = int(param3["value"]);
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
}
|
||||
|
||||
public static function CustomMetric(param1:String, param2:Function, param3:Object = null) : void
|
||||
{
|
||||
if(param3 == null)
|
||||
{
|
||||
param3 = new Object();
|
||||
}
|
||||
var _loc4_:Object = new Object();
|
||||
_loc4_["metric"] = param1;
|
||||
_loc4_["day"] = param3.hasOwnProperty("day") ? param3["day"] : 0;
|
||||
_loc4_["month"] = param3.hasOwnProperty("month") ? param3["month"] : 0;
|
||||
_loc4_["year"] = param3.hasOwnProperty("year") ? param3["year"] : 0;
|
||||
Request.Load(SECTION,CUSTOMMETRIC,CustomMetricComplete,param2,_loc4_);
|
||||
}
|
||||
|
||||
private static function CustomMetricComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:Object = new Object();
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc5_["Name"] = "CustomMetric";
|
||||
_loc5_["Metric"] = param2["metric"];
|
||||
_loc5_["Day"] = param2["day"];
|
||||
_loc5_["Month"] = param2["month"];
|
||||
_loc5_["Year"] = param2["year"];
|
||||
_loc5_["Value"] = int(param3["value"]);
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
}
|
||||
|
||||
public static function LevelCounterMetric(param1:String, param2:*, param3:Function, param4:Object = null) : void
|
||||
{
|
||||
LevelMetric(LEVELCOUNTERMETRIC,param1,param2,LevelCounterMetricComplete,param3,param4);
|
||||
}
|
||||
|
||||
private static function LevelCounterMetricComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:Object = new Object();
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc5_["Name"] = "LevelAverageMetric";
|
||||
_loc5_["Metric"] = param2["metric"];
|
||||
_loc5_["Level"] = param2["level"];
|
||||
_loc5_["Day"] = param2["day"];
|
||||
_loc5_["Month"] = param2["month"];
|
||||
_loc5_["Year"] = param2["year"];
|
||||
_loc5_["Value"] = int(param3["value"]);
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
}
|
||||
|
||||
public static function LevelRangedMetric(param1:String, param2:*, param3:Function, param4:Object = null) : void
|
||||
{
|
||||
LevelMetric(LEVELRANGEDMETRIC,param1,param2,LevelRangedMetricComplete,param3,param4);
|
||||
}
|
||||
|
||||
private static function LevelRangedMetricComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
var _loc6_:Array = null;
|
||||
var _loc7_:XMLList = null;
|
||||
var _loc8_:XML = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:Object = new Object();
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc5_["Name"] = "LevelAverageMetric";
|
||||
_loc5_["Metric"] = param2["metric"];
|
||||
_loc5_["Level"] = param2["level"];
|
||||
_loc5_["Day"] = param2["day"];
|
||||
_loc5_["Month"] = param2["month"];
|
||||
_loc5_["Year"] = param2["year"];
|
||||
_loc6_ = new Array();
|
||||
_loc7_ = param3["value"];
|
||||
for each(_loc8_ in _loc7_)
|
||||
{
|
||||
_loc6_.push({
|
||||
"TrackValue":int(_loc8_.@trackvalue),
|
||||
"Value":int(_loc8_)
|
||||
});
|
||||
}
|
||||
_loc5_["Values"] = _loc6_;
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
}
|
||||
|
||||
public static function LevelAverageMetric(param1:String, param2:*, param3:Function, param4:Object = null) : void
|
||||
{
|
||||
LevelMetric(LEVELAVERAGEMETRIC,param1,param2,LevelAverageMetricComplete,param3,param4);
|
||||
}
|
||||
|
||||
private static function LevelAverageMetricComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:Object = new Object();
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc5_["Name"] = "LevelAverageMetric";
|
||||
_loc5_["Metric"] = param2["metric"];
|
||||
_loc5_["Level"] = param2["level"];
|
||||
_loc5_["Day"] = param2["day"];
|
||||
_loc5_["Month"] = param2["month"];
|
||||
_loc5_["Year"] = param2["year"];
|
||||
_loc5_["Min"] = int(param3["min"]);
|
||||
_loc5_["Max"] = int(param3["max"]);
|
||||
_loc5_["Average"] = int(param3["average"]);
|
||||
_loc5_["Total"] = Number(param3["total"]);
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
}
|
||||
|
||||
private static function LevelMetric(param1:String, param2:String, param3:String, param4:Function, param5:Function, param6:Object) : void
|
||||
{
|
||||
if(param6 == null)
|
||||
{
|
||||
param6 = new Object();
|
||||
}
|
||||
var _loc7_:Object = new Object();
|
||||
_loc7_["metric"] = param2;
|
||||
_loc7_["level"] = param3;
|
||||
_loc7_["day"] = param6.hasOwnProperty("day") ? param6["day"] : 0;
|
||||
_loc7_["month"] = param6.hasOwnProperty("month") ? param6["month"] : 0;
|
||||
_loc7_["year"] = param6.hasOwnProperty("year") ? param6["year"] : 0;
|
||||
Request.Load(SECTION,param1,param4,param5,_loc7_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,429 @@
|
||||
package Playtomic
|
||||
{
|
||||
import flash.display.BitmapData;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
internal final class Encode
|
||||
{
|
||||
|
||||
private static var crcTable:Array;
|
||||
|
||||
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
private static const decodeChars:Array = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1];
|
||||
|
||||
private static var crcTableComputed:Boolean = false;
|
||||
|
||||
private static var hex_chr:String = "0123456789abcdef";
|
||||
|
||||
public function Encode()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
internal static function Base64(param1:ByteArray) : String
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc5_:uint = 0;
|
||||
var _loc6_:uint = 0;
|
||||
var _loc7_:uint = 0;
|
||||
var _loc2_:String = "";
|
||||
var _loc4_:Array = new Array(4);
|
||||
param1.position = 0;
|
||||
while(param1.bytesAvailable > 0)
|
||||
{
|
||||
_loc3_ = new Array();
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < 3 && param1.bytesAvailable > 0)
|
||||
{
|
||||
_loc3_[_loc5_] = param1.readUnsignedByte();
|
||||
_loc5_++;
|
||||
}
|
||||
_loc4_[0] = (_loc3_[0] & 0xFC) >> 2;
|
||||
_loc4_[1] = (_loc3_[0] & 3) << 4 | _loc3_[1] >> 4;
|
||||
_loc4_[2] = (_loc3_[1] & 0x0F) << 2 | _loc3_[2] >> 6;
|
||||
_loc4_[3] = _loc3_[2] & 0x3F;
|
||||
_loc6_ = _loc3_.length;
|
||||
while(_loc6_ < 3)
|
||||
{
|
||||
_loc4_[_loc6_ + 1] = 64;
|
||||
_loc6_++;
|
||||
}
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc4_.length)
|
||||
{
|
||||
_loc2_ += BASE64_CHARS.charAt(_loc4_[_loc7_]);
|
||||
_loc7_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
internal static function Base64Decode(param1:String) : ByteArray
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:* = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:ByteArray = null;
|
||||
_loc7_ = param1.length;
|
||||
_loc6_ = 0;
|
||||
_loc8_ = new ByteArray();
|
||||
loop0:
|
||||
while(_loc6_ < _loc7_)
|
||||
{
|
||||
do
|
||||
{
|
||||
_loc2_ = int(decodeChars[param1.charCodeAt(_loc6_++) & 0xFF]);
|
||||
}
|
||||
while(_loc6_ < _loc7_ && _loc2_ == -1);
|
||||
if(_loc2_ == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
do
|
||||
{
|
||||
_loc3_ = int(decodeChars[param1.charCodeAt(_loc6_++) & 0xFF]);
|
||||
}
|
||||
while(_loc6_ < _loc7_ && _loc3_ == -1);
|
||||
if(_loc3_ == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc8_.writeByte(_loc2_ << 2 | (_loc3_ & 0x30) >> 4);
|
||||
while(true)
|
||||
{
|
||||
_loc4_ = param1.charCodeAt(_loc6_++) & 0xFF;
|
||||
if(_loc4_ == 61)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc4_ = int(decodeChars[_loc4_]);
|
||||
if(!(_loc6_ < _loc7_ && _loc4_ == -1))
|
||||
{
|
||||
if(_loc4_ == -1)
|
||||
{
|
||||
break loop0;
|
||||
}
|
||||
_loc8_.writeByte((_loc3_ & 0x0F) << 4 | (_loc4_ & 0x3C) >> 2);
|
||||
while(true)
|
||||
{
|
||||
_loc5_ = param1.charCodeAt(_loc6_++) & 0xFF;
|
||||
if(_loc5_ == 61)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc5_ = int(decodeChars[_loc5_]);
|
||||
if(!(_loc6_ < _loc7_ && _loc5_ == -1))
|
||||
{
|
||||
if(_loc5_ == -1)
|
||||
{
|
||||
break loop0;
|
||||
}
|
||||
_loc8_.writeByte((_loc4_ & 3) << 6 | _loc5_);
|
||||
continue loop0;
|
||||
}
|
||||
}
|
||||
return _loc8_;
|
||||
}
|
||||
}
|
||||
return _loc8_;
|
||||
}
|
||||
return _loc8_;
|
||||
}
|
||||
|
||||
internal static function PNG(param1:BitmapData) : ByteArray
|
||||
{
|
||||
var _loc5_:uint = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc2_:ByteArray = new ByteArray();
|
||||
_loc2_.writeUnsignedInt(2303741511);
|
||||
_loc2_.writeUnsignedInt(218765834);
|
||||
var _loc3_:ByteArray = new ByteArray();
|
||||
_loc3_.writeInt(param1.width);
|
||||
_loc3_.writeInt(param1.height);
|
||||
_loc3_.writeUnsignedInt(134610944);
|
||||
_loc3_.writeByte(0);
|
||||
writeChunk(_loc2_,1229472850,_loc3_);
|
||||
var _loc4_:ByteArray = new ByteArray();
|
||||
var _loc7_:int = 0;
|
||||
while(_loc7_ < param1.height)
|
||||
{
|
||||
_loc4_.writeByte(0);
|
||||
if(!param1.transparent)
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < param1.width)
|
||||
{
|
||||
_loc5_ = param1.getPixel(_loc6_,_loc7_);
|
||||
_loc4_.writeUnsignedInt(uint((_loc5_ & 0xFFFFFF) << 8 | 0xFF));
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < param1.width)
|
||||
{
|
||||
_loc5_ = param1.getPixel32(_loc6_,_loc7_);
|
||||
_loc4_.writeUnsignedInt(uint((_loc5_ & 0xFFFFFF) << 8 | _loc5_ >>> 24));
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
_loc4_.compress();
|
||||
writeChunk(_loc2_,1229209940,_loc4_);
|
||||
writeChunk(_loc2_,1229278788,null);
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private static function writeChunk(param1:ByteArray, param2:uint, param3:ByteArray) : void
|
||||
{
|
||||
var _loc8_:uint = 0;
|
||||
var _loc9_:uint = 0;
|
||||
var _loc10_:uint = 0;
|
||||
if(!crcTableComputed)
|
||||
{
|
||||
crcTableComputed = true;
|
||||
crcTable = [];
|
||||
_loc9_ = 0;
|
||||
while(_loc9_ < 256)
|
||||
{
|
||||
_loc8_ = _loc9_;
|
||||
_loc10_ = 0;
|
||||
while(_loc10_ < 8)
|
||||
{
|
||||
if(_loc8_ & 1)
|
||||
{
|
||||
_loc8_ = uint(uint(3988292384) ^ uint(_loc8_ >>> 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc8_ = uint(_loc8_ >>> 1);
|
||||
}
|
||||
_loc10_++;
|
||||
}
|
||||
crcTable[_loc9_] = _loc8_;
|
||||
_loc9_++;
|
||||
}
|
||||
}
|
||||
var _loc4_:uint = 0;
|
||||
if(param3 != null)
|
||||
{
|
||||
_loc4_ = param3.length;
|
||||
}
|
||||
param1.writeUnsignedInt(_loc4_);
|
||||
var _loc5_:uint = param1.position;
|
||||
param1.writeUnsignedInt(param2);
|
||||
if(param3 != null)
|
||||
{
|
||||
param1.writeBytes(param3);
|
||||
}
|
||||
var _loc6_:uint = param1.position;
|
||||
param1.position = _loc5_;
|
||||
_loc8_ = 4294967295;
|
||||
var _loc7_:int = 0;
|
||||
while(_loc7_ < _loc6_ - _loc5_)
|
||||
{
|
||||
_loc8_ = uint(crcTable[(_loc8_ ^ param1.readUnsignedByte()) & uint(255)] ^ uint(_loc8_ >>> 8));
|
||||
_loc7_++;
|
||||
}
|
||||
_loc8_ = uint(_loc8_ ^ uint(4294967295));
|
||||
param1.position = _loc6_;
|
||||
param1.writeUnsignedInt(_loc8_);
|
||||
}
|
||||
|
||||
private static function bitOR(param1:Number, param2:Number) : Number
|
||||
{
|
||||
var _loc3_:Number = param1 & 1 | param2 & 1;
|
||||
var _loc4_:Number = param1 >>> 1 | param2 >>> 1;
|
||||
return _loc4_ << 1 | _loc3_;
|
||||
}
|
||||
|
||||
private static function bitXOR(param1:Number, param2:Number) : Number
|
||||
{
|
||||
var _loc3_:Number = param1 & 1 ^ param2 & 1;
|
||||
var _loc4_:Number = param1 >>> 1 ^ param2 >>> 1;
|
||||
return _loc4_ << 1 | _loc3_;
|
||||
}
|
||||
|
||||
private static function bitAND(param1:Number, param2:Number) : Number
|
||||
{
|
||||
var _loc3_:Number = param1 & 1 & (param2 & 1);
|
||||
var _loc4_:Number = param1 >>> 1 & param2 >>> 1;
|
||||
return _loc4_ << 1 | _loc3_;
|
||||
}
|
||||
|
||||
private static function addme(param1:Number, param2:Number) : Number
|
||||
{
|
||||
var _loc3_:Number = (param1 & 0xFFFF) + (param2 & 0xFFFF);
|
||||
var _loc4_:Number = (param1 >> 16) + (param2 >> 16) + (_loc3_ >> 16);
|
||||
return _loc4_ << 16 | _loc3_ & 0xFFFF;
|
||||
}
|
||||
|
||||
private static function rhex(param1:Number) : String
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:String = "";
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ <= 3)
|
||||
{
|
||||
_loc2_ += hex_chr.charAt(param1 >> _loc3_ * 8 + 4 & 0x0F) + hex_chr.charAt(param1 >> _loc3_ * 8 & 0x0F);
|
||||
_loc3_++;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private static function str2blks_MD5(param1:String) : Array
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc2_:Number = (param1.length + 8 >> 6) + 1;
|
||||
var _loc3_:Array = new Array(_loc2_ * 16);
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc2_ * 16)
|
||||
{
|
||||
_loc3_[_loc4_] = 0;
|
||||
_loc4_++;
|
||||
}
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < param1.length)
|
||||
{
|
||||
_loc3_[_loc4_ >> 2] |= param1.charCodeAt(_loc4_) << (param1.length * 8 + _loc4_) % 4 * 8;
|
||||
_loc4_++;
|
||||
}
|
||||
_loc3_[_loc4_ >> 2] |= 128 << (param1.length * 8 + _loc4_) % 4 * 8;
|
||||
var _loc5_:int = param1.length * 8;
|
||||
_loc3_[_loc2_ * 16 - 2] = _loc5_ & 0xFF;
|
||||
_loc3_[_loc2_ * 16 - 2] |= (_loc5_ >>> 8 & 0xFF) << 8;
|
||||
_loc3_[_loc2_ * 16 - 2] |= (_loc5_ >>> 16 & 0xFF) << 16;
|
||||
_loc3_[_loc2_ * 16 - 2] |= (_loc5_ >>> 24 & 0xFF) << 24;
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private static function rol(param1:Number, param2:Number) : Number
|
||||
{
|
||||
return param1 << param2 | param1 >>> 32 - param2;
|
||||
}
|
||||
|
||||
private static function cmn(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number) : Number
|
||||
{
|
||||
return addme(rol(addme(addme(param2,param1),addme(param4,param6)),param5),param3);
|
||||
}
|
||||
|
||||
private static function ff(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:Number) : Number
|
||||
{
|
||||
return cmn(bitOR(bitAND(param2,param3),bitAND(~param2,param4)),param1,param2,param5,param6,param7);
|
||||
}
|
||||
|
||||
private static function gg(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:Number) : Number
|
||||
{
|
||||
return cmn(bitOR(bitAND(param2,param4),bitAND(param3,~param4)),param1,param2,param5,param6,param7);
|
||||
}
|
||||
|
||||
private static function hh(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:Number) : Number
|
||||
{
|
||||
return cmn(bitXOR(bitXOR(param2,param3),param4),param1,param2,param5,param6,param7);
|
||||
}
|
||||
|
||||
private static function ii(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:Number) : Number
|
||||
{
|
||||
return cmn(bitXOR(param3,bitOR(param2,~param4)),param1,param2,param5,param6,param7);
|
||||
}
|
||||
|
||||
internal static function MD5(param1:String) : String
|
||||
{
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:Number = NaN;
|
||||
var _loc9_:Number = NaN;
|
||||
var _loc10_:Number = NaN;
|
||||
var _loc11_:Number = NaN;
|
||||
var _loc2_:Array = str2blks_MD5(param1);
|
||||
var _loc3_:Number = 1732584193;
|
||||
var _loc4_:Number = -271733879;
|
||||
var _loc5_:Number = -1732584194;
|
||||
var _loc6_:Number = 271733878;
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc2_.length)
|
||||
{
|
||||
_loc8_ = _loc3_;
|
||||
_loc9_ = _loc4_;
|
||||
_loc10_ = _loc5_;
|
||||
_loc11_ = _loc6_;
|
||||
_loc3_ = ff(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 0],7,-680876936);
|
||||
_loc6_ = ff(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 1],12,-389564586);
|
||||
_loc5_ = ff(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 2],17,606105819);
|
||||
_loc4_ = ff(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 3],22,-1044525330);
|
||||
_loc3_ = ff(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 4],7,-176418897);
|
||||
_loc6_ = ff(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 5],12,1200080426);
|
||||
_loc5_ = ff(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 6],17,-1473231341);
|
||||
_loc4_ = ff(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 7],22,-45705983);
|
||||
_loc3_ = ff(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 8],7,1770035416);
|
||||
_loc6_ = ff(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 9],12,-1958414417);
|
||||
_loc5_ = ff(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 10],17,-42063);
|
||||
_loc4_ = ff(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 11],22,-1990404162);
|
||||
_loc3_ = ff(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 12],7,1804603682);
|
||||
_loc6_ = ff(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 13],12,-40341101);
|
||||
_loc5_ = ff(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 14],17,-1502002290);
|
||||
_loc4_ = ff(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 15],22,1236535329);
|
||||
_loc3_ = gg(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 1],5,-165796510);
|
||||
_loc6_ = gg(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 6],9,-1069501632);
|
||||
_loc5_ = gg(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 11],14,643717713);
|
||||
_loc4_ = gg(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 0],20,-373897302);
|
||||
_loc3_ = gg(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 5],5,-701558691);
|
||||
_loc6_ = gg(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 10],9,38016083);
|
||||
_loc5_ = gg(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 15],14,-660478335);
|
||||
_loc4_ = gg(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 4],20,-405537848);
|
||||
_loc3_ = gg(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 9],5,568446438);
|
||||
_loc6_ = gg(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 14],9,-1019803690);
|
||||
_loc5_ = gg(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 3],14,-187363961);
|
||||
_loc4_ = gg(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 8],20,1163531501);
|
||||
_loc3_ = gg(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 13],5,-1444681467);
|
||||
_loc6_ = gg(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 2],9,-51403784);
|
||||
_loc5_ = gg(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 7],14,1735328473);
|
||||
_loc4_ = gg(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 12],20,-1926607734);
|
||||
_loc3_ = hh(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 5],4,-378558);
|
||||
_loc6_ = hh(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 8],11,-2022574463);
|
||||
_loc5_ = hh(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 11],16,1839030562);
|
||||
_loc4_ = hh(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 14],23,-35309556);
|
||||
_loc3_ = hh(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 1],4,-1530992060);
|
||||
_loc6_ = hh(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 4],11,1272893353);
|
||||
_loc5_ = hh(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 7],16,-155497632);
|
||||
_loc4_ = hh(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 10],23,-1094730640);
|
||||
_loc3_ = hh(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 13],4,681279174);
|
||||
_loc6_ = hh(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 0],11,-358537222);
|
||||
_loc5_ = hh(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 3],16,-722521979);
|
||||
_loc4_ = hh(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 6],23,76029189);
|
||||
_loc3_ = hh(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 9],4,-640364487);
|
||||
_loc6_ = hh(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 12],11,-421815835);
|
||||
_loc5_ = hh(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 15],16,530742520);
|
||||
_loc4_ = hh(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 2],23,-995338651);
|
||||
_loc3_ = ii(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 0],6,-198630844);
|
||||
_loc6_ = ii(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 7],10,1126891415);
|
||||
_loc5_ = ii(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 14],15,-1416354905);
|
||||
_loc4_ = ii(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 5],21,-57434055);
|
||||
_loc3_ = ii(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 12],6,1700485571);
|
||||
_loc6_ = ii(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 3],10,-1894986606);
|
||||
_loc5_ = ii(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 10],15,-1051523);
|
||||
_loc4_ = ii(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 1],21,-2054922799);
|
||||
_loc3_ = ii(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 8],6,1873313359);
|
||||
_loc6_ = ii(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 15],10,-30611744);
|
||||
_loc5_ = ii(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 6],15,-1560198380);
|
||||
_loc4_ = ii(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 13],21,1309151649);
|
||||
_loc3_ = ii(_loc3_,_loc4_,_loc5_,_loc6_,_loc2_[_loc7_ + 4],6,-145523070);
|
||||
_loc6_ = ii(_loc6_,_loc3_,_loc4_,_loc5_,_loc2_[_loc7_ + 11],10,-1120210379);
|
||||
_loc5_ = ii(_loc5_,_loc6_,_loc3_,_loc4_,_loc2_[_loc7_ + 2],15,718787259);
|
||||
_loc4_ = ii(_loc4_,_loc5_,_loc6_,_loc3_,_loc2_[_loc7_ + 9],21,-343485551);
|
||||
_loc3_ = addme(_loc3_,_loc8_);
|
||||
_loc4_ = addme(_loc4_,_loc9_);
|
||||
_loc5_ = addme(_loc5_,_loc10_);
|
||||
_loc6_ = addme(_loc6_,_loc11_);
|
||||
_loc7_ += 16;
|
||||
}
|
||||
return rhex(_loc3_) + rhex(_loc4_) + rhex(_loc5_) + rhex(_loc6_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package Playtomic
|
||||
{
|
||||
public final class GameVars
|
||||
{
|
||||
|
||||
private static var SECTION:String;
|
||||
|
||||
private static var LOAD:String;
|
||||
|
||||
public function GameVars()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
internal static function Initialise(param1:String) : void
|
||||
{
|
||||
SECTION = Encode.MD5("gamevars-" + param1);
|
||||
LOAD = Encode.MD5("gamevars-load-" + param1);
|
||||
}
|
||||
|
||||
public static function Load(param1:Function) : void
|
||||
{
|
||||
Request.Load(SECTION,LOAD,LoadComplete,param1,null);
|
||||
}
|
||||
|
||||
private static function LoadComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
var _loc6_:XMLList = null;
|
||||
var _loc7_:String = null;
|
||||
var _loc8_:String = null;
|
||||
var _loc9_:XML = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:Object = new Object();
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc6_ = param3["gamevar"];
|
||||
for each(_loc9_ in _loc6_)
|
||||
{
|
||||
_loc7_ = _loc9_["name"];
|
||||
_loc8_ = _loc9_["value"];
|
||||
_loc5_[_loc7_] = _loc8_;
|
||||
}
|
||||
}
|
||||
param2 = param2;
|
||||
param1(_loc5_,param4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package Playtomic
|
||||
{
|
||||
public final class GeoIP
|
||||
{
|
||||
|
||||
private static var SECTION:String;
|
||||
|
||||
private static var LOAD:String;
|
||||
|
||||
public function GeoIP()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
internal static function Initialise(param1:String) : void
|
||||
{
|
||||
SECTION = Encode.MD5("geoip-" + param1);
|
||||
LOAD = Encode.MD5("geoip-lookup-" + param1);
|
||||
}
|
||||
|
||||
public static function Lookup(param1:Function) : void
|
||||
{
|
||||
Request.Load(SECTION,LOAD,LookupComplete,param1);
|
||||
}
|
||||
|
||||
private static function LookupComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:Object = {
|
||||
"Code":"N/A",
|
||||
"Name":"UNKNOWN"
|
||||
};
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc5_["Code"] = param3["location"]["code"];
|
||||
_loc5_["Name"] = param3["location"]["name"];
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
param2 = param2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
package Playtomic
|
||||
{
|
||||
import flash.external.ExternalInterface;
|
||||
|
||||
public final class Leaderboards
|
||||
{
|
||||
|
||||
private static var SECTION:String;
|
||||
|
||||
private static var CREATEPRIVATELEADERBOARD:String;
|
||||
|
||||
private static var LOADPRIVATELEADERBOARD:String;
|
||||
|
||||
private static var SAVEANDLIST:String;
|
||||
|
||||
private static var SAVE:String;
|
||||
|
||||
private static var LIST:String;
|
||||
|
||||
public static const TODAY:String = "today";
|
||||
|
||||
public static const LAST7DAYS:String = "last7days";
|
||||
|
||||
public static const LAST30DAYS:String = "last30days";
|
||||
|
||||
public static const ALLTIME:String = "alltime";
|
||||
|
||||
public static const NEWEST:String = "newest";
|
||||
|
||||
public function Leaderboards()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
internal static function Initialise(param1:String) : void
|
||||
{
|
||||
SECTION = Encode.MD5("leaderboards-" + param1);
|
||||
CREATEPRIVATELEADERBOARD = Encode.MD5("leaderboards-createprivateleaderboard-" + param1);
|
||||
LOADPRIVATELEADERBOARD = Encode.MD5("leaderboards-loadprivateleaderboard-" + param1);
|
||||
SAVEANDLIST = Encode.MD5("leaderboards-saveandlist-" + param1);
|
||||
SAVE = Encode.MD5("leaderboards-save-" + param1);
|
||||
LIST = Encode.MD5("leaderboards-list-" + param1);
|
||||
}
|
||||
|
||||
public static function CreatePrivateLeaderboard(param1:String, param2:String, param3:Function = null, param4:Boolean = true) : void
|
||||
{
|
||||
var _loc5_:Object = new Object();
|
||||
_loc5_["table"] = param1;
|
||||
_loc5_["highest"] = param4 ? "y" : "n";
|
||||
_loc5_["permalink"] = param2;
|
||||
Request.Load(SECTION,CREATEPRIVATELEADERBOARD,CreatePrivateLeaderboardComplete,param3,_loc5_);
|
||||
}
|
||||
|
||||
private static function CreatePrivateLeaderboardComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:PrivateLeaderboard = null;
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc5_ = new PrivateLeaderboard(param3["tableid"],param3["name"],param3["bitly"],param3["permalink"],param3["highest"] == "true",param3["realname"]);
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
param2 = param2;
|
||||
}
|
||||
|
||||
public static function LoadPrivateLeaderboard(param1:String, param2:Function = null) : void
|
||||
{
|
||||
var _loc3_:Object = new Object();
|
||||
_loc3_["tableid"] = param1;
|
||||
Request.Load(SECTION,LOADPRIVATELEADERBOARD,LoadPrivateLeaderboardComplete,param2,_loc3_);
|
||||
}
|
||||
|
||||
private static function LoadPrivateLeaderboardComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:PrivateLeaderboard = null;
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc5_ = new PrivateLeaderboard(param3["tableid"],param3["name"],param3["bitly"],param3["permalink"],param3["highest"] == "true",param3["realname"]);
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
param2 = param2;
|
||||
}
|
||||
|
||||
public static function GetLeaderboardFromUrl() : String
|
||||
{
|
||||
var url:String = null;
|
||||
var leaderboardid:String = null;
|
||||
if(!ExternalInterface.available)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
url = String(ExternalInterface.call("window.location.href.toString"));
|
||||
if(url.indexOf("?") == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
leaderboardid = url.substring(url.indexOf("leaderboard=") + 12);
|
||||
if(leaderboardid.indexOf("&") > -1)
|
||||
{
|
||||
leaderboardid = leaderboardid.substring(0,leaderboardid.indexOf("&"));
|
||||
}
|
||||
if(leaderboardid.indexOf("#") > -1)
|
||||
{
|
||||
leaderboardid = leaderboardid.substring(0,leaderboardid.indexOf("#"));
|
||||
}
|
||||
return leaderboardid;
|
||||
}
|
||||
catch(s:Error)
|
||||
{
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function SaveAndList(param1:PlayerScore, param2:String, param3:Function = null, param4:Object = null) : void
|
||||
{
|
||||
var _loc16_:String = null;
|
||||
var _loc17_:String = null;
|
||||
if(param4 == null)
|
||||
{
|
||||
param4 = new Object();
|
||||
}
|
||||
var _loc5_:Boolean = param4.hasOwnProperty("allowduplicates") ? Boolean(param4["allowduplicates"]) : false;
|
||||
var _loc6_:Boolean = param4.hasOwnProperty("global") ? Boolean(param4["global"]) : true;
|
||||
var _loc7_:Boolean = param4.hasOwnProperty("highest") ? Boolean(param4["highest"]) : true;
|
||||
var _loc8_:String = param4.hasOwnProperty("mode") ? param4["mode"] : "alltime";
|
||||
var _loc9_:Object = param4.hasOwnProperty("customfilters") ? param4["customfilters"] : {};
|
||||
var _loc10_:int = param4.hasOwnProperty("page") ? int(param4["page"]) : 1;
|
||||
var _loc11_:int = param4.hasOwnProperty("perpage") ? int(param4["perpage"]) : 20;
|
||||
var _loc12_:Array = param4.hasOwnProperty("friendslist") ? param4["friendslist"] : new Array();
|
||||
var _loc13_:Object = new Object();
|
||||
_loc13_["url"] = Log.SourceUrl;
|
||||
_loc13_["table"] = param2;
|
||||
_loc13_["highest"] = _loc7_ ? "y" : "n";
|
||||
_loc13_["name"] = param1.Name;
|
||||
_loc13_["points"] = param1.Points.toString();
|
||||
_loc13_["allowduplicates"] = _loc5_ ? "y" : "n";
|
||||
_loc13_["auth"] = Encode.MD5(Log.BaseUrl + param1.Points.toString());
|
||||
var _loc14_:int = 0;
|
||||
if(param1.CustomData != null)
|
||||
{
|
||||
for(_loc16_ in param1.CustomData)
|
||||
{
|
||||
_loc13_["ckey" + _loc14_] = _loc16_;
|
||||
_loc13_["cdata" + _loc14_] = param1.CustomData[_loc16_];
|
||||
_loc14_++;
|
||||
}
|
||||
}
|
||||
_loc13_["numfields"] = _loc14_;
|
||||
_loc13_["global"] = _loc6_ ? "y" : "n";
|
||||
_loc13_["mode"] = _loc8_;
|
||||
_loc13_["page"] = _loc10_;
|
||||
_loc13_["perpage"] = _loc11_;
|
||||
var _loc15_:int = 0;
|
||||
if(_loc9_ != null)
|
||||
{
|
||||
for(_loc17_ in _loc9_)
|
||||
{
|
||||
_loc13_["lkey" + _loc15_] = _loc17_;
|
||||
_loc13_["ldata" + _loc15_] = _loc9_[_loc17_];
|
||||
_loc15_++;
|
||||
}
|
||||
}
|
||||
_loc13_["numfilters"] = _loc15_;
|
||||
if(param1.FBUserId != null && param1.FBUserId != "")
|
||||
{
|
||||
if(_loc12_.length > 0)
|
||||
{
|
||||
_loc13_["friendslist"] = _loc12_.join(",");
|
||||
}
|
||||
_loc13_["fbuserid"] = param1.FBUserId;
|
||||
}
|
||||
Request.Load(SECTION,SAVEANDLIST,SaveAndListComplete,param3,_loc13_);
|
||||
}
|
||||
|
||||
private static function SaveAndListComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param4.Success)
|
||||
{
|
||||
ProcessScores(param3,param4,param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
param1([],0,param4);
|
||||
}
|
||||
param2 = param2;
|
||||
}
|
||||
|
||||
public static function Save(param1:PlayerScore, param2:String, param3:Function = null, param4:Object = null) : void
|
||||
{
|
||||
var _loc10_:String = null;
|
||||
if(param4 == null)
|
||||
{
|
||||
param4 = new Object();
|
||||
}
|
||||
var _loc5_:Boolean = param4.hasOwnProperty("allowduplicates") ? Boolean(param4["allowduplicates"]) : false;
|
||||
var _loc6_:Boolean = param4.hasOwnProperty("highest") ? Boolean(param4["highest"]) : true;
|
||||
var _loc7_:String = param1.Points.toString();
|
||||
if(_loc7_.indexOf(".") > -1)
|
||||
{
|
||||
_loc7_ = _loc7_.substring(0,_loc7_.indexOf("."));
|
||||
}
|
||||
var _loc8_:Object = new Object();
|
||||
var _loc9_:int = 0;
|
||||
if(param1.CustomData != null)
|
||||
{
|
||||
for(_loc10_ in param1.CustomData)
|
||||
{
|
||||
_loc8_["ckey" + _loc9_] = _loc10_;
|
||||
_loc8_["cdata" + _loc9_] = param1.CustomData[_loc10_];
|
||||
_loc9_++;
|
||||
}
|
||||
}
|
||||
_loc8_["url"] = Log.BaseUrl;
|
||||
_loc8_["table"] = param2;
|
||||
_loc8_["highest"] = _loc6_ ? "y" : "n";
|
||||
_loc8_["name"] = param1.Name;
|
||||
_loc8_["points"] = _loc7_;
|
||||
_loc8_["allowduplicates"] = _loc5_ ? "y" : "n";
|
||||
_loc8_["auth"] = Encode.MD5(Log.BaseUrl + _loc7_);
|
||||
_loc8_["fb"] = param1.FBUserId != "" && param1.FBUserId != null ? "y" : "n";
|
||||
_loc8_["fbuserid"] = param1.FBUserId;
|
||||
_loc8_["customfields"] = _loc9_;
|
||||
Request.Load(SECTION,SAVE,SaveComplete,param3,_loc8_);
|
||||
}
|
||||
|
||||
private static function SaveComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
param3 = param3;
|
||||
param2 = param2;
|
||||
param1(param4);
|
||||
}
|
||||
|
||||
public static function List(param1:String, param2:Function, param3:Object = null) : void
|
||||
{
|
||||
var _loc14_:String = null;
|
||||
if(param3 == null)
|
||||
{
|
||||
param3 = new Object();
|
||||
}
|
||||
var _loc4_:Boolean = param3.hasOwnProperty("global") ? Boolean(param3["global"]) : true;
|
||||
var _loc5_:Boolean = param3.hasOwnProperty("highest") ? Boolean(param3["highest"]) : true;
|
||||
var _loc6_:String = param3.hasOwnProperty("mode") ? param3["mode"] : "alltime";
|
||||
var _loc7_:Object = param3.hasOwnProperty("customfilters") ? param3["customfilters"] : new Object();
|
||||
var _loc8_:int = param3.hasOwnProperty("page") ? int(param3["page"]) : 1;
|
||||
var _loc9_:int = param3.hasOwnProperty("perpage") ? int(param3["perpage"]) : 20;
|
||||
var _loc10_:Boolean = param3.hasOwnProperty("facebook") ? Boolean(param3["facebook"]) : false;
|
||||
var _loc11_:Array = param3.hasOwnProperty("friendslist") ? param3["friendslist"] : new Array();
|
||||
var _loc12_:Object = new Object();
|
||||
var _loc13_:int = 0;
|
||||
for(_loc14_ in _loc7_)
|
||||
{
|
||||
_loc12_["ckey" + _loc13_] = _loc14_;
|
||||
_loc12_["cdata" + _loc13_] = _loc7_[_loc14_];
|
||||
_loc13_++;
|
||||
}
|
||||
_loc12_["url"] = _loc4_ || Log.BaseUrl == null ? "global" : Log.BaseUrl;
|
||||
_loc12_["mode"] = _loc6_;
|
||||
_loc12_["page"] = _loc8_;
|
||||
_loc12_["perpage"] = _loc9_;
|
||||
_loc12_["highest"] = _loc5_ ? "y" : "n";
|
||||
_loc12_["filters"] = _loc13_;
|
||||
_loc12_["table"] = param1;
|
||||
if(_loc10_)
|
||||
{
|
||||
if(_loc11_.length > 0)
|
||||
{
|
||||
_loc12_["friendslist"] = _loc11_.join(",");
|
||||
}
|
||||
}
|
||||
Request.Load(SECTION,LIST,ListComplete,param2,_loc12_);
|
||||
}
|
||||
|
||||
private static function ListComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param4.Success)
|
||||
{
|
||||
ProcessScores(param3,param4,param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
param1([],0,param4);
|
||||
}
|
||||
param2 = param2;
|
||||
}
|
||||
|
||||
private static function ProcessScores(param1:XML, param2:Response, param3:Function) : void
|
||||
{
|
||||
var _loc7_:String = null;
|
||||
var _loc8_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
var _loc11_:XML = null;
|
||||
var _loc12_:PlayerScore = null;
|
||||
var _loc13_:XMLList = null;
|
||||
var _loc14_:XML = null;
|
||||
var _loc4_:int = parseInt(param1["numscores"]);
|
||||
var _loc5_:Array = new Array();
|
||||
var _loc6_:XMLList = param1["score"];
|
||||
for each(_loc11_ in _loc6_)
|
||||
{
|
||||
_loc7_ = _loc11_["sdate"];
|
||||
_loc8_ = int(_loc7_.substring(_loc7_.lastIndexOf("/") + 1));
|
||||
_loc9_ = int(_loc7_.substring(0,_loc7_.indexOf("/")));
|
||||
_loc10_ = int(_loc7_.substring(_loc7_.indexOf("/") + 1).substring(0,2));
|
||||
_loc12_ = new PlayerScore();
|
||||
_loc12_.SDate = new Date(_loc8_,_loc9_ - 1,_loc10_);
|
||||
_loc12_.RDate = _loc11_["rdate"];
|
||||
_loc12_.Name = _loc11_["name"];
|
||||
_loc12_.Points = _loc11_["points"];
|
||||
_loc12_.Website = _loc11_["website"];
|
||||
_loc12_.Rank = _loc11_["rank"];
|
||||
if(_loc11_["submittedorbest"] != null)
|
||||
{
|
||||
_loc12_.SubmittedOrBest = _loc11_["submittedorbest"] == "true";
|
||||
}
|
||||
if(_loc11_["fbuserid"])
|
||||
{
|
||||
_loc12_.FBUserId = _loc11_["fbuserid"];
|
||||
}
|
||||
if(_loc11_["custom"])
|
||||
{
|
||||
_loc13_ = _loc11_["custom"];
|
||||
for each(_loc14_ in _loc13_.children())
|
||||
{
|
||||
_loc12_.CustomData[_loc14_.name()] = _loc14_.text();
|
||||
}
|
||||
}
|
||||
_loc5_.push(_loc12_);
|
||||
}
|
||||
param3(_loc5_,_loc4_,param2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package Playtomic
|
||||
{
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.navigateToURL;
|
||||
|
||||
public final class Link
|
||||
{
|
||||
|
||||
private static var Clicks:Array = new Array();
|
||||
|
||||
public function Link()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function Open(param1:String, param2:String, param3:String) : Boolean
|
||||
{
|
||||
var baseurlname:String;
|
||||
var result:Boolean = false;
|
||||
var url:String = param1;
|
||||
var name:String = param2;
|
||||
var group:String = param3;
|
||||
var unique:int = 0;
|
||||
var bunique:int = 0;
|
||||
var total:int = 0;
|
||||
var btotal:int = 0;
|
||||
var fail:int = 0;
|
||||
var bfail:int = 0;
|
||||
var key:String = url + "." + name;
|
||||
var baseurl:String = url;
|
||||
baseurl = baseurl.replace("http://","");
|
||||
if(baseurl.indexOf("/") > -1)
|
||||
{
|
||||
baseurl = baseurl.substring(0,baseurl.indexOf("/"));
|
||||
}
|
||||
if(baseurl.indexOf("?") > -1)
|
||||
{
|
||||
baseurl = baseurl.substring(0,baseurl.indexOf("?"));
|
||||
}
|
||||
baseurl = "http://" + baseurl + "/";
|
||||
baseurlname = baseurl;
|
||||
if(baseurlname.indexOf("//") > -1)
|
||||
{
|
||||
baseurlname = baseurlname.substring(baseurlname.indexOf("//") + 2);
|
||||
}
|
||||
baseurlname = baseurlname.replace("www.","");
|
||||
if(baseurlname.indexOf("/") > -1)
|
||||
{
|
||||
baseurlname = baseurlname.substring(0,baseurlname.indexOf("/"));
|
||||
}
|
||||
try
|
||||
{
|
||||
navigateToURL(new URLRequest(url),"dh2");
|
||||
if(Clicks.indexOf(key) > -1)
|
||||
{
|
||||
total = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
total = 1;
|
||||
unique = 1;
|
||||
Clicks.push(key);
|
||||
}
|
||||
if(Clicks.indexOf(baseurlname) > -1)
|
||||
{
|
||||
btotal = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
btotal = 1;
|
||||
bunique = 1;
|
||||
Clicks.push(baseurlname);
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
catch(err:Error)
|
||||
{
|
||||
fail = 1;
|
||||
bfail = 1;
|
||||
result = false;
|
||||
}
|
||||
Log.Link(baseurl,baseurlname.toLowerCase(),"DomainTotals",bunique,btotal,bfail);
|
||||
Log.Link(url,name,group,unique,total,fail);
|
||||
Log.ForceSend();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,400 @@
|
||||
package Playtomic
|
||||
{
|
||||
import flash.events.TimerEvent;
|
||||
import flash.external.ExternalInterface;
|
||||
import flash.net.SharedObject;
|
||||
import flash.system.Security;
|
||||
import flash.utils.Timer;
|
||||
import org.flixel.FlxG;
|
||||
|
||||
public final class Log
|
||||
{
|
||||
|
||||
internal static var SourceUrl:String;
|
||||
|
||||
internal static var BaseUrl:String;
|
||||
|
||||
private static var Cookie:SharedObject;
|
||||
|
||||
internal static var LogQueue:LogRequest;
|
||||
|
||||
private static var Enabled:Boolean = false;
|
||||
|
||||
private static var Queue:Boolean = true;
|
||||
|
||||
internal static var SWFID:int = 0;
|
||||
|
||||
internal static var GUID:String = "";
|
||||
|
||||
private static const PingF:Timer = new Timer(60000);
|
||||
|
||||
private static const PingR:Timer = new Timer(30000);
|
||||
|
||||
private static var FirstPing:Boolean = true;
|
||||
|
||||
private static var Pings:int = 0;
|
||||
|
||||
private static var Plays:int = 0;
|
||||
|
||||
private static var Frozen:Boolean = false;
|
||||
|
||||
private static var FrozenQueue:Array = new Array();
|
||||
|
||||
private static var Customs:Array = new Array();
|
||||
|
||||
private static var LevelCounters:Array = new Array();
|
||||
|
||||
private static var LevelAverages:Array = new Array();
|
||||
|
||||
private static var LevelRangeds:Array = new Array();
|
||||
|
||||
public function Log()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function View(param1:int = 0, param2:String = "", param3:String = "", param4:String = "") : void
|
||||
{
|
||||
if(SWFID > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SWFID = param1;
|
||||
GUID = param2;
|
||||
Enabled = true;
|
||||
if(SWFID == 0 || GUID == "")
|
||||
{
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
FlxG.log("sandboxType: " + Security.sandboxType);
|
||||
if(param4.indexOf("http://") != 0 && Security.sandboxType != "localWithNetwork" && Security.sandboxType != "localTrusted")
|
||||
{
|
||||
FlxG.log("fall through");
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
FlxG.log("Getting url, default is: " + param4);
|
||||
SourceUrl = GetUrl(param4);
|
||||
FlxG.log("Found url: " + SourceUrl);
|
||||
if(SourceUrl == null || SourceUrl == "")
|
||||
{
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
BaseUrl = SourceUrl.split("://")[1];
|
||||
BaseUrl = BaseUrl.substring(0,BaseUrl.indexOf("/"));
|
||||
Parse.Initialise(param3);
|
||||
GeoIP.Initialise(param3);
|
||||
Data.Initialise(param3);
|
||||
Leaderboards.Initialise(param3);
|
||||
GameVars.Initialise(param3);
|
||||
PlayerLevels.Initialise(param3);
|
||||
Request.Initialise();
|
||||
LogQueue = LogRequest.Create();
|
||||
Cookie = SharedObject.getLocal("playtomic");
|
||||
Security.loadPolicyFile("http://g" + param2 + ".api.playtomic.com/crossdomain.xml");
|
||||
var _loc5_:int = GetCookie("views");
|
||||
Send("v/" + (_loc5_ + 1),true);
|
||||
PingF.addEventListener(TimerEvent.TIMER,PingServer);
|
||||
PingF.start();
|
||||
}
|
||||
|
||||
internal static function IncreaseViews() : void
|
||||
{
|
||||
var _loc1_:int = GetCookie("views");
|
||||
_loc1_++;
|
||||
SaveCookie("views",_loc1_);
|
||||
}
|
||||
|
||||
internal static function IncreasePlays() : void
|
||||
{
|
||||
++Plays;
|
||||
}
|
||||
|
||||
public static function Play() : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LevelCounters = new Array();
|
||||
LevelAverages = new Array();
|
||||
LevelRangeds = new Array();
|
||||
Send("p/" + (Plays + 1),true);
|
||||
}
|
||||
|
||||
private static function PingServer(param1:TimerEvent) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
++Pings;
|
||||
Send("t/" + (FirstPing ? "y" : "n") + "/" + Pings,true);
|
||||
if(FirstPing)
|
||||
{
|
||||
PingF.stop();
|
||||
PingR.addEventListener(TimerEvent.TIMER,PingServer);
|
||||
PingR.start();
|
||||
FirstPing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function CustomMetric(param1:String, param2:String = null, param3:Boolean = false) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param2 == null)
|
||||
{
|
||||
param2 = "";
|
||||
}
|
||||
if(param3)
|
||||
{
|
||||
if(Customs.indexOf(param1) > -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Customs.push(param1);
|
||||
}
|
||||
Send("c/" + Clean(param1) + "/" + Clean(param2));
|
||||
}
|
||||
|
||||
public static function LevelCounterMetric(param1:String, param2:*, param3:Boolean = false) : void
|
||||
{
|
||||
var _loc4_:String = null;
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param3)
|
||||
{
|
||||
_loc4_ = param1 + "." + (param2 as String);
|
||||
if(LevelCounters.indexOf(_loc4_) > -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LevelCounters.push(_loc4_);
|
||||
}
|
||||
Send("lc/" + Clean(param1) + "/" + Clean(param2));
|
||||
}
|
||||
|
||||
public static function LevelRangedMetric(param1:String, param2:*, param3:int, param4:Boolean = false) : void
|
||||
{
|
||||
var _loc5_:String = null;
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param4)
|
||||
{
|
||||
_loc5_ = param1 + "." + (param2 as String);
|
||||
if(LevelRangeds.indexOf(_loc5_) > -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LevelRangeds.push(_loc5_);
|
||||
}
|
||||
Send("lr/" + Clean(param1) + "/" + Clean(param2) + "/" + param3);
|
||||
}
|
||||
|
||||
public static function LevelAverageMetric(param1:String, param2:*, param3:int, param4:Boolean = false) : void
|
||||
{
|
||||
var _loc5_:String = null;
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param4)
|
||||
{
|
||||
_loc5_ = param1 + "." + (param2 as String);
|
||||
if(LevelAverages.indexOf(_loc5_) > -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LevelAverages.push(_loc5_);
|
||||
}
|
||||
Send("la/" + Clean(param1) + "/" + Clean(param2) + "/" + param3);
|
||||
}
|
||||
|
||||
internal static function Link(param1:String, param2:String, param3:String, param4:int, param5:int, param6:int) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Send("l/" + Clean(param2) + "/" + Clean(param3) + "/" + Clean(param1) + "/" + param4 + "/" + param5 + "/" + param6);
|
||||
}
|
||||
|
||||
public static function Heatmap(param1:String, param2:String, param3:int, param4:int) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Send("h/" + Clean(param1) + "/" + Clean(param2) + "/" + param3 + "/" + param4);
|
||||
}
|
||||
|
||||
internal static function Funnel(param1:String, param2:String, param3:int) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Send("f/" + Clean(param1) + "/" + Clean(param2) + "/" + param3);
|
||||
}
|
||||
|
||||
internal static function PlayerLevelStart(param1:String) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Send("pls/" + param1);
|
||||
}
|
||||
|
||||
internal static function PlayerLevelWin(param1:String) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Send("plw/" + param1);
|
||||
}
|
||||
|
||||
internal static function PlayerLevelQuit(param1:String) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Send("plq/" + param1);
|
||||
}
|
||||
|
||||
internal static function PlayerLevelFlag(param1:String) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Send("plf/" + param1);
|
||||
}
|
||||
|
||||
internal static function PlayerLevelRetry(param1:String) : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Send("plr/" + param1);
|
||||
}
|
||||
|
||||
public static function Freeze() : void
|
||||
{
|
||||
Frozen = true;
|
||||
}
|
||||
|
||||
public static function UnFreeze() : void
|
||||
{
|
||||
Frozen = false;
|
||||
LogQueue.MassQueue(FrozenQueue);
|
||||
}
|
||||
|
||||
public static function ForceSend() : void
|
||||
{
|
||||
if(!Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(LogQueue == null)
|
||||
{
|
||||
LogQueue = LogRequest.Create();
|
||||
}
|
||||
LogQueue.Send();
|
||||
LogQueue = LogRequest.Create();
|
||||
if(FrozenQueue.length > 0)
|
||||
{
|
||||
LogQueue.MassQueue(FrozenQueue);
|
||||
}
|
||||
}
|
||||
|
||||
private static function Send(param1:String, param2:Boolean = false) : void
|
||||
{
|
||||
if(Frozen)
|
||||
{
|
||||
FrozenQueue.push(param1);
|
||||
return;
|
||||
}
|
||||
LogQueue.Queue(param1);
|
||||
if(LogQueue.ready || param2 || !Queue)
|
||||
{
|
||||
LogQueue.Send();
|
||||
LogQueue = LogRequest.Create();
|
||||
}
|
||||
}
|
||||
|
||||
private static function Clean(param1:String) : String
|
||||
{
|
||||
while(param1.indexOf("/") > -1)
|
||||
{
|
||||
param1 = param1.replace("/","\\");
|
||||
}
|
||||
while(param1.indexOf("~") > -1)
|
||||
{
|
||||
param1 = param1.replace("~","-");
|
||||
}
|
||||
return escape(param1);
|
||||
}
|
||||
|
||||
private static function GetCookie(param1:String) : int
|
||||
{
|
||||
if(Cookie.data[param1] == undefined)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return int(Cookie.data[param1]);
|
||||
}
|
||||
|
||||
private static function SaveCookie(param1:String, param2:int) : void
|
||||
{
|
||||
var n:String = param1;
|
||||
var v:int = param2;
|
||||
Cookie.data[n] = v.toString();
|
||||
try
|
||||
{
|
||||
Cookie.flush();
|
||||
}
|
||||
catch(s:Error)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private static function GetUrl(param1:String) : String
|
||||
{
|
||||
var _loc2_:String = param1;
|
||||
FlxG.log("External available? " + ExternalInterface.available);
|
||||
if(_loc2_ == null || _loc2_ == "" || _loc2_ == "null")
|
||||
{
|
||||
FlxG.log("empty for some fucking reason");
|
||||
if(Security.sandboxType == "localWithNetwork" || Security.sandboxType == "localTrusted")
|
||||
{
|
||||
_loc2_ = "http://localhost/";
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = null;
|
||||
}
|
||||
}
|
||||
FlxG.log("Before");
|
||||
if(_loc2_.indexOf("http://") != 0)
|
||||
{
|
||||
FlxG.log("for some reason it didn\'t start with http");
|
||||
_loc2_ = "http://localhost/";
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package Playtomic
|
||||
{
|
||||
internal final class LogRequest
|
||||
{
|
||||
|
||||
private static var Pool:Array = new Array();
|
||||
|
||||
private var _data:String = "";
|
||||
|
||||
private var _hasView:Boolean = false;
|
||||
|
||||
private var _hasPlay:Boolean = false;
|
||||
|
||||
internal var ready:Boolean = false;
|
||||
|
||||
public function LogRequest()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
internal static function Create() : LogRequest
|
||||
{
|
||||
var _loc1_:LogRequest = Pool.length > 0 ? Pool.pop() as LogRequest : new LogRequest();
|
||||
_loc1_._data = "";
|
||||
_loc1_._hasView = false;
|
||||
_loc1_._hasPlay = false;
|
||||
_loc1_.ready = false;
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
internal function MassQueue(param1:Array) : void
|
||||
{
|
||||
var _loc3_:LogRequest = null;
|
||||
var _loc2_:* = int(param1.length - 1);
|
||||
while(_loc2_ > -1)
|
||||
{
|
||||
this.Queue(param1[_loc2_]);
|
||||
param1.splice(_loc2_,1);
|
||||
if(this.ready)
|
||||
{
|
||||
this.Send();
|
||||
_loc3_ = Create();
|
||||
_loc3_.MassQueue(param1);
|
||||
return;
|
||||
}
|
||||
_loc2_--;
|
||||
}
|
||||
Log.LogQueue = this;
|
||||
}
|
||||
|
||||
internal function Queue(param1:String) : void
|
||||
{
|
||||
this._data += (this._data == "" ? "" : "~") + param1;
|
||||
if(this._data.indexOf("v/") == 0)
|
||||
{
|
||||
this._hasView = true;
|
||||
}
|
||||
if(this._data.indexOf("p/") == 0)
|
||||
{
|
||||
this._hasPlay = true;
|
||||
}
|
||||
if(this._data.length > 300)
|
||||
{
|
||||
this.ready = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function Send() : void
|
||||
{
|
||||
if(this._data == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
Request.SendStatistics(this.Complete,"/tracker/q.aspx?q=" + this._data + "&url=" + (this._hasView ? Log.SourceUrl : Log.BaseUrl));
|
||||
}
|
||||
|
||||
private function Complete(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(this._hasView)
|
||||
{
|
||||
Log.IncreaseViews();
|
||||
}
|
||||
if(this._hasPlay)
|
||||
{
|
||||
Log.IncreasePlays();
|
||||
}
|
||||
}
|
||||
Pool.push(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package Playtomic
|
||||
{
|
||||
public class PFObject
|
||||
{
|
||||
|
||||
public var ObjectId:String;
|
||||
|
||||
public var ClassName:String;
|
||||
|
||||
public var Pointers:Vector.<PFPointer> = new Vector.<PFPointer>();
|
||||
|
||||
public var Data:Object = {};
|
||||
|
||||
public var UpdatedAt:Date;
|
||||
|
||||
public var CreatedAt:Date;
|
||||
|
||||
public var Password:String;
|
||||
|
||||
public function PFObject()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package Playtomic
|
||||
{
|
||||
public final class PFPointer
|
||||
{
|
||||
|
||||
public var FieldName:String;
|
||||
|
||||
public var PObject:PFObject;
|
||||
|
||||
public function PFPointer(param1:String, param2:PFObject)
|
||||
{
|
||||
super();
|
||||
this.FieldName = param1;
|
||||
this.PObject = param2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package Playtomic
|
||||
{
|
||||
public final class PFQuery
|
||||
{
|
||||
|
||||
public var ClassName:String;
|
||||
|
||||
public var WherePointers:Vector.<PFPointer> = new Vector.<PFPointer>();
|
||||
|
||||
public var WhereData:Object = {};
|
||||
|
||||
public var Order:String;
|
||||
|
||||
public var Limit:int = 10;
|
||||
|
||||
public function PFQuery()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
package Playtomic
|
||||
{
|
||||
public final class Parse
|
||||
{
|
||||
|
||||
private static var SECTION:String;
|
||||
|
||||
private static var SAVE:String;
|
||||
|
||||
private static var DELETE:String;
|
||||
|
||||
private static var LOAD:String;
|
||||
|
||||
private static var FIND:String;
|
||||
|
||||
public function Parse()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
internal static function Initialise(param1:String) : void
|
||||
{
|
||||
SECTION = Encode.MD5("parse-" + param1);
|
||||
SAVE = Encode.MD5("parse-save-" + param1);
|
||||
DELETE = Encode.MD5("parse-delete-" + param1);
|
||||
LOAD = Encode.MD5("parse-load-" + param1);
|
||||
FIND = Encode.MD5("parse-find-" + param1);
|
||||
}
|
||||
|
||||
public static function Save(param1:PFObject, param2:Function = null) : void
|
||||
{
|
||||
Request.Load(SECTION,SAVE,SaveComplete,param2,ObjectPostData(param1));
|
||||
}
|
||||
|
||||
private static function SaveComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
var _loc8_:String = null;
|
||||
var _loc9_:String = null;
|
||||
var _loc10_:String = null;
|
||||
var _loc11_:PFObject = null;
|
||||
var _loc12_:XMLList = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:XMLList = param3["object"];
|
||||
var _loc6_:XML = _loc5_[0];
|
||||
var _loc7_:PFObject = new PFObject();
|
||||
_loc7_.ObjectId = _loc6_["id"];
|
||||
_loc7_.ClassName = param2["classname"];
|
||||
_loc7_.Password = param2["password"];
|
||||
for(_loc8_ in param2)
|
||||
{
|
||||
if(_loc8_.indexOf("data") == 0)
|
||||
{
|
||||
_loc7_.Data[_loc8_.substring(4)] = param2[_loc8_];
|
||||
}
|
||||
if(_loc8_.indexOf("pointer") == 0 && _loc8_.indexOf("fieldname") > -1)
|
||||
{
|
||||
_loc9_ = _loc8_.substring(7);
|
||||
_loc9_ = _loc9_.substring(0,_loc9_.indexOf("fieldname"));
|
||||
_loc10_ = param2["pointer" + _loc9_ + "fieldname"];
|
||||
_loc11_ = new PFObject();
|
||||
_loc11_.ClassName = param2["pointer" + _loc9_ + "classname"];
|
||||
_loc11_.ObjectId = param2["pointer" + _loc9_ + "id"];
|
||||
_loc7_.Pointers.push(new PFPointer(_loc10_,_loc11_));
|
||||
}
|
||||
}
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc12_ = param3["object"];
|
||||
_loc7_.CreatedAt = DateParse(_loc12_["created"]);
|
||||
_loc7_.UpdatedAt = DateParse(_loc12_["updated"]);
|
||||
}
|
||||
param1(_loc7_,param4);
|
||||
}
|
||||
|
||||
public static function Delete(param1:PFObject, param2:Function = null) : void
|
||||
{
|
||||
Request.Load(SECTION,DELETE,DeleteComplete,param2,ObjectPostData(param1));
|
||||
}
|
||||
|
||||
private static function DeleteComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
param1(param4);
|
||||
param3 = param3;
|
||||
param2 = param2;
|
||||
}
|
||||
|
||||
public static function Load(param1:String, param2:String, param3:Function = null) : void
|
||||
{
|
||||
var _loc4_:PFObject = new PFObject();
|
||||
_loc4_.ObjectId = param1;
|
||||
_loc4_.ClassName = param2;
|
||||
Request.Load(SECTION,LOAD,LoadComplete,param3,ObjectPostData(_loc4_));
|
||||
}
|
||||
|
||||
private static function LoadComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
var _loc6_:XMLList = null;
|
||||
var _loc7_:XMLList = null;
|
||||
var _loc8_:XML = null;
|
||||
var _loc9_:XMLList = null;
|
||||
var _loc10_:XML = null;
|
||||
var _loc11_:String = null;
|
||||
var _loc12_:PFObject = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:PFObject = new PFObject();
|
||||
_loc5_.ObjectId = param2["objectid"];
|
||||
_loc5_.ClassName = param2["classname"];
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc6_ = param3["object"];
|
||||
_loc5_.CreatedAt = DateParse(_loc6_["created"]);
|
||||
_loc5_.UpdatedAt = DateParse(_loc6_["updated"]);
|
||||
if(_loc6_.contains("fields"))
|
||||
{
|
||||
_loc7_ = _loc6_["fields"];
|
||||
for each(_loc8_ in _loc7_.children())
|
||||
{
|
||||
_loc5_[_loc8_.name] = _loc8_.text();
|
||||
}
|
||||
}
|
||||
if(_loc6_.contains("pointers"))
|
||||
{
|
||||
_loc9_ = _loc6_["pointers"];
|
||||
for each(_loc10_ in _loc9_.children())
|
||||
{
|
||||
_loc11_ = _loc10_["fieldname"];
|
||||
_loc12_ = new PFObject();
|
||||
_loc12_.ClassName = _loc10_["classname"];
|
||||
_loc12_.ObjectId = _loc10_["id"];
|
||||
_loc5_.Pointers.push(new PFPointer(_loc11_,_loc12_));
|
||||
}
|
||||
}
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
}
|
||||
|
||||
public static function Find(param1:PFQuery, param2:Function = null) : void
|
||||
{
|
||||
var _loc4_:String = null;
|
||||
var _loc5_:* = 0;
|
||||
var _loc3_:Object = new Object();
|
||||
_loc3_["classname"] = param1.ClassName;
|
||||
_loc3_["limit"] = param1.Limit;
|
||||
_loc3_["order"] = param1.Order != null && param1.Order != "" ? param1.Order : "created_at";
|
||||
for(_loc4_ in param1.WhereData)
|
||||
{
|
||||
_loc3_["data" + _loc4_] = param1.WhereData[_loc4_];
|
||||
}
|
||||
_loc5_ = int(param1.WherePointers.length - 1);
|
||||
while(_loc5_ > -1)
|
||||
{
|
||||
_loc3_["pointer" + _loc5_ + "fieldname"] = param1.WherePointers[_loc5_].FieldName;
|
||||
_loc3_["pointer" + _loc5_ + "classname"] = param1.WherePointers[_loc5_].PObject.ClassName;
|
||||
_loc3_["pointer" + _loc5_ + "id"] = param1.WherePointers[_loc5_].PObject.ObjectId;
|
||||
_loc5_--;
|
||||
}
|
||||
Request.Load(SECTION,FIND,FindComplete,param2,_loc3_);
|
||||
}
|
||||
|
||||
private static function FindComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
var _loc6_:XMLList = null;
|
||||
var _loc7_:XML = null;
|
||||
var _loc8_:PFObject = null;
|
||||
var _loc9_:XMLList = null;
|
||||
var _loc10_:XML = null;
|
||||
var _loc11_:XMLList = null;
|
||||
var _loc12_:XML = null;
|
||||
var _loc13_:String = null;
|
||||
var _loc14_:PFObject = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:Array = new Array();
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc6_ = param3["objects"];
|
||||
for each(_loc7_ in _loc6_.children())
|
||||
{
|
||||
_loc8_ = new PFObject();
|
||||
_loc8_.ObjectId = _loc7_["id"];
|
||||
_loc8_.CreatedAt = DateParse(_loc7_["created"]);
|
||||
_loc8_.UpdatedAt = DateParse(_loc7_["updated"]);
|
||||
if(_loc7_.contains("fields"))
|
||||
{
|
||||
_loc9_ = _loc7_["fields"];
|
||||
for each(_loc10_ in _loc9_.children())
|
||||
{
|
||||
_loc8_[_loc10_.name] = _loc10_.text();
|
||||
}
|
||||
}
|
||||
if(_loc7_.contains("pointers"))
|
||||
{
|
||||
_loc11_ = _loc7_["pointers"];
|
||||
for each(_loc12_ in _loc11_.children())
|
||||
{
|
||||
_loc13_ = _loc12_["fieldname"];
|
||||
_loc14_ = new PFObject();
|
||||
_loc14_.ClassName = _loc12_["classname"];
|
||||
_loc14_.ObjectId = _loc12_["id"];
|
||||
_loc8_.Pointers.push(new PFPointer(_loc13_,_loc14_));
|
||||
}
|
||||
}
|
||||
_loc5_.push(_loc8_);
|
||||
}
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
param2 = param2;
|
||||
}
|
||||
|
||||
private static function ObjectPostData(param1:PFObject) : Object
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
var _loc4_:* = 0;
|
||||
var _loc2_:Object = new Object();
|
||||
_loc2_["classname"] = param1.ClassName;
|
||||
_loc2_["id"] = param1.ObjectId == null ? "" : param1.ObjectId;
|
||||
_loc2_["password"] = param1.Password == null ? "" : param1.Password;
|
||||
for(_loc3_ in param1.Data)
|
||||
{
|
||||
_loc2_["data" + _loc3_] = param1.Data[_loc3_];
|
||||
}
|
||||
_loc4_ = int(param1.Pointers.length - 1);
|
||||
while(_loc4_ > -1)
|
||||
{
|
||||
_loc2_["pointer" + _loc4_ + "fieldname"] = param1.Pointers[_loc4_].FieldName;
|
||||
_loc2_["pointer" + _loc4_ + "classname"] = param1.Pointers[_loc4_].PObject.ClassName;
|
||||
_loc2_["pointer" + _loc4_ + "id"] = param1.Pointers[_loc4_].PObject.ObjectId;
|
||||
_loc4_--;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private static function DateParse(param1:String) : Date
|
||||
{
|
||||
var _loc2_:Array = param1.split(" ");
|
||||
var _loc3_:Array = (_loc2_[0] as String).split("/");
|
||||
var _loc4_:Array = (_loc2_[1] as String).split(":");
|
||||
var _loc5_:int = int(_loc3_[1]);
|
||||
var _loc6_:int = int(_loc3_[0]);
|
||||
var _loc7_:int = int(_loc3_[2]);
|
||||
var _loc8_:int = int(_loc4_[0]);
|
||||
var _loc9_:int = int(_loc4_[1]);
|
||||
var _loc10_:int = int(_loc4_[2]);
|
||||
return new Date(Date.UTC(_loc7_,_loc6_,_loc5_,_loc8_,_loc9_,_loc10_));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package Playtomic
|
||||
{
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.Loader;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
public final class PlayerLevel
|
||||
{
|
||||
|
||||
public var LevelId:String;
|
||||
|
||||
public var PlayerSource:String = "";
|
||||
|
||||
public var PlayerId:String = "";
|
||||
|
||||
public var PlayerName:String = "";
|
||||
|
||||
public var Permalink:String;
|
||||
|
||||
public var Name:String;
|
||||
|
||||
public var Data:String;
|
||||
|
||||
public var ThumbData:String;
|
||||
|
||||
public var Votes:int;
|
||||
|
||||
public var Starts:int;
|
||||
|
||||
public var Quits:int;
|
||||
|
||||
public var Retries:int;
|
||||
|
||||
public var Flags:int;
|
||||
|
||||
public var Wins:int;
|
||||
|
||||
public var Rating:Number;
|
||||
|
||||
public var Score:int;
|
||||
|
||||
public var SDate:Date;
|
||||
|
||||
public var RDate:String;
|
||||
|
||||
public var CustomData:Object = {};
|
||||
|
||||
public function PlayerLevel()
|
||||
{
|
||||
super();
|
||||
this.SDate = new Date();
|
||||
this.RDate = "Just now";
|
||||
}
|
||||
|
||||
public function Thumb() : BitmapData
|
||||
{
|
||||
var _loc1_:ByteArray = Encode.Base64Decode(this.ThumbData);
|
||||
var _loc2_:Loader = new Loader();
|
||||
_loc2_.loadBytes(_loc1_);
|
||||
return Bitmap(_loc2_).bitmapData;
|
||||
}
|
||||
|
||||
public function Thumbnail() : String
|
||||
{
|
||||
return "http://g" + Log.GUID + ".api.playtomic.com/playerlevels/thumb.aspx?swfid=" + Log.SWFID + "&levelid=" + this.LevelId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
package Playtomic
|
||||
{
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.geom.Matrix;
|
||||
import flash.net.SharedObject;
|
||||
|
||||
public final class PlayerLevels
|
||||
{
|
||||
|
||||
private static var KongLevelReceiver:Function;
|
||||
|
||||
private static var SECTION:String;
|
||||
|
||||
private static var SAVE:String;
|
||||
|
||||
private static var LIST:String;
|
||||
|
||||
private static var LOAD:String;
|
||||
|
||||
private static var RATE:String;
|
||||
|
||||
public static const NEWEST:String = "newest";
|
||||
|
||||
public static const POPULAR:String = "popular";
|
||||
|
||||
private static var KongAPI:* = null;
|
||||
|
||||
public function PlayerLevels()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
internal static function Initialise(param1:String) : void
|
||||
{
|
||||
SECTION = Encode.MD5("playerlevels-" + param1);
|
||||
RATE = Encode.MD5("playerlevels-rate-" + param1);
|
||||
LIST = Encode.MD5("playerlevels-list-" + param1);
|
||||
SAVE = Encode.MD5("playerlevels-save-" + param1);
|
||||
LOAD = Encode.MD5("playerlevels-load-" + param1);
|
||||
}
|
||||
|
||||
public static function DeferToKongregate(param1:*, param2:Function) : void
|
||||
{
|
||||
KongLevelReceiver = param2;
|
||||
KongAPI = param1;
|
||||
KongAPI.sharedContent.addLoadListener("level",KongLevelLoaded);
|
||||
}
|
||||
|
||||
public static function LogStart(param1:String) : void
|
||||
{
|
||||
Log.PlayerLevelStart(param1);
|
||||
}
|
||||
|
||||
public static function LogWin(param1:String) : void
|
||||
{
|
||||
Log.PlayerLevelWin(param1);
|
||||
}
|
||||
|
||||
public static function LogQuit(param1:String) : void
|
||||
{
|
||||
Log.PlayerLevelQuit(param1);
|
||||
}
|
||||
|
||||
public static function LogRetry(param1:String) : void
|
||||
{
|
||||
Log.PlayerLevelRetry(param1);
|
||||
}
|
||||
|
||||
public static function Flag(param1:String) : void
|
||||
{
|
||||
Log.PlayerLevelFlag(param1);
|
||||
}
|
||||
|
||||
public static function Rate(param1:String, param2:int, param3:Function = null) : void
|
||||
{
|
||||
var _loc4_:SharedObject = SharedObject.getLocal("ratings");
|
||||
if(_loc4_.data[param1] != null)
|
||||
{
|
||||
if(param3 != null)
|
||||
{
|
||||
param3(new Response(0,402));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(param2 < 0 || param2 > 10)
|
||||
{
|
||||
if(param3 != null)
|
||||
{
|
||||
param3(new Response(0,401));
|
||||
}
|
||||
return;
|
||||
}
|
||||
var _loc5_:Object = new Object();
|
||||
_loc5_["levelid"] = param1;
|
||||
_loc5_["rating"] = param2;
|
||||
_loc4_.data[param1] = param2;
|
||||
Request.Load(SECTION,RATE,RateComplete,param3,_loc5_);
|
||||
}
|
||||
|
||||
private static function RateComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
param1(param4);
|
||||
param3 = param3;
|
||||
param2 = param2;
|
||||
}
|
||||
|
||||
public static function Load(param1:String, param2:Function = null) : void
|
||||
{
|
||||
var _loc3_:Object = new Object();
|
||||
_loc3_["levelid"] = param1;
|
||||
Request.Load(SECTION,LOAD,LoadComplete,param2,_loc3_);
|
||||
}
|
||||
|
||||
private static function LoadComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
var _loc6_:XML = null;
|
||||
var _loc7_:String = null;
|
||||
var _loc8_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
var _loc11_:XMLList = null;
|
||||
var _loc12_:XML = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:PlayerLevel = null;
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc6_ = XML(param3["level"]);
|
||||
_loc7_ = _loc6_["sdate"];
|
||||
_loc8_ = int(_loc7_.substring(_loc7_.lastIndexOf("/") + 1));
|
||||
_loc9_ = int(_loc7_.substring(0,_loc7_.indexOf("/")));
|
||||
_loc10_ = int(_loc7_.substring(_loc7_.indexOf("/") + 1).substring(0,2));
|
||||
_loc5_ = new PlayerLevel();
|
||||
_loc5_.LevelId = _loc6_["levelid"];
|
||||
_loc5_.PlayerName = _loc6_["playername"];
|
||||
_loc5_.PlayerId = _loc6_["playerid"];
|
||||
_loc5_.Name = _loc6_["name"];
|
||||
_loc5_.Score = _loc6_["score"];
|
||||
_loc5_.Votes = _loc6_["votes"];
|
||||
_loc5_.Rating = _loc6_["rating"];
|
||||
_loc5_.Data = _loc6_["data"];
|
||||
_loc5_.ThumbData = _loc6_["thumb"];
|
||||
_loc5_.Wins = _loc6_["wins"];
|
||||
_loc5_.Starts = _loc6_["starts"];
|
||||
_loc5_.Retries = _loc6_["retries"];
|
||||
_loc5_.Quits = _loc6_["quits"];
|
||||
_loc5_.Flags = _loc6_["flags"];
|
||||
_loc5_.SDate = new Date(_loc8_,_loc9_ - 1,_loc10_);
|
||||
_loc5_.RDate = _loc6_["rdate"];
|
||||
if(_loc6_["custom"])
|
||||
{
|
||||
_loc11_ = _loc6_["custom"];
|
||||
for each(_loc12_ in _loc11_.children())
|
||||
{
|
||||
_loc5_.CustomData[_loc12_.name()] = _loc12_.text();
|
||||
}
|
||||
}
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
param2 = param2;
|
||||
}
|
||||
|
||||
public static function List(param1:Function = null, param2:Object = null) : void
|
||||
{
|
||||
var _loc13_:String = null;
|
||||
if(param2 == null)
|
||||
{
|
||||
param2 = new Object();
|
||||
}
|
||||
var _loc3_:String = param2.hasOwnProperty("mode") ? param2["mode"] : "popular";
|
||||
var _loc4_:int = param2.hasOwnProperty("page") ? int(param2["page"]) : 1;
|
||||
var _loc5_:int = param2.hasOwnProperty("perpage") ? int(param2["perpage"]) : 20;
|
||||
var _loc6_:String = param2.hasOwnProperty("datemin") ? param2["datemin"] : "";
|
||||
var _loc7_:String = param2.hasOwnProperty("datemax") ? param2["datemax"] : "";
|
||||
var _loc8_:Boolean = param2.hasOwnProperty("data") ? Boolean(param2["data"]) : false;
|
||||
var _loc9_:Boolean = param2.hasOwnProperty("thumbs") ? Boolean(param2["thumbs"]) : false;
|
||||
var _loc10_:Object = param2.hasOwnProperty("customfilters") ? param2["customfilters"] : {};
|
||||
if(KongAPI != null)
|
||||
{
|
||||
if(_loc3_ == "popular")
|
||||
{
|
||||
KongAPI.sharedContent.browse("level",KongAPI.sharedContent.BY_RATING);
|
||||
}
|
||||
else
|
||||
{
|
||||
KongAPI.sharedContent.browse("level",KongAPI.sharedContent.BY_NEWEST);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var _loc11_:Object = new Object();
|
||||
_loc11_["mode"] = _loc3_;
|
||||
_loc11_["page"] = _loc4_;
|
||||
_loc11_["perpage"] = _loc5_;
|
||||
_loc11_["data"] = _loc8_;
|
||||
_loc11_["thumbs"] = _loc9_;
|
||||
_loc11_["datemin"] = _loc6_;
|
||||
_loc11_["datemax"] = _loc7_;
|
||||
var _loc12_:int = 0;
|
||||
if(_loc10_ != null)
|
||||
{
|
||||
for(_loc13_ in _loc10_)
|
||||
{
|
||||
_loc11_["ckey" + _loc12_] = _loc13_;
|
||||
_loc11_["cdata" + _loc12_] = _loc10_[_loc13_];
|
||||
_loc12_++;
|
||||
}
|
||||
}
|
||||
_loc11_["filters"] = _loc12_;
|
||||
Request.Load(SECTION,LIST,ListComplete,param1,_loc11_);
|
||||
}
|
||||
|
||||
private static function ListComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
var _loc7_:XMLList = null;
|
||||
var _loc8_:XML = null;
|
||||
var _loc9_:String = null;
|
||||
var _loc10_:int = 0;
|
||||
var _loc11_:int = 0;
|
||||
var _loc12_:int = 0;
|
||||
var _loc13_:XML = null;
|
||||
var _loc14_:PlayerLevel = null;
|
||||
var _loc15_:XMLList = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:Array = [];
|
||||
var _loc6_:int = 0;
|
||||
if(param4.Success)
|
||||
{
|
||||
_loc7_ = param3["level"];
|
||||
_loc6_ = int(param3["numresults"]);
|
||||
for each(_loc13_ in _loc7_)
|
||||
{
|
||||
_loc9_ = _loc13_["sdate"];
|
||||
_loc10_ = int(_loc9_.substring(_loc9_.lastIndexOf("/") + 1));
|
||||
_loc11_ = int(_loc9_.substring(0,_loc9_.indexOf("/")));
|
||||
_loc12_ = int(_loc9_.substring(_loc9_.indexOf("/") + 1).substring(0,2));
|
||||
_loc14_ = new PlayerLevel();
|
||||
_loc14_.LevelId = _loc13_["levelid"];
|
||||
_loc14_.PlayerId = _loc13_["playerid"];
|
||||
_loc14_.PlayerName = _loc13_["playername"];
|
||||
_loc14_.Name = _loc13_["name"];
|
||||
_loc14_.Score = _loc13_["score"];
|
||||
_loc14_.Rating = _loc13_["rating"];
|
||||
_loc14_.Votes = _loc13_["votes"];
|
||||
_loc14_.Wins = _loc13_["wins"];
|
||||
_loc14_.Starts = _loc13_["starts"];
|
||||
_loc14_.Retries = _loc13_["retries"];
|
||||
_loc14_.Quits = _loc13_["quits"];
|
||||
_loc14_.Flags = _loc13_["flags"];
|
||||
_loc14_.SDate = new Date(_loc10_,_loc11_ - 1,_loc12_);
|
||||
_loc14_.RDate = _loc13_["rdate"];
|
||||
if(_loc13_["data"])
|
||||
{
|
||||
_loc14_.Data = _loc13_["data"];
|
||||
}
|
||||
if(_loc13_["thumb"])
|
||||
{
|
||||
_loc14_.ThumbData = _loc13_["thumb"];
|
||||
}
|
||||
_loc15_ = _loc13_["custom"];
|
||||
if(_loc15_ != null)
|
||||
{
|
||||
for each(_loc8_ in _loc15_.children())
|
||||
{
|
||||
_loc14_.CustomData[_loc8_.name()] = _loc8_.text();
|
||||
}
|
||||
}
|
||||
_loc5_.push(_loc14_);
|
||||
}
|
||||
}
|
||||
param1(_loc5_,_loc6_,param4);
|
||||
param2 = param2;
|
||||
}
|
||||
|
||||
public static function Save(param1:PlayerLevel, param2:DisplayObject = null, param3:Function = null) : void
|
||||
{
|
||||
var postdata:Object;
|
||||
var customfields:int;
|
||||
var kcallback:Function = null;
|
||||
var scale:Number = NaN;
|
||||
var w:int = 0;
|
||||
var h:int = 0;
|
||||
var scaler:Matrix = null;
|
||||
var image:BitmapData = null;
|
||||
var key:String = null;
|
||||
var level:PlayerLevel = param1;
|
||||
var thumb:DisplayObject = param2;
|
||||
var callback:Function = param3;
|
||||
if(KongAPI != null)
|
||||
{
|
||||
kcallback = function(param1:Object):void
|
||||
{
|
||||
level.LevelId = param1["id"];
|
||||
level.Permalink = param1["permalink"];
|
||||
level.Name = param1["name"];
|
||||
if(callback != null)
|
||||
{
|
||||
callback(level,new Response(param1["success"] ? 1 : 0,0));
|
||||
}
|
||||
};
|
||||
KongAPI.sharedContent.save("level",level.Data,kcallback,thumb,level.Name);
|
||||
return;
|
||||
}
|
||||
postdata = new Object();
|
||||
postdata["data"] = level.Data;
|
||||
postdata["playerid"] = level.PlayerId;
|
||||
postdata["playersource"] = level.PlayerSource;
|
||||
postdata["playername"] = level.PlayerName;
|
||||
postdata["name"] = level.Name;
|
||||
if(thumb != null)
|
||||
{
|
||||
scale = 1;
|
||||
w = thumb.width;
|
||||
h = thumb.height;
|
||||
if(thumb.width > 100 || thumb.height > 100)
|
||||
{
|
||||
if(thumb.width >= thumb.height)
|
||||
{
|
||||
scale = 100 / thumb.width;
|
||||
w = 100;
|
||||
h = Math.ceil(scale * thumb.height);
|
||||
}
|
||||
else if(thumb.height > thumb.width)
|
||||
{
|
||||
scale = 100 / thumb.height;
|
||||
w = Math.ceil(scale * thumb.width);
|
||||
h = 100;
|
||||
}
|
||||
}
|
||||
scaler = new Matrix();
|
||||
scaler.scale(scale,scale);
|
||||
image = new BitmapData(w,h,true,0);
|
||||
image.draw(thumb,scaler,null,null,null,true);
|
||||
postdata["image"] = Encode.Base64(Encode.PNG(image));
|
||||
postdata["arrp"] = RandomSample(image);
|
||||
postdata["hash"] = Encode.MD5(postdata["image"] + postdata["arrp"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
postdata["nothumb"] = "y";
|
||||
}
|
||||
customfields = 0;
|
||||
if(level.CustomData != null)
|
||||
{
|
||||
for(key in level.CustomData)
|
||||
{
|
||||
postdata["ckey" + customfields] = key;
|
||||
postdata["cdata" + customfields] = level.CustomData[key];
|
||||
customfields++;
|
||||
}
|
||||
}
|
||||
postdata["customfields"] = customfields;
|
||||
Request.Load(SECTION,SAVE,SaveComplete,callback,postdata);
|
||||
}
|
||||
|
||||
private static function SaveComplete(param1:Function, param2:Object, param3:XML = null, param4:Response = null) : void
|
||||
{
|
||||
var _loc6_:String = null;
|
||||
var _loc7_:String = null;
|
||||
var _loc8_:String = null;
|
||||
var _loc9_:String = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var _loc5_:PlayerLevel = new PlayerLevel();
|
||||
_loc5_.Data = param2["data"];
|
||||
_loc5_.PlayerId = param2["playerid"];
|
||||
_loc5_.PlayerSource = param2["playersource"];
|
||||
_loc5_.PlayerName = param2["playername"];
|
||||
_loc5_.Name = param2["name"];
|
||||
for(_loc6_ in param2)
|
||||
{
|
||||
if(_loc6_.indexOf("ckey") == 0)
|
||||
{
|
||||
_loc7_ = _loc6_.substring(4);
|
||||
_loc8_ = param2["ckey" + _loc7_];
|
||||
_loc9_ = param2["cdata" + _loc7_];
|
||||
_loc5_.CustomData[_loc8_] = _loc9_;
|
||||
}
|
||||
}
|
||||
param2["data"] = _loc5_.Data;
|
||||
param2["playerid"] = _loc5_.PlayerId;
|
||||
param2["playersource"] = _loc5_.PlayerSource;
|
||||
param2["playername"] = _loc5_.PlayerName;
|
||||
param2["name"] = _loc5_.Name;
|
||||
if(param4.Success || param4.ErrorCode == 406)
|
||||
{
|
||||
_loc5_.LevelId = param3["levelid"];
|
||||
_loc5_.SDate = new Date();
|
||||
_loc5_.RDate = "Just now";
|
||||
}
|
||||
param1(_loc5_,param4);
|
||||
}
|
||||
|
||||
private static function KongLevelLoaded(param1:Object) : void
|
||||
{
|
||||
var _loc2_:PlayerLevel = new PlayerLevel();
|
||||
_loc2_.Data = param1["content"];
|
||||
_loc2_.Permalink = param1["permalink"];
|
||||
_loc2_.Name = param1["name"];
|
||||
_loc2_.LevelId = param1["id"];
|
||||
if(KongLevelReceiver != null)
|
||||
{
|
||||
KongLevelReceiver(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function RandomSample(param1:BitmapData) : String
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:String = null;
|
||||
var _loc2_:Array = new Array();
|
||||
while(_loc2_.length < 10)
|
||||
{
|
||||
_loc3_ = Math.random() * param1.width;
|
||||
_loc4_ = Math.random() * param1.height;
|
||||
_loc5_ = param1.getPixel32(_loc3_,_loc4_).toString(16);
|
||||
while(_loc5_.length < 6)
|
||||
{
|
||||
_loc5_ = "0" + _loc5_;
|
||||
}
|
||||
_loc2_.push(_loc3_ + "/" + _loc4_ + "/" + _loc5_);
|
||||
}
|
||||
return _loc2_.join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package Playtomic
|
||||
{
|
||||
public final class PlayerScore
|
||||
{
|
||||
|
||||
public var Name:String;
|
||||
|
||||
public var FBUserId:String;
|
||||
|
||||
public var Points:Number;
|
||||
|
||||
public var Rank:int;
|
||||
|
||||
public var Website:String;
|
||||
|
||||
public var SDate:Date;
|
||||
|
||||
public var RDate:String;
|
||||
|
||||
public var CustomData:Object = {};
|
||||
|
||||
public var SubmittedOrBest:Boolean = false;
|
||||
|
||||
public function PlayerScore(param1:String = "", param2:int = 0)
|
||||
{
|
||||
super();
|
||||
this.Name = param1;
|
||||
this.Points = param2;
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return "Playtomic.PlayerScore:" + "\nRank: " + this.Rank + "\nName: " + this.Name + "\nPoints: " + this.Points;
|
||||
}
|
||||
|
||||
public function toStringAll() : String
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
var _loc1_:String = "Playtomic.PlayerScore:" + "\nRank: " + this.Rank + "\nName: " + this.Name + "\nFBUserId: " + this.FBUserId + "\nPoints: " + this.Points + "\nWebsite: " + this.Website + "\nSDate: " + this.SDate + "\nRDate: " + this.RDate + "\nCustomData: ";
|
||||
for each(_loc2_ in this.CustomData)
|
||||
{
|
||||
_loc1_ += "\n " + _loc2_ + ": " + this.CustomData[_loc2_];
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package Playtomic
|
||||
{
|
||||
public class PrivateLeaderboard
|
||||
{
|
||||
|
||||
public var TableId:String;
|
||||
|
||||
public var Name:String;
|
||||
|
||||
public var Bitly:String;
|
||||
|
||||
public var Permalink:String;
|
||||
|
||||
public var Highest:Boolean = true;
|
||||
|
||||
public var RealName:String;
|
||||
|
||||
public function PrivateLeaderboard(param1:String = null, param2:String = null, param3:String = null, param4:String = null, param5:Boolean = false, param6:String = null)
|
||||
{
|
||||
super();
|
||||
this.TableId = param1;
|
||||
this.Name = param2;
|
||||
this.Bitly = param3;
|
||||
this.Permalink = param4;
|
||||
this.Highest = param5;
|
||||
this.RealName = param6;
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return "Playtomic.PrivateLeaderboard:" + "\nTableId: " + this.TableId + "\nName: " + this.Name + "\nBitly: " + this.Bitly + "\nPermalink: " + this.Permalink + "\nHighest: " + this.Highest + "\nRealName: " + this.RealName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
package Playtomic
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.URLVariables;
|
||||
import flash.utils.ByteArray;
|
||||
import flash.utils.Timer;
|
||||
|
||||
public final class Request extends URLLoader
|
||||
{
|
||||
|
||||
private static var Pool:Vector.<Request>;
|
||||
|
||||
private static var Queue:Vector.<Request>;
|
||||
|
||||
private static var URLStub:String;
|
||||
|
||||
private static var URLTail:String;
|
||||
|
||||
private static var URL:String;
|
||||
|
||||
private var urlRequest:URLRequest = new URLRequest();
|
||||
|
||||
private var complete:Function;
|
||||
|
||||
private var callback:Function;
|
||||
|
||||
private var handled:Boolean;
|
||||
|
||||
private var logging:Boolean;
|
||||
|
||||
private var postdata:Object;
|
||||
|
||||
private var time:int;
|
||||
|
||||
public function Request()
|
||||
{
|
||||
super();
|
||||
addEventListener("ioError",Fail);
|
||||
addEventListener("networkError",Fail);
|
||||
addEventListener("verifyError",Fail);
|
||||
addEventListener("diskError",Fail);
|
||||
addEventListener("securityError",Fail);
|
||||
addEventListener("httpStatus",HTTPStatusIgnore);
|
||||
addEventListener("complete",Complete);
|
||||
}
|
||||
|
||||
internal static function Initialise() : void
|
||||
{
|
||||
Pool = new Vector.<Request>();
|
||||
Queue = new Vector.<Request>();
|
||||
URLStub = "http://g" + Log.GUID + ".api.playtomic.com";
|
||||
URLTail = "swfid=" + Log.SWFID;
|
||||
URL = URLStub + "/v3/api.aspx?" + URLTail;
|
||||
var _loc1_:Timer = new Timer(500);
|
||||
_loc1_.addEventListener("timer",TimeoutHandler);
|
||||
_loc1_.start();
|
||||
var _loc2_:int = 0;
|
||||
while(_loc2_ < 20)
|
||||
{
|
||||
Pool.push(new Request());
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
|
||||
internal static function SendStatistics(param1:Function, param2:String) : void
|
||||
{
|
||||
var _loc3_:Request = Pool.length > 0 ? Pool.pop() : new Request();
|
||||
_loc3_.time = 0;
|
||||
_loc3_.handled = false;
|
||||
_loc3_.complete = param1;
|
||||
_loc3_.callback = null;
|
||||
_loc3_.logging = true;
|
||||
_loc3_.urlRequest.url = URLStub + param2 + (param2.indexOf("?") > -1 ? "&" : "?") + URLTail + "&" + Math.random() + "Z";
|
||||
_loc3_.urlRequest.method = "GET";
|
||||
_loc3_.urlRequest.data = null;
|
||||
_loc3_.postdata = null;
|
||||
_loc3_.load(_loc3_.urlRequest);
|
||||
Queue.push(_loc3_);
|
||||
}
|
||||
|
||||
internal static function Load(param1:String, param2:String, param3:Function, param4:Function, param5:Object = null) : void
|
||||
{
|
||||
var url:String;
|
||||
var timestamp:String;
|
||||
var nonce:String;
|
||||
var pd:Array;
|
||||
var request:Request = null;
|
||||
var key:String = null;
|
||||
var pda:ByteArray = null;
|
||||
var postvars:URLVariables = null;
|
||||
var section:String = param1;
|
||||
var action:String = param2;
|
||||
var complete:Function = param3;
|
||||
var callback:Function = param4;
|
||||
var postdata:Object = param5;
|
||||
request = Pool.length > 0 ? Pool.pop() : new Request();
|
||||
request.time = 0;
|
||||
request.handled = false;
|
||||
request.complete = complete;
|
||||
request.callback = callback;
|
||||
request.logging = false;
|
||||
url = URL + "&r=" + Math.random() + "Z";
|
||||
timestamp = String(new Date().time).substring(0,10);
|
||||
nonce = Encode.MD5(new Date().time * Math.random() + Log.GUID);
|
||||
pd = new Array();
|
||||
pd.push("nonce=" + nonce);
|
||||
pd.push("timestamp=" + timestamp);
|
||||
for(key in postdata)
|
||||
{
|
||||
pd.push(key + "=" + Escape(postdata[key]));
|
||||
}
|
||||
pd.sort();
|
||||
GenerateKey("section",section,pd);
|
||||
GenerateKey("action",action,pd);
|
||||
GenerateKey("signature",nonce + timestamp + section + action + url + Log.GUID,pd);
|
||||
pda = new ByteArray();
|
||||
pda.writeUTFBytes(pd.join("&"));
|
||||
pda.position = 0;
|
||||
postvars = new URLVariables();
|
||||
postvars["data"] = Escape(Encode.Base64(pda));
|
||||
request.urlRequest.url = url;
|
||||
request.urlRequest.method = "POST";
|
||||
request.urlRequest.data = postvars;
|
||||
request.postdata = postdata;
|
||||
try
|
||||
{
|
||||
request.load(request.urlRequest);
|
||||
}
|
||||
catch(s:Error)
|
||||
{
|
||||
request.complete(request.callback,request.postdata,null,new Response(0,1));
|
||||
}
|
||||
Queue.push(request);
|
||||
}
|
||||
|
||||
internal static function Escape(param1:String) : String
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
param1 = param1.split("%").join("%25");
|
||||
param1 = param1.split(";").join("%3B");
|
||||
param1 = param1.split("?").join("%3F");
|
||||
param1 = param1.split("/").join("%2F");
|
||||
param1 = param1.split(":").join("%3A");
|
||||
param1 = param1.split("#").join("%23");
|
||||
param1 = param1.split("&").join("%26");
|
||||
param1 = param1.split("=").join("%3D");
|
||||
param1 = param1.split("+").join("%2B");
|
||||
param1 = param1.split("$").join("%24");
|
||||
param1 = param1.split(",").join("%2C");
|
||||
param1 = param1.split(" ").join("%20");
|
||||
param1 = param1.split("<").join("%3C");
|
||||
param1 = param1.split(">").join("%3E");
|
||||
return param1.split("~").join("%7E");
|
||||
}
|
||||
|
||||
private static function GenerateKey(param1:String, param2:String, param3:Array) : void
|
||||
{
|
||||
param3.sort();
|
||||
param3.push(param1 + "=" + Encode.MD5(param3.join("&") + param2));
|
||||
}
|
||||
|
||||
private static function TimeoutHandler(param1:Event) : void
|
||||
{
|
||||
var _loc2_:Request = null;
|
||||
var _loc3_:* = int(Queue.length - 1);
|
||||
for(; _loc3_ > -1; _loc3_--)
|
||||
{
|
||||
_loc2_ = Queue[_loc3_];
|
||||
if(!_loc2_.handled)
|
||||
{
|
||||
++_loc2_.time;
|
||||
if(_loc2_.time < 40)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(_loc2_.logging)
|
||||
{
|
||||
_loc2_.complete(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_.complete(_loc2_.callback,_loc2_.postdata,null,new Response(0,3));
|
||||
}
|
||||
}
|
||||
Queue.splice(_loc3_,1);
|
||||
Dispose(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function Complete(param1:Event) : void
|
||||
{
|
||||
var _loc2_:Request = param1.target as Request;
|
||||
if(_loc2_.handled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_loc2_.handled = true;
|
||||
if(_loc2_.logging)
|
||||
{
|
||||
_loc2_.complete(true);
|
||||
return;
|
||||
}
|
||||
var _loc3_:XML = XML(_loc2_.data);
|
||||
var _loc4_:int = parseInt(_loc3_["status"]);
|
||||
var _loc5_:int = parseInt(_loc3_["errorcode"]);
|
||||
_loc2_.complete(_loc2_.callback,_loc2_.postdata,_loc3_,new Response(_loc4_,_loc5_));
|
||||
}
|
||||
|
||||
private static function Fail(param1:Event) : void
|
||||
{
|
||||
var _loc2_:Request = param1.target as Request;
|
||||
if(_loc2_.handled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_loc2_.handled = true;
|
||||
if(_loc2_.logging)
|
||||
{
|
||||
_loc2_.complete(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_.complete(_loc2_.callback,_loc2_.postdata,null,new Response(0,1));
|
||||
}
|
||||
}
|
||||
|
||||
private static function HTTPStatusIgnore(param1:Event) : void
|
||||
{
|
||||
}
|
||||
|
||||
private static function Dispose(param1:Request) : void
|
||||
{
|
||||
if(!param1.handled)
|
||||
{
|
||||
param1.handled = true;
|
||||
param1.close();
|
||||
}
|
||||
Pool.push(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package Playtomic
|
||||
{
|
||||
public class Response
|
||||
{
|
||||
|
||||
private static const ERRORS:Object = new Object();
|
||||
|
||||
ERRORS[0] = "Nothing went wrong!";
|
||||
ERRORS[1] = "General error, this typically means the player is unable to connect to the Playtomic servers";
|
||||
ERRORS[2] = "Invalid game credentials. Make sure you use your SWFID and GUID from the `API` section in the dashboard.";
|
||||
ERRORS[3] = "Request timed out.";
|
||||
ERRORS[4] = "Invalid request.";
|
||||
ERRORS[100] = "GeoIP API has been disabled. This may occur if your game is faulty or overwhelming the Playtomic servers.";
|
||||
ERRORS[200] = "Leaderboard API has been disabled. This may occur if your game is faulty or overwhelming the Playtomic servers.";
|
||||
ERRORS[201] = "The source URL or name weren\'t provided when saving a score. Make sure the player specifies a name and the game is initialized before anything else using the code in the `Set your game up` section.";
|
||||
ERRORS[202] = "Invalid auth key. You should not see this normally, players might if they tamper with your game.";
|
||||
ERRORS[203] = "No Facebook user id on a score specified as a Facebook submission.";
|
||||
ERRORS[204] = "Table name wasn\'t specified for creating a private leaderboard.";
|
||||
ERRORS[205] = "Permalink structure wasn\'t specified: http://website.com/game/whatever?leaderboard=";
|
||||
ERRORS[206] = "Leaderboard id wasn\'t provided loading a private leaderboard.";
|
||||
ERRORS[207] = "Invalid leaderboard id was provided for a private leaderboard.";
|
||||
ERRORS[208] = "Player is banned from submitting scores in your game.";
|
||||
ERRORS[209] = "Score was not the player\'s best score. You can notify the player, or circumvent this by pecifying \'allowduplicates\' to be true in your save options.";
|
||||
ERRORS[300] = "GameVars API has been disabled. This may occur if your game is faulty or overwhelming the Playtomic servers.";
|
||||
ERRORS[400] = "Level sharing API has been disabled. This may occur if your game is faulty or overwhelming the Playtomic servers.";
|
||||
ERRORS[401] = "Invalid rating value (must be 1 - 10).";
|
||||
ERRORS[402] = "Player has already rated that level.";
|
||||
ERRORS[403] = "The level name wasn\'t provided when saving a level.";
|
||||
ERRORS[404] = "Invalid image auth. You should not see this normally, players might if they tamper with your game.";
|
||||
ERRORS[405] = "Invalid image auth (again). You should not see this normally, players might if they tamper with your game.";
|
||||
ERRORS[500] = "Data API has been disabled. This may occur if the Data API is not enabled for your game, or your game is faulty or overwhelming the Playtomic servers.";
|
||||
ERRORS[600] = "You have not configured your Parse.com database. Sign up at Parse and then enter your API credentials in your Playtomic dashboard.";
|
||||
ERRORS[601] = "No response was returned from Parse. If you experience this a lot let us know exactly what you\'re doing so we can sort out a fix for it.";
|
||||
ERRORS[6021] = "Parse\'s servers had an error.";
|
||||
ERRORS[602101] = "Object not found. Make sure you include the classname and objectid and that they are correct.";
|
||||
ERRORS[602102] = "Invalid query. If you think you\'re doing it right let us know what you\'re doing and we\'ll look into it.";
|
||||
ERRORS[602103] = "Invalid classname.";
|
||||
ERRORS[602104] = "Missing objectid.";
|
||||
ERRORS[602105] = "Invalid key name.";
|
||||
ERRORS[602106] = "Invalid pointer.";
|
||||
ERRORS[602107] = "Invalid JSON.";
|
||||
ERRORS[602108] = "Command unavailable.";
|
||||
|
||||
public var Success:Boolean = false;
|
||||
|
||||
public var ErrorCode:int = 0;
|
||||
|
||||
public function Response(param1:int, param2:int)
|
||||
{
|
||||
super();
|
||||
this.Success = param1 == 1;
|
||||
this.ErrorCode = param2;
|
||||
}
|
||||
|
||||
public function get ErrorMessage() : String
|
||||
{
|
||||
return ERRORS[this.ErrorCode];
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return "Playtomic.Response:" + "\nSuccess: " + this.Success + "\nErrorCode: " + this.ErrorCode + "\nErrorMessage: " + this.ErrorMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user