mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 01:27:51 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,85 @@
|
||||
package pet
|
||||
{
|
||||
import diamond.DiamondItem;
|
||||
import diamond.DiamondXtCommManager;
|
||||
import gui.DarkenManager;
|
||||
import gui.EggPetHatchedPopup;
|
||||
import gui.EggPetPurchasePopup;
|
||||
import gui.GuiManager;
|
||||
import inventory.Iitem;
|
||||
|
||||
public class EggPetGuiManager
|
||||
{
|
||||
|
||||
private static var _eggPetPurchasePopup:EggPetPurchasePopup;
|
||||
|
||||
private static var _eggPetHatchedPopup:EggPetHatchedPopup;
|
||||
|
||||
private static var _eggPetList:Array;
|
||||
|
||||
public function EggPetGuiManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function openEggPetPurchasePopup() : void
|
||||
{
|
||||
var _loc1_:Iitem = null;
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
if(_eggPetList == null)
|
||||
{
|
||||
GenericListXtCommManager.requestGenericList(624,onEggPetListLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = _eggPetList[Math.floor(Math.random() * _eggPetList.length)];
|
||||
_eggPetPurchasePopup = new EggPetPurchasePopup(_loc1_,onEggPetPurchaseClose);
|
||||
}
|
||||
}
|
||||
|
||||
public static function openEggHatchedPopup(param1:Array) : void
|
||||
{
|
||||
_eggPetHatchedPopup = new EggPetHatchedPopup(param1,eggHatchedPopupClose);
|
||||
}
|
||||
|
||||
private static function onEggPetPurchaseClose() : void
|
||||
{
|
||||
_eggPetPurchasePopup = null;
|
||||
}
|
||||
|
||||
private static function eggHatchedPopupClose() : void
|
||||
{
|
||||
_eggPetHatchedPopup = null;
|
||||
GuiManager.guiStartupChecks(true);
|
||||
}
|
||||
|
||||
private static function onEggPetListLoaded(param1:int, param2:Array) : void
|
||||
{
|
||||
var _loc3_:PetDef = null;
|
||||
var _loc7_:Iitem = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:DiamondItem = null;
|
||||
var _loc6_:int = 8;
|
||||
var _loc8_:int = int(param2[_loc6_++]);
|
||||
_eggPetList = [];
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc8_)
|
||||
{
|
||||
_loc4_ = DiamondXtCommManager.getDiamondItem(int(param2[_loc6_++]));
|
||||
if(_loc4_.isPet)
|
||||
{
|
||||
_loc3_ = PetManager.getPetDef(_loc4_.refDefId);
|
||||
if(_loc3_ && _loc3_.isEgg)
|
||||
{
|
||||
_loc7_ = new PetItem();
|
||||
(_loc7_ as PetItem).init(0,_loc4_.refDefId,null,0,0,0,0,null,true,null,_loc4_);
|
||||
_eggPetList.push(_loc7_);
|
||||
}
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
openEggPetPurchasePopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package pet
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class GuiPet extends PetBase
|
||||
{
|
||||
|
||||
public var idx:int;
|
||||
|
||||
private var _petName:String;
|
||||
|
||||
private var _onPetLoadedCallback:Function;
|
||||
|
||||
public function GuiPet(param1:Number, param2:int, param3:uint, param4:uint, param5:uint, param6:int, param7:String, param8:int, param9:int, param10:int, param11:Function)
|
||||
{
|
||||
_onPetLoadedCallback = param11;
|
||||
super(param1,param3,param4,param5,param8,param9,param10,onPetLoaded);
|
||||
this.idx = param2;
|
||||
_petName = param7;
|
||||
}
|
||||
|
||||
public function set petName(param1:String) : void
|
||||
{
|
||||
_petName = param1;
|
||||
}
|
||||
|
||||
public function get petName() : String
|
||||
{
|
||||
if(_petDef.isEgg && !PetManager.hasHatched(_createdTs))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return LocalizationManager.translatePetName(_petName);
|
||||
}
|
||||
|
||||
public function get createdTs() : Number
|
||||
{
|
||||
return _createdTs;
|
||||
}
|
||||
|
||||
public function clone(param1:Function) : GuiPet
|
||||
{
|
||||
return new GuiPet(_createdTs,idx,_lBits,_uBits,_eBits,getType(),_petName,_traitDefId,_toyDefId,_foodDefId,param1);
|
||||
}
|
||||
|
||||
private function onPetLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(_onPetLoadedCallback != null)
|
||||
{
|
||||
_onPetLoadedCallback(param1,this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,481 @@
|
||||
package pet
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class PetBase extends Sprite
|
||||
{
|
||||
|
||||
public static const DEF_ID_CAT:int = 1;
|
||||
|
||||
public static const DEF_ID_FROG:int = 2;
|
||||
|
||||
public static const DEF_ID_DUCK:int = 3;
|
||||
|
||||
public static const DEF_ID_DOG:int = 4;
|
||||
|
||||
public static const DEF_ID_BFLY:int = 5;
|
||||
|
||||
public static const DEF_ID_HAMS:int = 6;
|
||||
|
||||
public static const DEF_ID_BAT:int = 7;
|
||||
|
||||
public static const DEF_ID_SEAHORSE:int = 8;
|
||||
|
||||
public static const DEF_ID_ANGLER:int = 9;
|
||||
|
||||
public static const DEF_ID_REINDEER:int = 10;
|
||||
|
||||
public static const DEF_ID_SNAKE:int = 11;
|
||||
|
||||
public static const DEF_ID_JELLYFISH:int = 12;
|
||||
|
||||
public static const DEF_ID_BUNNY:int = 13;
|
||||
|
||||
public static const DEF_ID_HUMMINGBIRD:int = 14;
|
||||
|
||||
public static const DEF_ID_TURTLE:int = 15;
|
||||
|
||||
public static const DEF_ID_MONKEY:int = 16;
|
||||
|
||||
public static const DEF_ID_TARANTUAL:int = 17;
|
||||
|
||||
public static const DEF_ID_FOX:int = 18;
|
||||
|
||||
public static const DEF_ID_OWL:int = 19;
|
||||
|
||||
public static const DEF_ID_TIGER:int = 20;
|
||||
|
||||
public static const DEF_ID_ARCTIC_WOLF:int = 21;
|
||||
|
||||
public static const DEF_ID_RACCOON:int = 22;
|
||||
|
||||
public static const DEF_ID_JOEY:int = 23;
|
||||
|
||||
public static const DEF_ID_EAGLET:int = 24;
|
||||
|
||||
public static const DEF_ID_CHEETAH:int = 25;
|
||||
|
||||
public static const DEF_ID_RHINO:int = 26;
|
||||
|
||||
public static const DEF_ID_GIRAFFE:int = 27;
|
||||
|
||||
public static const DEF_ID_SUGAR_GLIDER:int = 28;
|
||||
|
||||
public static const DEF_ID_LION_CUB:int = 29;
|
||||
|
||||
public static const DEF_ID_PANDA:int = 30;
|
||||
|
||||
public static const DEF_ID_POLAR_BEAR_CUB:int = 31;
|
||||
|
||||
public static const DEF_ID_GECKO:int = 32;
|
||||
|
||||
public static const DEF_ID_PONY:int = 34;
|
||||
|
||||
public static const DEF_ID_PIGLET:int = 35;
|
||||
|
||||
public static const DEF_ID_FERRET:int = 36;
|
||||
|
||||
public static const DEF_ID_ELEPHANT:int = 37;
|
||||
|
||||
public static const DEF_ID_ARMADILLO:int = 38;
|
||||
|
||||
public static const DEF_ID_PEACOCK:int = 39;
|
||||
|
||||
public static const DEF_ID_BEE:int = 40;
|
||||
|
||||
public static const DEF_ID_ROOSTER:int = 41;
|
||||
|
||||
public static const DEF_ID_SKUNK:int = 42;
|
||||
|
||||
public static const DEF_ID_TURKEY:int = 43;
|
||||
|
||||
public static const DEF_ID_PENGUIN:int = 44;
|
||||
|
||||
public static const DEF_ID_SNOW_LEOPARD:int = 45;
|
||||
|
||||
public static const DEF_ID_MANITS:int = 46;
|
||||
|
||||
public static const DEF_ID_LADYBUG:int = 47;
|
||||
|
||||
public static const DEF_ID_CRICKET:int = 48;
|
||||
|
||||
public static const DEF_ID_SQUIRREL:int = 49;
|
||||
|
||||
public static const DEF_ID_MOUSE:int = 50;
|
||||
|
||||
public static const DEF_ID_FIREFLY:int = 51;
|
||||
|
||||
public static const DEF_ID_LEMUR:int = 52;
|
||||
|
||||
public static const DEF_ID_HIPPO:int = 53;
|
||||
|
||||
public static const DEF_ID_GOAT:int = 54;
|
||||
|
||||
public static const DEF_ID_MEERKAT:int = 55;
|
||||
|
||||
public static const DEF_ID_GOLDEN_BUNNY:int = 56;
|
||||
|
||||
public static const DEF_ID_PHANTOM:int = 57;
|
||||
|
||||
public static const DEF_ID_SEAL:int = 58;
|
||||
|
||||
public static const DEF_ID_OTTER:int = 59;
|
||||
|
||||
public static const DEF_ID_PHANTOM_RARE:int = 60;
|
||||
|
||||
public static const DEF_ID_GROUND_HOG:int = 61;
|
||||
|
||||
public static const DEF_ID_LLAMA:int = 62;
|
||||
|
||||
public static const DEF_ID_ARCTIC_FOX:int = 63;
|
||||
|
||||
public static const DEF_ID_HYENA:int = 64;
|
||||
|
||||
public static const DEF_ID_SLOTH:int = 65;
|
||||
|
||||
public static const DEF_ID_DOVE:int = 66;
|
||||
|
||||
public static const DEF_ID_CHICK:int = 67;
|
||||
|
||||
public static const DEF_ID_GOLDEN_ARMADILLO:int = 68;
|
||||
|
||||
public static const DEF_ID_FALCON:int = 69;
|
||||
|
||||
public static const DEF_ID_CROCODILE:int = 70;
|
||||
|
||||
public static const DEF_ID_PLATYPUS:int = 71;
|
||||
|
||||
public static const DEF_ID_PHANTOM_JW:int = 72;
|
||||
|
||||
public static const DEF_ID_GOLDEN_PONY:int = 73;
|
||||
|
||||
public static const DEF_ID_SHARK:int = 74;
|
||||
|
||||
public static const DEF_ID_DOLPHIN:int = 75;
|
||||
|
||||
public static const DEF_ID_ECHIDNA:int = 76;
|
||||
|
||||
public static const DEF_ID_KOALA:int = 77;
|
||||
|
||||
public static const DEF_ID_LYNX:int = 80;
|
||||
|
||||
public static const DEF_ID_OCTOPUS:int = 81;
|
||||
|
||||
public static const DEF_ID_FENNEC_FOX_JW:int = 82;
|
||||
|
||||
public static const DEF_ID_HEDGEHOG:int = 83;
|
||||
|
||||
public static const DEF_ID_SCORPION:int = 84;
|
||||
|
||||
public static const DEF_ID_CROW:int = 85;
|
||||
|
||||
public static const DEF_ID_MOOSE:int = 86;
|
||||
|
||||
public static const DEF_ID_POODLE:int = 87;
|
||||
|
||||
public static const DEF_ID_LOVEBUNNY:int = 88;
|
||||
|
||||
public static const DEF_ID_SABERTOOTH:int = 89;
|
||||
|
||||
public static const DEF_ID_DIREWOLF:int = 90;
|
||||
|
||||
public static const DEF_ID_DODO:int = 91;
|
||||
|
||||
public static const DEF_ID_FANTASY_PEACOCK:int = 92;
|
||||
|
||||
public static const DEF_ID_MILLIPEDE:int = 93;
|
||||
|
||||
public static const DEF_ID_MOTH:int = 94;
|
||||
|
||||
public static const DEF_ID_VULTURE:int = 95;
|
||||
|
||||
public static const DEF_ID_COYOTE:int = 96;
|
||||
|
||||
public static const DEF_ID_MEAGYNS:int = 97;
|
||||
|
||||
public static const DEF_ID_FALCON2:int = 98;
|
||||
|
||||
public static const DEF_ID_LOVE_BUG:int = 99;
|
||||
|
||||
public static const DEF_ID_FLYING_PIG:int = 100;
|
||||
|
||||
public static const DEF_ID_SPARROW:int = 101;
|
||||
|
||||
public static const DEF_ID_FENNEC_FOX:int = 102;
|
||||
|
||||
public static const DEF_ID_CARDINAL:int = 103;
|
||||
|
||||
public static const DEF_ID_FRILLED_LIZARD:int = 104;
|
||||
|
||||
public static const DEF_ID_DRAGONFLY:int = 105;
|
||||
|
||||
public static const DEF_ID_MAGENTA_SEAL:int = 106;
|
||||
|
||||
public static const DEF_ID_PANGOLIN:int = 107;
|
||||
|
||||
public static const DEF_ID_CAMEL:int = 108;
|
||||
|
||||
public static const DEF_ID_SNAIL:int = 109;
|
||||
|
||||
public static const DEF_ID_GALACTIC_FIREFLY:int = 110;
|
||||
|
||||
public static const DEF_ID_CATERPILLAR:int = 111;
|
||||
|
||||
public static const DEF_ID_LAMB:int = 112;
|
||||
|
||||
public static const DEF_ID_GOLDEN_REINDEER:int = 113;
|
||||
|
||||
public static const DEF_ID_HIGHLANDCOW:int = 114;
|
||||
|
||||
public static const DEF_ID_NIGHTHAWK:int = 115;
|
||||
|
||||
public static const DEF_ID_FRANKENKITTEN:int = 116;
|
||||
|
||||
public static const TYPE_LAND_GROUND:int = 0;
|
||||
|
||||
public static const TYPE_LAND_AIR:int = 1;
|
||||
|
||||
public static const TYPE_OCEAN_GROUND:int = 2;
|
||||
|
||||
public static const TYPE_OCEAN_AIR:int = 3;
|
||||
|
||||
public static const TYPE_AMPHIB_GROUND:int = 4;
|
||||
|
||||
public static const TYPE_AMPHIB_AIR:int = 5;
|
||||
|
||||
protected var _petDef:PetDef;
|
||||
|
||||
protected var _lBits:uint;
|
||||
|
||||
protected var _uBits:uint;
|
||||
|
||||
protected var _eBits:uint;
|
||||
|
||||
protected var _traitDefId:uint;
|
||||
|
||||
protected var _toyDefId:uint;
|
||||
|
||||
protected var _foodDefId:uint;
|
||||
|
||||
protected var _content:MovieClip;
|
||||
|
||||
protected var _createdTs:Number;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _onPetLoadedCallback:Function;
|
||||
|
||||
public function PetBase(param1:Number, param2:uint, param3:uint, param4:uint, param5:uint, param6:uint, param7:uint, param8:Function)
|
||||
{
|
||||
super();
|
||||
_createdTs = param1;
|
||||
_lBits = param2;
|
||||
_uBits = param3;
|
||||
_eBits = param4;
|
||||
_traitDefId = param5;
|
||||
_toyDefId = param6;
|
||||
_foodDefId = param7;
|
||||
_onPetLoadedCallback = param8;
|
||||
_petDef = PetManager.getPetDef(param2 & 0xFF);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(mediaIdForDefId(_petDef.defId),onMediaLoaded,true);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function getPetTitleName() : String
|
||||
{
|
||||
return LocalizationManager.translateIdOnly(_petDef.titleStrId);
|
||||
}
|
||||
|
||||
public function isGround() : Boolean
|
||||
{
|
||||
if(_petDef.isEgg && !PetManager.hasHatched(_createdTs))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return PetManager.isGround(_petDef.type);
|
||||
}
|
||||
|
||||
public function isEggAndHasNotHatched() : Boolean
|
||||
{
|
||||
if(_petDef.isEgg)
|
||||
{
|
||||
return PetManager.hasHatched(_createdTs) == false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isEgg() : Boolean
|
||||
{
|
||||
return _petDef.isEgg;
|
||||
}
|
||||
|
||||
public function getType() : int
|
||||
{
|
||||
return _petDef.type;
|
||||
}
|
||||
|
||||
public function getDefID() : int
|
||||
{
|
||||
return _petDef.defId;
|
||||
}
|
||||
|
||||
public function canGoInOcean() : Boolean
|
||||
{
|
||||
if(_petDef.type == 2 || _petDef.type == 3 || _petDef.type == 4 || _petDef.type == 5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function canGoOnLand() : Boolean
|
||||
{
|
||||
if(_petDef.type == 0 || _petDef.type == 1 || _petDef.type == 4 || _petDef.type == 5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getLBits() : uint
|
||||
{
|
||||
return _lBits;
|
||||
}
|
||||
|
||||
public function getUBits() : uint
|
||||
{
|
||||
return _uBits;
|
||||
}
|
||||
|
||||
public function getEBits() : uint
|
||||
{
|
||||
return _eBits;
|
||||
}
|
||||
|
||||
public function getContent() : MovieClip
|
||||
{
|
||||
return _content;
|
||||
}
|
||||
|
||||
public function getCreatedTs() : Number
|
||||
{
|
||||
return _createdTs;
|
||||
}
|
||||
|
||||
public function colorMyItem(param1:int, param2:MovieClip, param3:int, param4:int, param5:int, param6:int, param7:int, param8:int) : void
|
||||
{
|
||||
if(_content)
|
||||
{
|
||||
_content.colorMe(param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateAllBits(param1:uint, param2:uint, param3:uint) : void
|
||||
{
|
||||
if(_content)
|
||||
{
|
||||
_lBits = param1;
|
||||
_uBits = param2;
|
||||
_eBits = param3;
|
||||
PetManager.setPetState(_content,_lBits,_uBits,_eBits);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateUBits(param1:uint) : void
|
||||
{
|
||||
_uBits = param1;
|
||||
PetManager.setPetState(_content,_lBits,_uBits,_eBits);
|
||||
}
|
||||
|
||||
public function animatePet(param1:Boolean) : void
|
||||
{
|
||||
if(_content && "willItAnimate" in _content.pet)
|
||||
{
|
||||
_content.pet.willItAnimate(param1);
|
||||
}
|
||||
}
|
||||
|
||||
protected function setSparkle(param1:int) : void
|
||||
{
|
||||
if(_content)
|
||||
{
|
||||
_content.pet.setSparkle(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
_content = param1;
|
||||
this.addChild(_content);
|
||||
_mediaHelper.destroy();
|
||||
delete _content.mediaHelper;
|
||||
delete _content.passback;
|
||||
PetManager.setPetState(_content,_lBits,_uBits,_eBits);
|
||||
if(_onPetLoadedCallback != null)
|
||||
{
|
||||
_onPetLoadedCallback(_content);
|
||||
}
|
||||
_content.pet.setAnim(0);
|
||||
if(_petDef.isEgg)
|
||||
{
|
||||
if(_content.pet.hasOwnProperty("setEggDayInt"))
|
||||
{
|
||||
_loc2_ = _createdTs > 0 ? Math.floor((Utility.getInitialEpochTime() - _createdTs) / 86400) : 0;
|
||||
_content.pet.setEggDayInt(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function mediaIdForDefId(param1:int) : int
|
||||
{
|
||||
var _loc2_:PetDef = PetManager.getPetDef(param1);
|
||||
if(_loc2_)
|
||||
{
|
||||
return _loc2_.mediaRefId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public function get personalityDefId() : uint
|
||||
{
|
||||
return _traitDefId;
|
||||
}
|
||||
|
||||
public function set personalityDefId(param1:uint) : void
|
||||
{
|
||||
_traitDefId = param1;
|
||||
}
|
||||
|
||||
public function get favoriteToyDefId() : uint
|
||||
{
|
||||
return _toyDefId;
|
||||
}
|
||||
|
||||
public function set favoriteToyDefId(param1:uint) : void
|
||||
{
|
||||
_toyDefId = param1;
|
||||
}
|
||||
|
||||
public function get favoriteFoodDefId() : uint
|
||||
{
|
||||
return _foodDefId;
|
||||
}
|
||||
|
||||
public function set favoriteFoodDefId(param1:uint) : void
|
||||
{
|
||||
_foodDefId = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
package pet
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.globalization.DateTimeFormatter;
|
||||
import flash.text.TextField;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class PetCertificatePopup
|
||||
{
|
||||
|
||||
private var _petCertificatePopup:MovieClip;
|
||||
|
||||
private var _pet:GuiPet;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _nameTxt:TextField;
|
||||
|
||||
private var _adoptedTxt:TextField;
|
||||
|
||||
private var _personalityTxt:TextField;
|
||||
|
||||
private var _favoriteToyTxt:TextField;
|
||||
|
||||
private var _favoriteFoodTxt:TextField;
|
||||
|
||||
private var _itemWindowPet:MovieClip;
|
||||
|
||||
private var _closeBtn:MovieClip;
|
||||
|
||||
private var _rareTag:MovieClip;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
public function PetCertificatePopup()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:GuiPet, param2:Function) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true,true);
|
||||
_pet = param1;
|
||||
_closeCallback = param2;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(5097,onMediaLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:Function = null;
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_loc1_ = _closeCallback;
|
||||
_closeCallback = null;
|
||||
_loc1_();
|
||||
return;
|
||||
}
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_petCertificatePopup);
|
||||
GuiManager.guiLayer.removeChild(_petCertificatePopup);
|
||||
_petCertificatePopup = null;
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_petCertificatePopup = param1.getChildAt(0) as MovieClip;
|
||||
_closeBtn = _petCertificatePopup.bx;
|
||||
_nameTxt = _petCertificatePopup.nameTxt;
|
||||
_adoptedTxt = _petCertificatePopup.adoptedTxt;
|
||||
_personalityTxt = _petCertificatePopup.personalityTxt;
|
||||
_favoriteToyTxt = _petCertificatePopup.favoriteToyTxt;
|
||||
_favoriteFoodTxt = _petCertificatePopup.favoriteFoodTxt;
|
||||
_itemWindowPet = _petCertificatePopup.itemWindowPet;
|
||||
_rareTag = _petCertificatePopup.rareTag;
|
||||
_rareTag.visible = false;
|
||||
_petCertificatePopup.x = 900 * 0.5;
|
||||
_petCertificatePopup.y = 550 * 0.5;
|
||||
_pet = _pet.clone(onPetLoaded);
|
||||
_itemWindowPet.addChild(_pet);
|
||||
setupTextFields();
|
||||
addEventListeners();
|
||||
GuiManager.guiLayer.addChild(_petCertificatePopup);
|
||||
DarkenManager.darken(_petCertificatePopup);
|
||||
}
|
||||
|
||||
private function setupTextFields() : void
|
||||
{
|
||||
var _loc1_:DateTimeFormatter = null;
|
||||
var _loc2_:Date = null;
|
||||
LocalizationManager.updateToFit(_nameTxt,_pet.petName);
|
||||
if(_pet.createdTs == 0)
|
||||
{
|
||||
LocalizationManager.updateToFit(_adoptedTxt,"???");
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = new DateTimeFormatter(LocalizationManager.localeForNumberFormatting,"medium","none");
|
||||
_loc2_ = new Date(_pet.createdTs * 1000);
|
||||
LocalizationManager.updateToFit(_adoptedTxt,_loc1_.format(_loc2_));
|
||||
}
|
||||
var _loc3_:PetDef = PetManager.getPetDef(_pet.getDefID());
|
||||
if(_loc3_)
|
||||
{
|
||||
if(_pet.personalityDefId != 0)
|
||||
{
|
||||
GenericListXtCommManager.requestGenericList(432,onPersonalityListLoaded);
|
||||
}
|
||||
if(_pet.favoriteToyDefId != 0)
|
||||
{
|
||||
GenericListXtCommManager.requestGenericList(_loc3_.favoriteToyListId,onFavToyListLoaded);
|
||||
}
|
||||
if(_pet.favoriteFoodDefId != 0)
|
||||
{
|
||||
GenericListXtCommManager.requestGenericList(_loc3_.favoriteFoodListId,onFavFoodListLoaded);
|
||||
}
|
||||
if(_loc3_.isReward || _loc3_.status == 4)
|
||||
{
|
||||
_rareTag.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_petCertificatePopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_closeBtn.addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_petCertificatePopup.removeEventListener("mouseDown",onPopup);
|
||||
_closeBtn.removeEventListener("mouseDown",onCloseBtn);
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onCloseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onPetLoaded(param1:MovieClip, param2:GuiPet) : void
|
||||
{
|
||||
var _loc3_:Rectangle = Utility.getVisibleBounds(param1);
|
||||
var _loc4_:int = _loc3_.y + _loc3_.height;
|
||||
var _loc5_:int = _loc3_.x + _loc3_.width;
|
||||
var _loc6_:Number = _itemWindowPet.height / Math.max(_loc5_,_loc4_);
|
||||
_pet.scaleX = _loc6_;
|
||||
_pet.scaleY = _loc6_;
|
||||
_pet.y += _loc4_ * _loc6_ * 0.5;
|
||||
}
|
||||
|
||||
private function onPersonalityListLoaded(param1:int, param2:Array) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
if(_pet)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < param2.length)
|
||||
{
|
||||
if(param2[_loc3_] == _pet.personalityDefId)
|
||||
{
|
||||
LocalizationManager.translateId(_personalityTxt,param2[_loc3_]);
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onFavToyListLoaded(param1:int, param2:Array, param3:Array) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
if(_pet)
|
||||
{
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < param2.length)
|
||||
{
|
||||
if(param2[_loc4_] == _pet.favoriteToyDefId)
|
||||
{
|
||||
LocalizationManager.translateId(_favoriteToyTxt,param3[_loc4_]);
|
||||
break;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onFavFoodListLoaded(param1:int, param2:Array, param3:Array) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
if(_pet)
|
||||
{
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < param2.length)
|
||||
{
|
||||
if(param2[_loc4_] == _pet.favoriteFoodDefId)
|
||||
{
|
||||
LocalizationManager.translateId(_favoriteFoodTxt,param3[_loc4_]);
|
||||
break;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
package pet
|
||||
{
|
||||
public class PetDef
|
||||
{
|
||||
|
||||
private var _defId:int;
|
||||
|
||||
private var _mediaRefId:int;
|
||||
|
||||
private var _type:int;
|
||||
|
||||
private var _isGround:Boolean;
|
||||
|
||||
private var _title:String;
|
||||
|
||||
private var _titleStrId:int;
|
||||
|
||||
private var _isMember:Boolean;
|
||||
|
||||
private var _cost:int;
|
||||
|
||||
private var _status:int;
|
||||
|
||||
private var _diamondDefId:int;
|
||||
|
||||
private var _favoriteToyListId:int;
|
||||
|
||||
private var _favoriteFoodListId:int;
|
||||
|
||||
private var _isReward:Boolean;
|
||||
|
||||
private var _isInDiamondStore:Boolean;
|
||||
|
||||
private var _isEgg:Boolean;
|
||||
|
||||
private var _availabilityEndTime:uint;
|
||||
|
||||
private var _availabilityStartTime:uint;
|
||||
|
||||
public function PetDef(param1:int, param2:int, param3:int, param4:Boolean, param5:String, param6:int, param7:Boolean, param8:int, param9:int, param10:int, param11:int, param12:int, param13:Boolean, param14:Boolean, param15:Boolean, param16:uint, param17:uint)
|
||||
{
|
||||
super();
|
||||
_defId = param1;
|
||||
_mediaRefId = param2;
|
||||
_type = param3;
|
||||
_isGround = param4;
|
||||
_title = param5;
|
||||
_titleStrId = param6;
|
||||
_isMember = param7;
|
||||
_cost = param8;
|
||||
_status = param9;
|
||||
_diamondDefId = param10;
|
||||
_favoriteToyListId = param11;
|
||||
_favoriteFoodListId = param12;
|
||||
_isReward = param13;
|
||||
_isInDiamondStore = param14;
|
||||
_isEgg = param15;
|
||||
_availabilityStartTime = param16;
|
||||
_availabilityEndTime = param17;
|
||||
}
|
||||
|
||||
public function get defId() : int
|
||||
{
|
||||
return _defId;
|
||||
}
|
||||
|
||||
public function get mediaRefId() : int
|
||||
{
|
||||
return _mediaRefId;
|
||||
}
|
||||
|
||||
public function get type() : int
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public function get isGround() : Boolean
|
||||
{
|
||||
return _isGround;
|
||||
}
|
||||
|
||||
public function get title() : String
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
||||
public function set title(param1:String) : void
|
||||
{
|
||||
_title = param1;
|
||||
}
|
||||
|
||||
public function get titleStrId() : int
|
||||
{
|
||||
return _titleStrId;
|
||||
}
|
||||
|
||||
public function get isMember() : Boolean
|
||||
{
|
||||
return _isMember;
|
||||
}
|
||||
|
||||
public function get cost() : int
|
||||
{
|
||||
return _cost;
|
||||
}
|
||||
|
||||
public function get status() : int
|
||||
{
|
||||
return _status;
|
||||
}
|
||||
|
||||
public function get isDiamond() : Boolean
|
||||
{
|
||||
return _diamondDefId > 0;
|
||||
}
|
||||
|
||||
public function get diamondDefId() : int
|
||||
{
|
||||
return _diamondDefId;
|
||||
}
|
||||
|
||||
public function set diamondDefId(param1:int) : void
|
||||
{
|
||||
_diamondDefId = param1;
|
||||
}
|
||||
|
||||
public function get favoriteToyListId() : int
|
||||
{
|
||||
return _favoriteToyListId;
|
||||
}
|
||||
|
||||
public function get favoriteFoodListId() : int
|
||||
{
|
||||
return _favoriteFoodListId;
|
||||
}
|
||||
|
||||
public function get isReward() : Boolean
|
||||
{
|
||||
return _isReward;
|
||||
}
|
||||
|
||||
public function get isInDiamondStore() : Boolean
|
||||
{
|
||||
return _isInDiamondStore;
|
||||
}
|
||||
|
||||
public function set isInDiamondStore(param1:Boolean) : void
|
||||
{
|
||||
_isInDiamondStore = param1;
|
||||
}
|
||||
|
||||
public function get isEgg() : Boolean
|
||||
{
|
||||
return _isEgg;
|
||||
}
|
||||
|
||||
public function get availabilityEndTime() : uint
|
||||
{
|
||||
return _availabilityEndTime;
|
||||
}
|
||||
|
||||
public function get availabilityStartTime() : uint
|
||||
{
|
||||
return _availabilityStartTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,473 @@
|
||||
package pet
|
||||
{
|
||||
import currency.CombinedCurrencyItem;
|
||||
import diamond.DiamondItem;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import inventory.Iitem;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class PetItem implements Iitem
|
||||
{
|
||||
|
||||
private var _currPetDef:PetDef;
|
||||
|
||||
private var _currGuiPet:GuiPet;
|
||||
|
||||
private var _isIconLoaded:Boolean;
|
||||
|
||||
private var _imageLoadedCallback:Function;
|
||||
|
||||
private var _diamondItem:DiamondItem;
|
||||
|
||||
private var _invIdx:int;
|
||||
|
||||
private var _isShopItem:Boolean;
|
||||
|
||||
private var _endTime:uint;
|
||||
|
||||
private var _status:int;
|
||||
|
||||
private var _petBits:Array;
|
||||
|
||||
private var _petName:String;
|
||||
|
||||
private var _traitDefId:int;
|
||||
|
||||
private var _toyDefId:int;
|
||||
|
||||
private var _foodDefId:int;
|
||||
|
||||
private var _createdTs:Number;
|
||||
|
||||
private var _denStoreInvId:int;
|
||||
|
||||
private var _asShopItemSized:Boolean;
|
||||
|
||||
public function PetItem()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:Number, param2:int, param3:Array, param4:int, param5:int, param6:int, param7:int = 0, param8:String = null, param9:Boolean = false, param10:Function = null, param11:DiamondItem = null, param12:int = 0) : void
|
||||
{
|
||||
_createdTs = param1;
|
||||
_currPetDef = PetManager.getPetDef(param2);
|
||||
_petBits = param3;
|
||||
_traitDefId = param4;
|
||||
_toyDefId = param5;
|
||||
_foodDefId = param6;
|
||||
_status = param11 ? param11.status : _currPetDef.status;
|
||||
_isIconLoaded = false;
|
||||
_invIdx = param7;
|
||||
_petName = param8;
|
||||
_diamondItem = param11;
|
||||
_isShopItem = param9;
|
||||
_endTime = param11 ? param11.availabilityEndTime : _currPetDef.availabilityEndTime;
|
||||
_imageLoadedCallback = param10;
|
||||
_denStoreInvId = param12;
|
||||
}
|
||||
|
||||
public function ifItemDiffers(param1:Iitem) : Boolean
|
||||
{
|
||||
var _loc2_:PetItem = param1 as PetItem;
|
||||
if(_loc2_)
|
||||
{
|
||||
if(_currPetDef && _currPetDef.defId == param1.defId)
|
||||
{
|
||||
if(value != _loc2_.value || isNew != _loc2_.isNew || isOnSale != _loc2_.isOnSale || _endTime != _loc2_._endTime || isInDenShop != _loc2_.isInDenShop)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get layerId() : int
|
||||
{
|
||||
throw new Error("PetItem does not contain layerId");
|
||||
}
|
||||
|
||||
public function get invIdx() : int
|
||||
{
|
||||
return _invIdx;
|
||||
}
|
||||
|
||||
public function get currPetDef() : PetDef
|
||||
{
|
||||
return _currPetDef;
|
||||
}
|
||||
|
||||
public function get name() : String
|
||||
{
|
||||
if(isEgg && !isHatched)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if(_petName != null)
|
||||
{
|
||||
return LocalizationManager.translatePetName(_petName);
|
||||
}
|
||||
return _currPetDef.title;
|
||||
}
|
||||
|
||||
public function get isMemberOnly() : Boolean
|
||||
{
|
||||
return _currPetDef.isMember;
|
||||
}
|
||||
|
||||
public function get isEgg() : Boolean
|
||||
{
|
||||
return _currPetDef.isEgg;
|
||||
}
|
||||
|
||||
public function get type() : int
|
||||
{
|
||||
return _currPetDef.type;
|
||||
}
|
||||
|
||||
public function set isMemberOnly(param1:Boolean) : void
|
||||
{
|
||||
throw new Error("PetItem does not implement changing member only value");
|
||||
}
|
||||
|
||||
public function get enviroType() : int
|
||||
{
|
||||
return PetManager.getEnviroTypeByPetType(_currPetDef,_createdTs);
|
||||
}
|
||||
|
||||
public function get recycleValue() : int
|
||||
{
|
||||
if(_diamondItem)
|
||||
{
|
||||
return _diamondItem.value;
|
||||
}
|
||||
return _currPetDef.cost * gMainFrame.clientInfo.recyclePercentage;
|
||||
}
|
||||
|
||||
public function get currencyType() : int
|
||||
{
|
||||
if(_diamondItem)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function get endTime() : uint
|
||||
{
|
||||
return _endTime;
|
||||
}
|
||||
|
||||
public function set endTime(param1:uint) : void
|
||||
{
|
||||
throw new Error("PetItem does not implement changing endTime");
|
||||
}
|
||||
|
||||
public function get startTime() : uint
|
||||
{
|
||||
if(_diamondItem)
|
||||
{
|
||||
return _diamondItem.startTime;
|
||||
}
|
||||
if(_currPetDef)
|
||||
{
|
||||
return _currPetDef.availabilityStartTime;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function get itemStatus() : int
|
||||
{
|
||||
return _status;
|
||||
}
|
||||
|
||||
public function set itemStatus(param1:int) : void
|
||||
{
|
||||
_status = param1;
|
||||
}
|
||||
|
||||
public function get value() : *
|
||||
{
|
||||
if(_diamondItem)
|
||||
{
|
||||
return _diamondItem.isOnSale ? _diamondItem.value : (isOnSale ? Math.ceil(_diamondItem.value * 0.5) : _diamondItem.value);
|
||||
}
|
||||
return isOnSale ? Math.ceil(_currPetDef.cost * 0.5) : _currPetDef.cost;
|
||||
}
|
||||
|
||||
public function get defId() : int
|
||||
{
|
||||
return _currPetDef.defId;
|
||||
}
|
||||
|
||||
public function set defId(param1:int) : void
|
||||
{
|
||||
throw new Error("Should not be changing this defId here");
|
||||
}
|
||||
|
||||
public function get icon() : Sprite
|
||||
{
|
||||
if(!_currGuiPet)
|
||||
{
|
||||
if(_petBits == null)
|
||||
{
|
||||
_petBits = PetManager.packPetBits(PetManager.createRandomPet(defId));
|
||||
}
|
||||
_currGuiPet = PetManager.getGuiPet(createdTs,defId,_petBits[0],_petBits[1],_petBits[2],_currPetDef.type,_currPetDef.title,_traitDefId,_foodDefId,_toyDefId,onPetLoaded);
|
||||
}
|
||||
return _currGuiPet;
|
||||
}
|
||||
|
||||
public function get largeIcon() : Sprite
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public function get isShopItem() : Boolean
|
||||
{
|
||||
return _isShopItem;
|
||||
}
|
||||
|
||||
public function get combinedCurrencyItem() : CombinedCurrencyItem
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get isIconLoaded() : Boolean
|
||||
{
|
||||
return _isIconLoaded;
|
||||
}
|
||||
|
||||
public function get imageLoadedCallback() : Function
|
||||
{
|
||||
return _imageLoadedCallback;
|
||||
}
|
||||
|
||||
public function set imageLoadedCallback(param1:Function) : void
|
||||
{
|
||||
_imageLoadedCallback = param1;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_currGuiPet)
|
||||
{
|
||||
_currGuiPet.destroy();
|
||||
_currGuiPet = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function clone() : Iitem
|
||||
{
|
||||
var _loc1_:PetItem = new PetItem();
|
||||
_loc1_.init(_createdTs,_currPetDef.defId,_petBits,_traitDefId,_toyDefId,_foodDefId,_invIdx,_petName,_isShopItem,imageLoadedCallback,_diamondItem,_denStoreInvId);
|
||||
_loc1_.updateValueWithNewStatus(_status);
|
||||
_loc1_.imageLoadedCallback = imageLoadedCallback;
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
public function get isOnSale() : Boolean
|
||||
{
|
||||
return itemStatus == 2;
|
||||
}
|
||||
|
||||
public function get isOnClearance() : Boolean
|
||||
{
|
||||
return itemStatus == 3;
|
||||
}
|
||||
|
||||
public function get isRare() : Boolean
|
||||
{
|
||||
return itemStatus == 4;
|
||||
}
|
||||
|
||||
public function get isNew() : Boolean
|
||||
{
|
||||
return itemStatus == 1;
|
||||
}
|
||||
|
||||
public function get isOcean() : Boolean
|
||||
{
|
||||
return enviroType == 1;
|
||||
}
|
||||
|
||||
public function get isLand() : Boolean
|
||||
{
|
||||
return enviroType == 0;
|
||||
}
|
||||
|
||||
public function get isLandAndOcean() : Boolean
|
||||
{
|
||||
return enviroType == 3;
|
||||
}
|
||||
|
||||
public function get isDiamond() : Boolean
|
||||
{
|
||||
return _diamondItem != null;
|
||||
}
|
||||
|
||||
public function get isRareDiamond() : Boolean
|
||||
{
|
||||
return isRare && isDiamond;
|
||||
}
|
||||
|
||||
private function onPetLoaded(param1:MovieClip, param2:GuiPet) : void
|
||||
{
|
||||
_isIconLoaded = true;
|
||||
if(_isShopItem || _asShopItemSized)
|
||||
{
|
||||
param1.scaleX = param1.scaleY = 3;
|
||||
param1.y += param1.height * 0.35;
|
||||
}
|
||||
if(_imageLoadedCallback != null)
|
||||
{
|
||||
if(_imageLoadedCallback.length == 0)
|
||||
{
|
||||
_imageLoadedCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
_imageLoadedCallback(param1,param2);
|
||||
}
|
||||
_imageLoadedCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function get isApproved() : Boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function set isApproved(param1:Boolean) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function get isCustom() : Boolean
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function updateValueWithNewStatus(param1:int) : void
|
||||
{
|
||||
if(!isRare)
|
||||
{
|
||||
itemStatus = param1;
|
||||
}
|
||||
}
|
||||
|
||||
public function get diamondItem() : DiamondItem
|
||||
{
|
||||
return _diamondItem;
|
||||
}
|
||||
|
||||
public function set diamondItem(param1:DiamondItem) : void
|
||||
{
|
||||
_diamondItem = param1;
|
||||
}
|
||||
|
||||
public function get petBits() : Array
|
||||
{
|
||||
return _petBits;
|
||||
}
|
||||
|
||||
public function setPetBits(param1:int, param2:int, param3:int) : void
|
||||
{
|
||||
_petBits = [param1,param2,param3];
|
||||
}
|
||||
|
||||
public function get sortIdString() : String
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public function get traitDefId() : int
|
||||
{
|
||||
return _traitDefId;
|
||||
}
|
||||
|
||||
public function set traitDefId(param1:int) : void
|
||||
{
|
||||
_traitDefId = param1;
|
||||
}
|
||||
|
||||
public function get toyDefId() : int
|
||||
{
|
||||
return _toyDefId;
|
||||
}
|
||||
|
||||
public function set toyDefId(param1:int) : void
|
||||
{
|
||||
_toyDefId = param1;
|
||||
}
|
||||
|
||||
public function get foodDefId() : int
|
||||
{
|
||||
return _foodDefId;
|
||||
}
|
||||
|
||||
public function set foodDefId(param1:int) : void
|
||||
{
|
||||
_foodDefId = param1;
|
||||
}
|
||||
|
||||
public function get createdTs() : Number
|
||||
{
|
||||
return _createdTs;
|
||||
}
|
||||
|
||||
public function set createdTs(param1:Number) : void
|
||||
{
|
||||
_createdTs = param1;
|
||||
}
|
||||
|
||||
public function get isHatched() : Boolean
|
||||
{
|
||||
return createdTs + 259200 <= Utility.getInitialEpochTime();
|
||||
}
|
||||
|
||||
public function get isAvailable() : Boolean
|
||||
{
|
||||
if(_diamondItem)
|
||||
{
|
||||
if(PetManager.isPetAvailable(defId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return _diamondItem.isAvailable;
|
||||
}
|
||||
if(_currPetDef == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Utility.isAvailable(_currPetDef.availabilityStartTime,_currPetDef.availabilityEndTime);
|
||||
}
|
||||
|
||||
public function get denStoreInvId() : int
|
||||
{
|
||||
return _denStoreInvId;
|
||||
}
|
||||
|
||||
public function set denStoreInvId(param1:int) : void
|
||||
{
|
||||
_denStoreInvId = param1;
|
||||
}
|
||||
|
||||
public function get isInDenShop() : Boolean
|
||||
{
|
||||
return _denStoreInvId > 0;
|
||||
}
|
||||
|
||||
public function get itemType() : int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function set asShopItemSized(param1:Boolean) : void
|
||||
{
|
||||
_asShopItemSized = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,226 @@
|
||||
package pet
|
||||
{
|
||||
import com.sbi.client.SFEvent;
|
||||
import diamond.DiamondItem;
|
||||
import diamond.DiamondXtCommManager;
|
||||
import loader.DefPacksDefHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class PetXtCommManager
|
||||
{
|
||||
|
||||
public static var canLoadPetList:Boolean;
|
||||
|
||||
private static var _plCallback:Function;
|
||||
|
||||
private static var _pdCallback:Function;
|
||||
|
||||
private static var _psCallback:Function;
|
||||
|
||||
private static var _pcCallback:Function;
|
||||
|
||||
private static var _piCallback:Function;
|
||||
|
||||
private static var _pmCallback:Function;
|
||||
|
||||
private static var _pnCallback:Function;
|
||||
|
||||
public function PetXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
}
|
||||
|
||||
public static function handleXtReply(param1:SFEvent) : void
|
||||
{
|
||||
var _loc2_:Array = param1.obj;
|
||||
switch(_loc2_[0])
|
||||
{
|
||||
case "pl":
|
||||
onPetListResponse(_loc2_);
|
||||
break;
|
||||
case "pc":
|
||||
onPetCreateResponse(_loc2_);
|
||||
break;
|
||||
case "ps":
|
||||
onPetSwitchResponse(_loc2_);
|
||||
break;
|
||||
case "pi":
|
||||
onPetItemsResponse(_loc2_);
|
||||
break;
|
||||
case "pm":
|
||||
onPetMasteryResponse(_loc2_);
|
||||
break;
|
||||
case "pd":
|
||||
onPetDismissResponse(_loc2_);
|
||||
break;
|
||||
case "pu":
|
||||
onPetUnlockResponse(_loc2_);
|
||||
break;
|
||||
case "pn":
|
||||
onPetEggNameResponse(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public static function set petCreateCallback(param1:Function) : void
|
||||
{
|
||||
_pcCallback = param1;
|
||||
}
|
||||
|
||||
public static function sendPetListRequest(param1:String, param2:Function = null) : void
|
||||
{
|
||||
_plCallback = param2;
|
||||
gMainFrame.server.setXtObject_Str("pl",[param1]);
|
||||
}
|
||||
|
||||
public static function sendPetCreateRequest(param1:int, param2:int, param3:int, param4:uint, param5:int, param6:int, param7:Function = null, param8:Boolean = false) : void
|
||||
{
|
||||
_pcCallback = param7;
|
||||
gMainFrame.server.setXtObject_Str("pc",[param1,param2,param3,param4,param5,param6,param8 ? "1" : "0"]);
|
||||
}
|
||||
|
||||
public static function sendPetShopBuyRequest(param1:int, param2:int, param3:int, param4:int, param5:uint, param6:int, param7:int, param8:Function = null, param9:Boolean = false) : void
|
||||
{
|
||||
_pcCallback = param8;
|
||||
gMainFrame.server.setXtObject_Str("pb",[param1,param2,param3,param4,param5,param6,param7,param9 ? "1" : "0"]);
|
||||
}
|
||||
|
||||
public static function sendPetDismissRequest(param1:int, param2:Function = null) : void
|
||||
{
|
||||
_pdCallback = param2;
|
||||
gMainFrame.server.setXtObject_Str("pd",[param1]);
|
||||
}
|
||||
|
||||
public static function sendPetSwitchRequest(param1:int, param2:Function = null) : void
|
||||
{
|
||||
_psCallback = param2;
|
||||
gMainFrame.server.setXtObject_Str("ps",[param1]);
|
||||
}
|
||||
|
||||
public static function sendPetItemRequest(param1:int, param2:int, param3:int, param4:int, param5:Function) : void
|
||||
{
|
||||
_piCallback = param5;
|
||||
gMainFrame.server.setXtObject_Str("pi",[param1,param2,param3,param4]);
|
||||
}
|
||||
|
||||
public static function sendPetMasteryRequest(param1:int, param2:int, param3:Function = null) : void
|
||||
{
|
||||
_pmCallback = param3;
|
||||
gMainFrame.server.setXtObject_Str("pm",[param1,param2]);
|
||||
}
|
||||
|
||||
public static function sendPetEggNameRequest(param1:int, param2:int, param3:int, param4:Function) : void
|
||||
{
|
||||
_pnCallback = param4;
|
||||
gMainFrame.server.setXtObject_Str("pn",[param1,param2,param3]);
|
||||
}
|
||||
|
||||
public static function petDefsResponse(param1:DefPacksDefHelper) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:Vector.<PetDef> = new Vector.<PetDef>();
|
||||
for each(var _loc2_:Object in param1.def)
|
||||
{
|
||||
VectorUtility.safeAdd(_loc5_,int(_loc2_.id),new PetDef(int(_loc2_.id),int(_loc2_.mediaRefId),int(_loc2_.type),PetManager.isGround(_loc2_.type),LocalizationManager.translateIdOnly(int(_loc2_.titleStrId)),int(_loc2_.titleStrId),_loc2_.isMember == "1",int(_loc2_.cost),int(_loc2_.status),DiamondXtCommManager.getDiamondDefIdByRefId(_loc2_.id,2),int(_loc2_.toyListId),int(_loc2_.foodListId),_loc2_.isReward == "1",false,_loc2_.isEgg == "1",uint(_loc2_.availabilityStartTime),uint(_loc2_.availabilityEndTime)));
|
||||
}
|
||||
DefPacksDefHelper.mediaArray[1046] = null;
|
||||
var _loc3_:Array = PetManager.myPetList;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc3_.length)
|
||||
{
|
||||
if(_loc3_[_loc4_].type == -1)
|
||||
{
|
||||
_loc3_[_loc4_].type = PetManager.petTypeForDefId(_loc3_[_loc4_].defId);
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
GenericListXtCommManager.requestGenericList(214,onDiamondPetListLoaded,{
|
||||
"petDefs":_loc5_,
|
||||
"callback":param1.passback
|
||||
});
|
||||
}
|
||||
|
||||
private static function onDiamondPetListLoaded(param1:int, param2:Array, param3:Object) : void
|
||||
{
|
||||
var _loc6_:int = 0;
|
||||
var _loc4_:DiamondItem = null;
|
||||
var _loc8_:Vector.<PetDef> = param3.petDefs;
|
||||
var _loc5_:Function = param3.callback;
|
||||
var _loc7_:int = 8;
|
||||
var _loc9_:int = int(param2[_loc7_++]);
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc9_)
|
||||
{
|
||||
_loc4_ = DiamondXtCommManager.getDiamondItem(int(param2[_loc7_++]));
|
||||
if(_loc4_.isPet && _loc8_.length > _loc4_.refDefId)
|
||||
{
|
||||
_loc8_[_loc4_.refDefId].isInDiamondStore = true;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
PetManager.petDefs = _loc8_;
|
||||
canLoadPetList = true;
|
||||
sendPetListRequest(gMainFrame.server.userName);
|
||||
if(_loc5_ != null)
|
||||
{
|
||||
_loc5_();
|
||||
_loc5_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onPetListResponse(param1:Array) : void
|
||||
{
|
||||
PetManager.onPetListResponse(param1,_plCallback);
|
||||
_plCallback = null;
|
||||
}
|
||||
|
||||
private static function onPetCreateResponse(param1:Array) : void
|
||||
{
|
||||
PetManager.onPetCreateResponse(param1,_pcCallback);
|
||||
_pcCallback = null;
|
||||
}
|
||||
|
||||
private static function onPetItemsResponse(param1:Array) : void
|
||||
{
|
||||
PetManager.onPetItemsResponse(param1,_piCallback);
|
||||
_piCallback = null;
|
||||
}
|
||||
|
||||
private static function onPetMasteryResponse(param1:Array) : void
|
||||
{
|
||||
PetManager.onPetMasteryResponse(param1,_pmCallback);
|
||||
_pmCallback = null;
|
||||
}
|
||||
|
||||
private static function onPetDismissResponse(param1:Array) : void
|
||||
{
|
||||
PetManager.onPetDismissResponse(param1,_pdCallback);
|
||||
_pdCallback = null;
|
||||
}
|
||||
|
||||
private static function onPetUnlockResponse(param1:Array) : void
|
||||
{
|
||||
PetManager.unlockedPets = param1[2];
|
||||
}
|
||||
|
||||
private static function onPetSwitchResponse(param1:Array) : void
|
||||
{
|
||||
PetManager.onPetSwitchResponse(param1,_psCallback);
|
||||
_psCallback = null;
|
||||
}
|
||||
|
||||
private static function onPetEggNameResponse(param1:Array) : void
|
||||
{
|
||||
PetManager.onPetEggNameResponse(param1,_pnCallback);
|
||||
_pnCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,421 @@
|
||||
package pet
|
||||
{
|
||||
import avatar.AvatarWorldView;
|
||||
import avatar.UserCommXtCommManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Matrix;
|
||||
import gui.GuiManager;
|
||||
|
||||
public class WorldPet extends PetBase
|
||||
{
|
||||
|
||||
public static const ANIM_IDLE:int = 0;
|
||||
|
||||
public static const ANIM_MOVE:int = 1;
|
||||
|
||||
public static const ANIM_IDLE_UP:int = 2;
|
||||
|
||||
public static const ANIM_MOVE_UP:int = 3;
|
||||
|
||||
public static const ANIM_CLICK:int = 4;
|
||||
|
||||
public static const ANIM_IDLE_WATER:int = 10;
|
||||
|
||||
public static const ANIM_IDLE_MUD:int = 20;
|
||||
|
||||
public static const ANIM_DANCE:int = 31;
|
||||
|
||||
public static const ANIM_SLEEP_OR_DIVE:int = 32;
|
||||
|
||||
public static const ANIM_HOP_OR_SWIRL:int = 33;
|
||||
|
||||
public static const ANIM_PLAY:int = 34;
|
||||
|
||||
public static const ANIM_SIT_OR_POSE:int = 35;
|
||||
|
||||
public static const ACTION_CLICK:int = 0;
|
||||
|
||||
public static const ACTION_SPARKLE:int = 1;
|
||||
|
||||
public static const PET_SPARKLE_TIME:int = 7200;
|
||||
|
||||
public static var _actionLookup:Array = [{
|
||||
"name":":dance:",
|
||||
"animId":31
|
||||
},{
|
||||
"name":":sleep:",
|
||||
"animId":32
|
||||
},{
|
||||
"name":":dive:",
|
||||
"animId":32
|
||||
},{
|
||||
"name":":hop:",
|
||||
"animId":33
|
||||
},{
|
||||
"name":":swirl:",
|
||||
"animId":33
|
||||
},{
|
||||
"name":":play:",
|
||||
"animId":34
|
||||
},{
|
||||
"name":":sit:",
|
||||
"animId":35
|
||||
},{
|
||||
"name":":sitNW:",
|
||||
"animId":35
|
||||
},{
|
||||
"name":":sitSW:",
|
||||
"animId":35
|
||||
},{
|
||||
"name":":sitSE:",
|
||||
"animId":35
|
||||
},{
|
||||
"name":":sitNE:",
|
||||
"animId":35
|
||||
},{
|
||||
"name":":pose:",
|
||||
"animId":35
|
||||
},{
|
||||
"name":":poseLeft:",
|
||||
"animId":35
|
||||
},{
|
||||
"name":":poseRight:",
|
||||
"animId":35
|
||||
}];
|
||||
|
||||
private var _parent:AvatarWorldView;
|
||||
|
||||
private var _mode:int;
|
||||
|
||||
private var _x:int;
|
||||
|
||||
private var _y:int;
|
||||
|
||||
private var _targetX:int;
|
||||
|
||||
private var _targetY:int;
|
||||
|
||||
private var _bNewTarget:Boolean;
|
||||
|
||||
private var _dirX:Number;
|
||||
|
||||
private var _dirY:Number;
|
||||
|
||||
private var _speed:Number;
|
||||
|
||||
private var _lastAnim:int;
|
||||
|
||||
private var _bFlip:Boolean;
|
||||
|
||||
private var _bBack:Boolean;
|
||||
|
||||
private var _bUpdateState:Boolean;
|
||||
|
||||
private var _parentLastX:Number;
|
||||
|
||||
private var _parentLastY:Number;
|
||||
|
||||
private var _bSpecialMove:Boolean;
|
||||
|
||||
private var _petLoaded:Boolean;
|
||||
|
||||
private var _sparkle:int;
|
||||
|
||||
private var _offsetX:int = 100;
|
||||
|
||||
private var _offsetY:int = -50;
|
||||
|
||||
private var _maxSpeed:Number = 1;
|
||||
|
||||
private var _accel:Number = 0.03;
|
||||
|
||||
private var _scale:Number = 1;
|
||||
|
||||
private var _minX:Number = -70;
|
||||
|
||||
private var _maxX:Number = 55;
|
||||
|
||||
private var _airPetYOffest:Number = -80;
|
||||
|
||||
private var _oceanPetXOffset:Number = 55;
|
||||
|
||||
private var _petLandLowXOffset:Number = 30;
|
||||
|
||||
public function WorldPet(param1:AvatarWorldView, param2:Number, param3:uint, param4:uint, param5:uint, param6:uint, param7:uint, param8:uint, param9:int = 0)
|
||||
{
|
||||
super(param2,param3,param4,param5,param6,param7,param8,onPetLoaded);
|
||||
_sparkle = param9;
|
||||
_parent = param1;
|
||||
_targetX = 0;
|
||||
_bNewTarget = true;
|
||||
_mode = 1;
|
||||
_lastAnim = -1;
|
||||
_bUpdateState = true;
|
||||
_bFlip = false;
|
||||
_bBack = false;
|
||||
_bSpecialMove = false;
|
||||
_parent.addChild(this);
|
||||
if(param1.userName.toLowerCase() == gMainFrame.server.userName.toLowerCase() && !GuiManager.isBeYourPetRoom())
|
||||
{
|
||||
this.addEventListener("mouseDown",onClick,false,0,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mouseChildren = false;
|
||||
this.mouseEnabled = false;
|
||||
}
|
||||
if(isEggAndHasNotHatched || (getType() == 0 || getType() == 2 || getType() == 4))
|
||||
{
|
||||
if(GuiManager.isBeYourPetRoom())
|
||||
{
|
||||
_y = -5;
|
||||
GuiManager.actionMgr.grayOutPetDanceBtn(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_y = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiManager.actionMgr.grayOutPetDanceBtn(true);
|
||||
if(GuiManager.isBeYourPetRoom())
|
||||
{
|
||||
_y = -5;
|
||||
}
|
||||
else
|
||||
{
|
||||
_y = _airPetYOffest;
|
||||
}
|
||||
}
|
||||
_parentLastX = _parent.x;
|
||||
_parentLastY = _parent.y;
|
||||
if(GuiManager.isBeYourPetRoom())
|
||||
{
|
||||
_minX = 25;
|
||||
_maxX = -30;
|
||||
_x = _maxX;
|
||||
_parentLastX = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(getType() == 2)
|
||||
{
|
||||
_minX -= _oceanPetXOffset;
|
||||
_maxX += _oceanPetXOffset;
|
||||
}
|
||||
else if(getType() == 0)
|
||||
{
|
||||
if(param1.avTypeId != 5)
|
||||
{
|
||||
_minX -= _petLandLowXOffset;
|
||||
}
|
||||
}
|
||||
_x = 0;
|
||||
}
|
||||
_targetX = 0;
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
super.destroy();
|
||||
this.removeEventListener("mouseDown",onClick);
|
||||
}
|
||||
|
||||
public function heartbeat(param1:int, param2:Boolean) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc3_:Matrix = null;
|
||||
var _loc4_:int = 0;
|
||||
if(_content && _parent && !_parent.isOffScreen)
|
||||
{
|
||||
if(GuiManager.isBeYourPetRoom())
|
||||
{
|
||||
if(_parentLastX != _parent.x)
|
||||
{
|
||||
if(_parent.x > _parentLastX)
|
||||
{
|
||||
if(!_bFlip)
|
||||
{
|
||||
_parent.flipSplash(true);
|
||||
_bFlip = true;
|
||||
_x = _minX;
|
||||
}
|
||||
}
|
||||
else if(_bFlip)
|
||||
{
|
||||
_parent.flipSplash(false);
|
||||
_bFlip = false;
|
||||
_x = _maxX;
|
||||
}
|
||||
_parentLastX = _parent.x;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_targetX == 0)
|
||||
{
|
||||
_targetX = _parent.hFlip ? _minX : _maxX;
|
||||
}
|
||||
if(_parentLastX != _parent.x)
|
||||
{
|
||||
_bFlip = _parent.x > _parentLastX ? true : false;
|
||||
if(Math.abs(_parentLastX - _parent.x) > 13)
|
||||
{
|
||||
_targetX = _bFlip ? _minX : _maxX;
|
||||
}
|
||||
_parentLastX = _parent.x;
|
||||
}
|
||||
if(_parentLastY != _parent.y)
|
||||
{
|
||||
_bBack = _parent.y < _parentLastY - 10 ? true : false;
|
||||
_parentLastY = _parent.y;
|
||||
}
|
||||
if(_x > _targetX)
|
||||
{
|
||||
_x -= 10;
|
||||
if(_x <= _targetX)
|
||||
{
|
||||
_x = _targetX;
|
||||
}
|
||||
_bFlip = _x == _targetX ? true : false;
|
||||
}
|
||||
if(_x < _targetX)
|
||||
{
|
||||
_x += 10;
|
||||
if(_x > _targetX)
|
||||
{
|
||||
_x = _targetX;
|
||||
}
|
||||
_bFlip = _x == _targetX ? false : true;
|
||||
}
|
||||
}
|
||||
if(_bUpdateState)
|
||||
{
|
||||
PetManager.setPetState(_content,_lBits,_uBits,_eBits);
|
||||
_bUpdateState = false;
|
||||
}
|
||||
_loc5_ = _parent.inSplashVolume() ? 10 : 0;
|
||||
if(_loc5_ && _parent.splashLiquid == "mud")
|
||||
{
|
||||
_loc5_ = 20;
|
||||
}
|
||||
if(_parent.splashLiquid != "mud" && _parent.splashLiquid != "water")
|
||||
{
|
||||
_loc5_ = 0;
|
||||
}
|
||||
_loc3_ = _content.transform.matrix;
|
||||
_loc3_.identity();
|
||||
_loc3_.scale(_bFlip ? -_scale : _scale,_scale);
|
||||
_loc3_.translate(_x,_y - param1);
|
||||
_content.transform.matrix = _loc3_;
|
||||
_loc4_ = _loc5_ + param2;
|
||||
if(_bBack)
|
||||
{
|
||||
_loc4_ += 2;
|
||||
}
|
||||
if((param2 || _lastAnim <= 4) && _lastAnim != _loc4_)
|
||||
{
|
||||
_lastAnim = _loc4_;
|
||||
_content.pet.setAnim(_loc4_);
|
||||
}
|
||||
if(_bSpecialMove)
|
||||
{
|
||||
_bSpecialMove = false;
|
||||
if(!param2)
|
||||
{
|
||||
_content.pet.setAnim(4 + _loc5_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setState(param1:Array) : void
|
||||
{
|
||||
_lBits = param1[0];
|
||||
_uBits = param1[1];
|
||||
_eBits = param1[2];
|
||||
_bUpdateState = true;
|
||||
}
|
||||
|
||||
public function setAction(param1:int, param2:int = 0) : void
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case 0:
|
||||
onClick();
|
||||
break;
|
||||
case 1:
|
||||
setSparkle(param2);
|
||||
}
|
||||
}
|
||||
|
||||
public function setActionByName(param1:String) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
for each(var _loc3_:Object in _actionLookup)
|
||||
{
|
||||
if(_loc3_.name == param1)
|
||||
{
|
||||
_loc2_ = int(_loc3_.animId);
|
||||
if(_loc2_ > 0)
|
||||
{
|
||||
_lastAnim = _loc2_;
|
||||
if(_content)
|
||||
{
|
||||
_content.pet.setAnim(_loc2_);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function onClick(param1:MouseEvent = null) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
UserCommXtCommManager.sendPetAction(0);
|
||||
}
|
||||
_bSpecialMove = true;
|
||||
}
|
||||
|
||||
private function onPetLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(GuiManager.isBeYourPetRoom())
|
||||
{
|
||||
_content.pet.scaleX = _content.pet.scaleY = 2;
|
||||
}
|
||||
_content.pet.setSparkle(_sparkle);
|
||||
}
|
||||
|
||||
private function convertAvtAnimToPetAnim() : int
|
||||
{
|
||||
switch(_parent.animId)
|
||||
{
|
||||
case 23:
|
||||
case 38:
|
||||
return 31;
|
||||
case 22:
|
||||
case 41:
|
||||
return 32;
|
||||
case 17:
|
||||
case 33:
|
||||
return 33;
|
||||
case 6:
|
||||
case 39:
|
||||
return 34;
|
||||
case 2:
|
||||
case 4:
|
||||
case 40:
|
||||
break;
|
||||
default:
|
||||
return _parent.isPetMovingTest() ? 0 : 1;
|
||||
}
|
||||
return 35;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user