package com.arc.dh.util { import com.arc.dh.Gun; import com.arc.dh.state.FlxKongregate; import com.arc.dh.state.PlayMode; public class Data { public static var state:PlayMode; public static const DEBUG:Boolean = false; private static var _hpm:int = 3; public static var vitality:int = 0; public static var hp:int = hpm; public static var heartcrystals:Array = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; public static var diamonds:int = 0; public static var totaldiamonds:int = 0; public static var agility:int = 0; public static var jump:int = 0; public static var attract:int = 0; public static var recover:int = 0; public static var aegis:int = 0; public static var defense:int = 0; public static var primegun:Array = [0,0,0,0]; public static var spreadergun:Array = [0,0,0,0]; public static var missilegun:Array = [0,0,0,0]; public static var reboundgun:Array = [0,0,0,0]; public static var prime:int = 0; public static var spreader:int = 0; public static var missile:int = 0; public static var rebound:int = 0; public static var autofirer:int = 0; public static var lasersight:int = 0; public static var skyboots:int = 0; public static var moltensuit:int = 0; public static var moonboots:int = 0; public static var xrayscope:int = 0; public static var gun:String = Gun.PRIME; public static var maxheight:int = 0; public static var enemies:int = 0; public static var deaths:int = 0; public static var bullets:int = 0; public static var time:Number = 0; public static var ctime:Number = 0; public static var boxes:int = 0; public static var pots:int = 0; public static var powerups:int = 0; public static var maxRunDistance:int = 0; public static var maxTadpoleDistance:int = 0; public static const CONTROL_MOUSE:int = 0; public static const CONTROL_KEYBOARD:int = 1; public static const CONTROL_KEYBOARDI:int = 2; public static var control:int = CONTROL_MOUSE; public static const SPEED_SLOW:int = 0; public static const SPEED_MED:int = 1; public static const SPEED_FAST:int = 2; public static var textspeed:int = SPEED_MED; public static const ON:int = 0; public static const OFF:int = 1; public static var sound:int = ON; public static var music:int = ON; public static var escape:Array = [1,0,0,0,0,0]; public static var boss:Array = [0,0,0,0]; public static var redDiamonds:Array = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; public static var chapters:Array = [[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]]; public static var achievements:Array = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; public static var autofire:Boolean = false; public static const GAMEID:int = 4357; public static const GUID:String = "04f5a410aedc4d46"; public static const API_KEY:String = "55d1b5c4fb01405883aab993346490"; if(DEBUG) { agility = jump = attract = recover = aegis = defense = 10; primegun = [10,10,1,1]; prime = 1; chapters = [[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0]]; boss = [1,1,0,0]; vitality = 17; moonboots = 1; skyboots = 1; } public function Data() { super(); } public static function get completion() : String { var _loc1_:Number = 0; var _loc2_:Number = 0; _loc1_ += getAchievementCount(false); _loc2_ += 40; _loc1_ += upgrades; _loc2_ += 60; _loc1_ += guns; _loc2_ += 88; _loc1_ += vitality * 2; _loc2_ += 17 * 2; _loc1_ += chapterCount * 3; _loc2_ += 7 * 3; _loc1_ += redDiamondCount * 2; _loc2_ += 35 * 2; return (_loc1_ / _loc2_ * 100).toFixed(2); } public static function get redDiamondCount() : int { var _loc1_:int = 0; var _loc2_:int = 0; while(_loc2_ < redDiamonds.length) { _loc1_ += redDiamonds[_loc2_]; _loc2_++; } return _loc1_; } public static function get chapterCount() : int { var _loc1_:int = 0; var _loc2_:int = 0; while(_loc2_ < chapters.length) { _loc1_ += chapters[_loc2_][0] > 0 ? 1 : 0; _loc2_++; } return _loc1_; } public static function get upgrades() : int { return agility + jump + attract + recover + aegis + defense; } public static function get guns() : int { return primegun[0] + primegun[1] + primegun[2] + primegun[3] + spreadergun[0] + spreadergun[1] + spreadergun[2] + spreadergun[3] + missilegun[0] + missilegun[1] + missilegun[2] + missilegun[3] + reboundgun[0] + reboundgun[1] + reboundgun[2] + reboundgun[3]; } public static function getAchievementCount(param1:Boolean = true) : int { var _loc2_:int = 0; var _loc3_:int = 0; while(_loc3_ < achievements.length) { if(param1 || _loc3_ < 40) { _loc2_ += achievements[_loc3_]; } _loc3_++; } return _loc2_; } public static function get hpm() : int { return _hpm + vitality; } public static function duration(param1:int, param2:int) : String { var _loc3_:int = (param2 - param1) / 1000; var _loc4_:Number = _loc3_ % 60; _loc3_ /= 60; var _loc5_:Number = _loc3_ % 60; _loc3_ /= 60; var _loc6_:Number = _loc3_; return (_loc6_ < 10 ? "0" + _loc6_ : _loc6_.toString()) + ":" + (_loc5_ < 10 ? "0" + _loc5_ : _loc5_.toString()) + ":" + (_loc4_ < 10 ? "0" + _loc4_ : _loc4_.toString()); } public static function hasRed(param1:int, param2:int) : Boolean { return redDiamonds[(param1 - 1) * 5 + param2] == 1; } public static function obtainRed(param1:int, param2:int) : void { redDiamonds[(param1 - 1) * 5 + param2] = 1; } public static function reset() : void { vitality = 0; hp = hpm; heartcrystals = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; diamonds = 0; totaldiamonds = 0; agility = 0; jump = 0; attract = 0; recover = 0; aegis = 0; defense = 0; primegun = [0,0,0,0]; spreadergun = [0,0,0,0]; missilegun = [0,0,0,0]; reboundgun = [0,0,0,0]; prime = 0; spreader = 0; missile = 0; rebound = 0; autofirer = 0; lasersight = 0; skyboots = 0; moltensuit = 0; moonboots = 0; xrayscope = 0; maxheight = 0; enemies = 0; deaths = 0; bullets = 0; time = 0; ctime = 0; boxes = 0; pots = 0; powerups = 0; control = CONTROL_MOUSE; textspeed = SPEED_MED; sound = ON; music = ON; escape = [1,0,0,0,0,0]; boss = [0,0,0,0]; maxRunDistance = 0; maxTadpoleDistance = 0; redDiamonds = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; chapters = [[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]]; achievements = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; autofire = false; } public static function kong() : void { var _loc6_:int = 0; if(!Config.externalAPIs()) { return; } var _loc1_:int = 0; var _loc2_:int = 0; while(_loc2_ < 7) { if(Data.chapters[_loc2_][0] > 0) { _loc1_ = _loc2_ + 1; } _loc2_++; } FlxKongregate.submitStats("chapters_complete",_loc1_); FlxKongregate.submitStats("escape_height",Data.maxheight); FlxKongregate.submitStats("run_distance",Data.maxRunDistance); FlxKongregate.submitStats("tadpole_distance",Data.maxTadpoleDistance); FlxKongregate.submitStats("enemies_killed",Data.enemies); _loc1_ = 0; _loc2_ = 0; while(_loc2_ < Data.heartcrystals.length) { _loc1_ += Data.heartcrystals[_loc2_]; _loc2_++; } FlxKongregate.submitStats("heart_crystals",_loc1_); FlxKongregate.submitStats("num_upgrades",Data.guns + Data.upgrades); FlxKongregate.submitStats("total_diamonds",Data.totaldiamonds); _loc1_ = 0; _loc2_ = 0; while(_loc2_ < Data.redDiamonds.length) { _loc1_ += Data.redDiamonds[_loc2_]; _loc2_++; } FlxKongregate.submitStats("red_diamonds",_loc1_); var _loc3_:int = Math.floor(parseFloat(Data.completion)); FlxKongregate.submitStats("completion_percent_v2",_loc3_); var _loc4_:int = (Data.boss[1] as int) / 1000; var _loc5_:int = (Data.boss[3] as int) / 1000; FlxKongregate.submitStats("normal_boss_time_v2",_loc4_ > 0 ? _loc4_ : 9999); FlxKongregate.submitStats("heroic_boss_time_v2",_loc5_ > 0 ? _loc5_ : 9999); _loc1_ = 0; _loc2_ = 0; while(_loc2_ < Data.chapters.length) { _loc6_ = Data.chapters[_loc2_][1] / 1000; if(_loc6_ > 0) { _loc1_ += _loc6_; } else { _loc1_ += 9999; } _loc2_++; } FlxKongregate.submitStats("chapter_speed",_loc1_); } } }