mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 09:37:50 -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,18 @@
|
||||
package pet
|
||||
{
|
||||
public class GuiPet extends PetBase
|
||||
{
|
||||
|
||||
public var idx:int;
|
||||
|
||||
public var petName:String;
|
||||
|
||||
public function GuiPet(param1:int, param2:uint, param3:uint, param4:uint, param5:int, param6:String, param7:Function)
|
||||
{
|
||||
super(param2,param3,param4,param7);
|
||||
this.idx = param1;
|
||||
this.petName = param6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
package pet
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import loader.MediaHelper;
|
||||
|
||||
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 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 _type:int;
|
||||
|
||||
protected var _defId:int;
|
||||
|
||||
protected var _lBits:uint;
|
||||
|
||||
protected var _uBits:uint;
|
||||
|
||||
protected var _eBits:uint;
|
||||
|
||||
protected var _content:MovieClip;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _onPetLoadedCallback:Function;
|
||||
|
||||
public function PetBase(param1:uint, param2:uint, param3:uint, param4:Function)
|
||||
{
|
||||
super();
|
||||
this._lBits = param1;
|
||||
this._uBits = param2;
|
||||
this._eBits = param3;
|
||||
this._onPetLoadedCallback = param4;
|
||||
this._defId = param1 & 0xFF;
|
||||
this._type = PetManager.petTypeForDefId(this._defId);
|
||||
this._mediaHelper = new MediaHelper();
|
||||
this._mediaHelper.init(this.mediaIdForDefId(this._defId),this.onMediaLoaded,true);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function isGround() : Boolean
|
||||
{
|
||||
return PetManager.isGround(this._type);
|
||||
}
|
||||
|
||||
public function getType() : int
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public function getDefID() : int
|
||||
{
|
||||
return this._defId;
|
||||
}
|
||||
|
||||
public function canGoInOcean() : Boolean
|
||||
{
|
||||
if(this._type == PetManager.TYPE_OCEAN_LOW || this._type == PetManager.TYPE_OCEAN_HIGH || this._type == PetManager.TYPE_AMPHIB_LOW || this._type == PetManager.TYPE_AMPHIB_HIGH)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function canGoOnLand() : Boolean
|
||||
{
|
||||
if(this._type == PetManager.TYPE_LAND_LOW || this._type == PetManager.TYPE_LAND_HIGH || this._type == PetManager.TYPE_AMPHIB_LOW || this._type == PetManager.TYPE_AMPHIB_HIGH)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getLBits() : uint
|
||||
{
|
||||
return this._lBits;
|
||||
}
|
||||
|
||||
public function getUBits() : uint
|
||||
{
|
||||
return this._uBits;
|
||||
}
|
||||
|
||||
public function getEBits() : uint
|
||||
{
|
||||
return this._eBits;
|
||||
}
|
||||
|
||||
public function getContent() : MovieClip
|
||||
{
|
||||
return this._content;
|
||||
}
|
||||
|
||||
public function colorMyItem(param1:int, param2:MovieClip, param3:int, param4:int, param5:int, param6:int, param7:int, param8:int) : void
|
||||
{
|
||||
if(this._content)
|
||||
{
|
||||
this._content.colorMe(param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateAllBits(param1:uint, param2:uint, param3:uint) : void
|
||||
{
|
||||
if(this._content)
|
||||
{
|
||||
this._lBits = param1;
|
||||
this._uBits = param2;
|
||||
this._eBits = param3;
|
||||
PetManager.setPetState(this._content,this._lBits,this._uBits,this._eBits);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateUBits(param1:uint) : void
|
||||
{
|
||||
this._uBits = param1;
|
||||
PetManager.setPetState(this._content,this._lBits,this._uBits,this._eBits);
|
||||
}
|
||||
|
||||
protected function setSparkle(param1:int) : void
|
||||
{
|
||||
if(this._content)
|
||||
{
|
||||
this._content.pet.setSparkle(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
this._content = param1;
|
||||
this.addChild(this._content);
|
||||
this._mediaHelper.destroy();
|
||||
delete this._content.mediaHelper;
|
||||
delete this._content.passback;
|
||||
PetManager.setPetState(this._content,this._lBits,this._uBits,this._eBits);
|
||||
if(this._onPetLoadedCallback != null)
|
||||
{
|
||||
this._onPetLoadedCallback(this._content);
|
||||
}
|
||||
this._content.pet.setAnim(0);
|
||||
}
|
||||
}
|
||||
|
||||
private function mediaIdForDefId(param1:int) : int
|
||||
{
|
||||
var _loc2_:Object = PetManager.getPetDef(param1);
|
||||
if(_loc2_)
|
||||
{
|
||||
return _loc2_.mediaRefId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,688 @@
|
||||
package pet
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.AvatarManager;
|
||||
import avatar.AvatarWorldView;
|
||||
import avatar.UserCommXtCommManager;
|
||||
import avatar.UserInfo;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import den.DenXtCommManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import gui.PetFinder;
|
||||
import gui.PetMastery;
|
||||
import item.Item;
|
||||
|
||||
public class PetManager
|
||||
{
|
||||
|
||||
private static var _petDefs:Object;
|
||||
|
||||
private static var _myPetList:Array;
|
||||
|
||||
private static var _myActivePetInvId:int;
|
||||
|
||||
private static var _petFinderCloseCallback:Function;
|
||||
|
||||
private static var _petFinder:PetFinder;
|
||||
|
||||
private static var _petMasteryMgr:PetMastery;
|
||||
|
||||
public static const TYPE_LAND_LOW:int = 0;
|
||||
|
||||
public static const TYPE_LAND_HIGH:int = 1;
|
||||
|
||||
public static const TYPE_OCEAN_LOW:int = 2;
|
||||
|
||||
public static const TYPE_OCEAN_HIGH:int = 3;
|
||||
|
||||
public static const TYPE_AMPHIB_LOW:int = 4;
|
||||
|
||||
public static const TYPE_AMPHIB_HIGH:int = 5;
|
||||
|
||||
public static const LIMITED_TIME:int = 1;
|
||||
|
||||
public static const MASTERY_ACHIV_MIN_COUNT:int = 100;
|
||||
|
||||
private static const EVT_ICON_ID:int = 44;
|
||||
|
||||
public function PetManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
_myPetList = [];
|
||||
}
|
||||
|
||||
public static function set petDefs(param1:Object) : void
|
||||
{
|
||||
_petDefs = param1;
|
||||
}
|
||||
|
||||
public static function openPetFinder(param1:String = "", param2:Function = null, param3:Boolean = false, param4:Array = null) : void
|
||||
{
|
||||
if(_petFinder)
|
||||
{
|
||||
_petFinder.destroy();
|
||||
_petFinder = null;
|
||||
}
|
||||
_petFinder = new PetFinder();
|
||||
if(param1 == "")
|
||||
{
|
||||
_petFinder.init(-1,param2);
|
||||
}
|
||||
else
|
||||
{
|
||||
_petFinder.init(petDefIdForName(param1),param2,param3,param4);
|
||||
}
|
||||
}
|
||||
|
||||
public static function checkAndOpenMasteryPopup(param1:Boolean) : void
|
||||
{
|
||||
if(Boolean(myActivePet) && Boolean(myActivePet.masteryCounter >= MASTERY_ACHIV_MIN_COUNT) && param1)
|
||||
{
|
||||
if(!_petMasteryMgr)
|
||||
{
|
||||
_petMasteryMgr = new PetMastery();
|
||||
_petMasteryMgr.init();
|
||||
}
|
||||
_petMasteryMgr.displayMasteryPopup();
|
||||
}
|
||||
}
|
||||
|
||||
public static function onPetListResponse(param1:Array, param2:Function) : void
|
||||
{
|
||||
var _loc4_:Array = null;
|
||||
var _loc6_:String = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:Object = null;
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
var _loc3_:* = 2;
|
||||
var _loc5_:String = param1[_loc3_++];
|
||||
if(_loc5_ == "1")
|
||||
{
|
||||
_loc6_ = param1[_loc3_++];
|
||||
_loc7_ = int(param1[_loc3_++]);
|
||||
_loc4_ = [];
|
||||
_loc9_ = -1;
|
||||
_loc10_ = 0;
|
||||
while(_loc10_ < _loc7_)
|
||||
{
|
||||
_loc8_ = {
|
||||
"idx":int(param1[_loc3_++]),
|
||||
"name":param1[_loc3_++],
|
||||
"isGround":isGround(param1[_loc3_++]),
|
||||
"lBits":uint(param1[_loc3_++]),
|
||||
"uBits":uint(param1[_loc3_++]),
|
||||
"eBits":uint(param1[_loc3_++]),
|
||||
"masteryCounter":uint(param1[_loc3_++]),
|
||||
"isSparkling":false
|
||||
};
|
||||
_loc8_.defId = getDefIdFromLBits(_loc8_.lBits);
|
||||
_loc8_.type = petTypeForDefId(_loc8_.defId);
|
||||
_loc4_.push(_loc8_);
|
||||
_loc10_++;
|
||||
}
|
||||
_loc4_.sortOn("idx",Array.NUMERIC);
|
||||
if(_loc6_ == gMainFrame.userInfo.myUserName)
|
||||
{
|
||||
_myPetList = _loc4_;
|
||||
}
|
||||
}
|
||||
if(param2 != null)
|
||||
{
|
||||
param2(_loc4_,_loc5_ == "-1");
|
||||
}
|
||||
}
|
||||
|
||||
public static function isGround(param1:int) : Boolean
|
||||
{
|
||||
return param1 == PetBase.TYPE_LAND_GROUND || param1 == PetBase.TYPE_OCEAN_GROUND || param1 == PetBase.TYPE_AMPHIB_GROUND;
|
||||
}
|
||||
|
||||
public static function onPetCreateResponse(param1:Array, param2:Function) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:uint = 0;
|
||||
var _loc9_:uint = 0;
|
||||
var _loc10_:uint = 0;
|
||||
var _loc11_:String = null;
|
||||
var _loc12_:int = 0;
|
||||
var _loc13_:Object = null;
|
||||
var _loc14_:Object = null;
|
||||
var _loc3_:* = 2;
|
||||
if(param1[_loc3_++] == "1")
|
||||
{
|
||||
_loc5_ = int(param1[_loc3_++]);
|
||||
_loc6_ = int(param1[_loc3_++]);
|
||||
switch(_loc6_)
|
||||
{
|
||||
case Item.GEM_CURRENCY:
|
||||
_loc4_ = int(gMainFrame.clientInfo.gemCount);
|
||||
if(_loc4_ != _loc5_)
|
||||
{
|
||||
gMainFrame.clientInfo.gemCount = _loc5_;
|
||||
}
|
||||
break;
|
||||
case Item.TICKET_CURRENCY:
|
||||
_loc4_ = int(gMainFrame.clientInfo.ticketCount);
|
||||
if(_loc4_ != _loc5_)
|
||||
{
|
||||
gMainFrame.clientInfo.ticketCount = _loc5_;
|
||||
}
|
||||
break;
|
||||
case Item.ORB_CURRENCY:
|
||||
_loc4_ = int(gMainFrame.clientInfo.orbCount);
|
||||
if(_loc4_ != _loc5_)
|
||||
{
|
||||
gMainFrame.clientInfo.orbCount = _loc5_;
|
||||
}
|
||||
break;
|
||||
case Item.DIAMOND_CURRENCY:
|
||||
_loc4_ = int(gMainFrame.clientInfo.diamondCount);
|
||||
if(_loc4_ != _loc5_)
|
||||
{
|
||||
gMainFrame.clientInfo.diamondCount = _loc5_;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error("ItemManager: Received unknown currencyType: " + _loc6_);
|
||||
}
|
||||
if(_loc4_ != _loc5_)
|
||||
{
|
||||
AJAudio.playShopCachingSound();
|
||||
}
|
||||
_loc7_ = int(param1[_loc3_++]);
|
||||
_loc8_ = uint(param1[_loc3_++]);
|
||||
_loc9_ = uint(param1[_loc3_++]);
|
||||
_loc10_ = uint(param1[_loc3_++]);
|
||||
_loc11_ = param1[_loc3_++];
|
||||
_loc12_ = getDefIdFromLBits(_loc8_);
|
||||
_loc13_ = getPetDef(_loc12_);
|
||||
if(_loc13_)
|
||||
{
|
||||
_loc14_ = {
|
||||
"idx":_loc7_,
|
||||
"name":_loc11_,
|
||||
"defId":_loc12_,
|
||||
"type":_loc13_.type,
|
||||
"lBits":_loc8_,
|
||||
"uBits":_loc9_,
|
||||
"eBits":_loc10_,
|
||||
"isSparkling":false
|
||||
};
|
||||
_loc14_.masteryCounter = 0;
|
||||
_myPetList.push(_loc14_);
|
||||
if(!_loc13_.isMember || Boolean(gMainFrame.userInfo.isMember))
|
||||
{
|
||||
AvatarManager.playerAvatarWorldView.setActivePet(_loc8_,_loc9_,_loc10_);
|
||||
myActivePetInvId = _loc7_;
|
||||
}
|
||||
DenXtCommManager.addPetToDen(_loc14_);
|
||||
AvatarManager.setPetAction(AvatarManager.playerSfsUserId,WorldPet.ACTION_SPARKLE,0);
|
||||
if(param2 != null)
|
||||
{
|
||||
param2();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"You can\'t adopt a pet right now! Try again!");
|
||||
}
|
||||
}
|
||||
|
||||
public static function onPetSwitchResponse(param1:Array, param2:Function) : void
|
||||
{
|
||||
var _loc5_:AvatarWorldView = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:UserInfo = null;
|
||||
var _loc8_:AvatarInfo = null;
|
||||
var _loc9_:Object = null;
|
||||
var _loc10_:Boolean = false;
|
||||
var _loc11_:Object = null;
|
||||
var _loc3_:* = 2;
|
||||
var _loc4_:Boolean = param1[_loc3_++] == "1";
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc6_ = int(param1[_loc3_++]);
|
||||
_loc5_ = AvatarManager.getAvatarWorldViewBySfsUserId(_loc6_);
|
||||
if(_loc6_ == gMainFrame.server.userId)
|
||||
{
|
||||
myActivePetInvId = int(param1[_loc3_++]);
|
||||
if(_loc5_)
|
||||
{
|
||||
if(myActivePetInvId != 0)
|
||||
{
|
||||
for each(_loc11_ in _myPetList)
|
||||
{
|
||||
if(_loc11_.idx == myActivePetInvId)
|
||||
{
|
||||
_loc5_.setActivePet(_loc11_.lBits,_loc11_.uBits,_loc11_.eBits);
|
||||
_loc10_ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_.setActivePet(0,0,0);
|
||||
}
|
||||
_loc7_ = gMainFrame.userInfo.getUserInfoByUserName(_loc5_.userName);
|
||||
for each(_loc8_ in _loc7_.avList)
|
||||
{
|
||||
if(_loc8_.dbAvId == _loc5_.dbAvId)
|
||||
{
|
||||
if(AvatarManager.roomEnviroType == Utility.ENVIRO_LAND)
|
||||
{
|
||||
_loc8_.landPetInvId = myActivePetInvId;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc8_.oceanPetInvId = myActivePetInvId;
|
||||
}
|
||||
gMainFrame.userInfo.setUserInfoByUserName(_loc5_.userName,_loc7_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
AvatarManager.setPetAction(AvatarManager.playerSfsUserId,WorldPet.ACTION_SPARKLE,0);
|
||||
_loc9_ = myActivePet;
|
||||
if(_loc9_)
|
||||
{
|
||||
_loc5_.setActivePet(_loc9_.lBits,_loc9_.uBits,_loc9_.eBits);
|
||||
_loc9_.isSparkling = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(_loc5_)
|
||||
{
|
||||
_loc5_.setActivePet(uint(param1[_loc3_++]),uint(param1[_loc3_++]),uint(param1[_loc3_++]));
|
||||
}
|
||||
if(param2 != null)
|
||||
{
|
||||
param2();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"You can\'t switch pets right now! Try again!");
|
||||
}
|
||||
}
|
||||
|
||||
public static function onPetItemsResponse(param1:Array, param2:Function) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:Object = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
var _loc3_:* = 2;
|
||||
var _loc4_:Boolean = param1[_loc3_++] == "1";
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = int(param1[_loc3_++]);
|
||||
gMainFrame.clientInfo.gemCount = _loc5_;
|
||||
AJAudio.playShopCachingSound();
|
||||
_loc6_ = myActivePet;
|
||||
if(_loc6_ == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_loc7_ = int(param1[_loc3_++]);
|
||||
if(_loc6_.idx != _loc7_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_loc8_ = int(param1[_loc3_++]);
|
||||
_loc9_ = int(param1[_loc3_++]);
|
||||
_loc10_ = int(param1[_loc3_++]);
|
||||
_loc6_.lBits = _loc8_;
|
||||
_loc6_.uBits = _loc9_;
|
||||
_loc6_.eBits = _loc10_;
|
||||
AvatarManager.playerAvatarWorldView.setActivePet(_loc8_,_loc9_,_loc10_);
|
||||
myActivePetInvId = _loc7_;
|
||||
DenXtCommManager.reloadPetInDen(_loc7_,_loc8_,_loc9_,_loc10_);
|
||||
}
|
||||
if(param2 != null)
|
||||
{
|
||||
param2(_loc4_);
|
||||
}
|
||||
}
|
||||
|
||||
public static function onPetMasteryResponse(param1:Array, param2:Function) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc3_:* = 2;
|
||||
var _loc4_:Boolean = param1[_loc3_++] == "1";
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = int(param1[_loc3_++]);
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _myPetList.length)
|
||||
{
|
||||
if(_myPetList[_loc6_].idx == _loc5_)
|
||||
{
|
||||
_loc7_ = int(param1[_loc3_++]);
|
||||
_loc8_ = int(param1[_loc3_++]);
|
||||
_loc9_ = int(param1[_loc3_++]);
|
||||
_myPetList[_loc6_].lBits = _loc7_;
|
||||
_myPetList[_loc6_].uBits = _loc8_;
|
||||
_myPetList[_loc6_].eBits = _loc9_;
|
||||
DenXtCommManager.reloadPetInDen(_loc5_,_loc7_,_loc8_,_loc9_);
|
||||
break;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param2 != null)
|
||||
{
|
||||
param2(_loc4_);
|
||||
}
|
||||
}
|
||||
|
||||
public static function onPetDismissResponse(param1:Array, param2:Function) : void
|
||||
{
|
||||
var _loc3_:Boolean = false;
|
||||
var _loc4_:Boolean = false;
|
||||
var _loc7_:int = 0;
|
||||
var _loc5_:Boolean = param1[2] == "1";
|
||||
var _loc6_:int = int(param1[3]);
|
||||
if(_loc5_)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _myPetList.length)
|
||||
{
|
||||
if(_myPetList[_loc7_].idx == _loc6_)
|
||||
{
|
||||
if(_myActivePetInvId == _myPetList[_loc7_].idx)
|
||||
{
|
||||
_myActivePetInvId = 0;
|
||||
AvatarManager.playerAvatarWorldView.setActivePet(0,0,0);
|
||||
_loc4_ = true;
|
||||
AvatarManager.setPetAction(AvatarManager.playerSfsUserId,WorldPet.ACTION_SPARKLE,0);
|
||||
}
|
||||
_myPetList.splice(_loc7_,1);
|
||||
DenXtCommManager.removePetFromDen(_loc6_);
|
||||
_loc3_ = true;
|
||||
break;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"You can\'t free your pet right now! Try again!");
|
||||
}
|
||||
if(param2 != null)
|
||||
{
|
||||
param2(_loc5_,_loc3_,_loc4_);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getPetSprite(param1:uint, param2:uint, param3:uint, param4:int, param5:Function = null) : Sprite
|
||||
{
|
||||
return Sprite(new PetBase(param1,param2,param3,param5));
|
||||
}
|
||||
|
||||
public static function getGuiPet(param1:int, param2:uint, param3:uint, param4:uint, param5:int, param6:String, param7:Function = null) : GuiPet
|
||||
{
|
||||
return new GuiPet(param1,param2,param3,param4,param5,param6,param7);
|
||||
}
|
||||
|
||||
public static function get myPetList() : Array
|
||||
{
|
||||
return _myPetList;
|
||||
}
|
||||
|
||||
public static function set myActivePetInvId(param1:int) : void
|
||||
{
|
||||
_myActivePetInvId = param1;
|
||||
}
|
||||
|
||||
public static function addToActivePetMastery(param1:int) : void
|
||||
{
|
||||
myActivePet.masteryCounter += param1;
|
||||
}
|
||||
|
||||
public static function get myActivePetInvId() : int
|
||||
{
|
||||
return _myActivePetInvId;
|
||||
}
|
||||
|
||||
public static function getMyPetByInvId(param1:int) : Object
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
for each(_loc2_ in _myPetList)
|
||||
{
|
||||
if(_loc2_.idx == param1)
|
||||
{
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function get myActivePet() : Object
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
for each(_loc1_ in _myPetList)
|
||||
{
|
||||
if(_loc1_.idx == _myActivePetInvId)
|
||||
{
|
||||
return _loc1_;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function petTypeForDefId(param1:int) : int
|
||||
{
|
||||
if(Boolean(_petDefs) && Boolean(_petDefs[param1]))
|
||||
{
|
||||
return _petDefs[param1].type;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static function getPetDef(param1:int) : Object
|
||||
{
|
||||
if(_petDefs)
|
||||
{
|
||||
return _petDefs[param1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function petForPetDefId(param1:int) : Object
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
for each(_loc2_ in _myPetList)
|
||||
{
|
||||
if(_loc2_.defId == param1)
|
||||
{
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getEnviroTypeByPetType(param1:int) : int
|
||||
{
|
||||
if(param1 == TYPE_LAND_LOW || param1 == TYPE_LAND_HIGH)
|
||||
{
|
||||
return Utility.ENVIRO_LAND;
|
||||
}
|
||||
if(param1 == TYPE_OCEAN_HIGH || param1 == TYPE_OCEAN_LOW)
|
||||
{
|
||||
return Utility.ENVIRO_OCEAN;
|
||||
}
|
||||
if(param1 == TYPE_AMPHIB_LOW || param1 == TYPE_AMPHIB_HIGH)
|
||||
{
|
||||
return AvatarManager.roomEnviroType;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static function setPetState(param1:MovieClip, param2:uint, param3:uint, param4:uint) : void
|
||||
{
|
||||
var _loc5_:int = param2 & 0xFF;
|
||||
if(_loc5_ == 15)
|
||||
{
|
||||
param1.pet.setState(param2,param3,param4,AvatarManager.roomEnviroType);
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.pet.setState(param2,param3);
|
||||
}
|
||||
}
|
||||
|
||||
public static function petDefIdForName(param1:String) : int
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case "frog":
|
||||
return PetBase.DEF_ID_FROG;
|
||||
case "kitten":
|
||||
return PetBase.DEF_ID_CAT;
|
||||
case "puppy":
|
||||
return PetBase.DEF_ID_DOG;
|
||||
case "ducky":
|
||||
return PetBase.DEF_ID_DUCK;
|
||||
case "butterfly":
|
||||
return PetBase.DEF_ID_BFLY;
|
||||
case "hamster":
|
||||
return PetBase.DEF_ID_HAMS;
|
||||
case "bat":
|
||||
return PetBase.DEF_ID_BAT;
|
||||
case "seahorse":
|
||||
return PetBase.DEF_ID_SEAHORSE;
|
||||
case "anglerfish":
|
||||
return PetBase.DEF_ID_ANGLER;
|
||||
case "reindeer":
|
||||
return PetBase.DEF_ID_REINDEER;
|
||||
case "snake":
|
||||
return PetBase.DEF_ID_SNAKE;
|
||||
case "jellyfish":
|
||||
return PetBase.DEF_ID_JELLYFISH;
|
||||
case "bunny":
|
||||
return PetBase.DEF_ID_BUNNY;
|
||||
case "hummingbird":
|
||||
return PetBase.DEF_ID_HUMMINGBIRD;
|
||||
case "turtle":
|
||||
return PetBase.DEF_ID_TURTLE;
|
||||
case "monkey":
|
||||
return PetBase.DEF_ID_MONKEY;
|
||||
case "tarantula":
|
||||
return PetBase.DEF_ID_TARANTUAL;
|
||||
case "fox":
|
||||
return PetBase.DEF_ID_FOX;
|
||||
case "owl":
|
||||
return PetBase.DEF_ID_OWL;
|
||||
case "tiger":
|
||||
return PetBase.DEF_ID_TIGER;
|
||||
case "arcticwolfpup":
|
||||
return PetBase.DEF_ID_ARCTIC_WOLF;
|
||||
case "raccoon":
|
||||
return PetBase.DEF_ID_RACCOON;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static function petNameForDefId(param1:int) : String
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case PetBase.DEF_ID_FROG:
|
||||
return "frog";
|
||||
case PetBase.DEF_ID_CAT:
|
||||
return "kitten";
|
||||
case PetBase.DEF_ID_DOG:
|
||||
return "puppy";
|
||||
case PetBase.DEF_ID_DUCK:
|
||||
return "ducky";
|
||||
case PetBase.DEF_ID_BFLY:
|
||||
return "butterfly";
|
||||
case PetBase.DEF_ID_HAMS:
|
||||
return "hamster";
|
||||
case PetBase.DEF_ID_BAT:
|
||||
return "bat";
|
||||
case PetBase.DEF_ID_SEAHORSE:
|
||||
return "seahorse";
|
||||
case PetBase.DEF_ID_ANGLER:
|
||||
return "anglerfish";
|
||||
case PetBase.DEF_ID_REINDEER:
|
||||
return "reindeer";
|
||||
case PetBase.DEF_ID_SNAKE:
|
||||
return "snake";
|
||||
case PetBase.DEF_ID_JELLYFISH:
|
||||
return "jellyfish";
|
||||
case PetBase.DEF_ID_BUNNY:
|
||||
return "bunny";
|
||||
case PetBase.DEF_ID_HUMMINGBIRD:
|
||||
return "hummingbird";
|
||||
case PetBase.DEF_ID_TURTLE:
|
||||
return "turtle";
|
||||
case PetBase.DEF_ID_MONKEY:
|
||||
return "monkey";
|
||||
case PetBase.DEF_ID_TARANTUAL:
|
||||
return "tarantula";
|
||||
case PetBase.DEF_ID_FOX:
|
||||
return "fox";
|
||||
case PetBase.DEF_ID_OWL:
|
||||
return "owl";
|
||||
case PetBase.DEF_ID_TIGER:
|
||||
return "tiger";
|
||||
case PetBase.DEF_ID_ARCTIC_WOLF:
|
||||
return "arcticwolfpup";
|
||||
case PetBase.DEF_ID_RACCOON:
|
||||
return "raccoon";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static function getDefIdFromLBits(param1:int) : int
|
||||
{
|
||||
return param1 & 0xFF;
|
||||
}
|
||||
|
||||
public static function sendPetSparkle(param1:int) : void
|
||||
{
|
||||
UserCommXtCommManager.sendPetAction(WorldPet.ACTION_SPARKLE,param1);
|
||||
}
|
||||
|
||||
public static function getPetInventoryMax() : int
|
||||
{
|
||||
return gMainFrame.userInfo.userVarCache.getUserVarValueById(AchievementXtCommManager.UV_PET_INVENTORY_MAX);
|
||||
}
|
||||
|
||||
public static function isPetAvailable(param1:int) : Boolean
|
||||
{
|
||||
if((gMainFrame.userInfo.userVarCache.getUserVarValueById(AchievementXtCommManager.UV_PET_VIEWABLE_FLAG) & 1 << param1 - 1) != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
package pet
|
||||
{
|
||||
import com.sbi.client.SFEvent;
|
||||
import loader.DefPacksDefHelper;
|
||||
|
||||
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;
|
||||
|
||||
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_);
|
||||
}
|
||||
}
|
||||
|
||||
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:uint, param4:int, param5:int, param6:Function = null, param7:Boolean = false) : void
|
||||
{
|
||||
_pcCallback = param6;
|
||||
gMainFrame.server.setXtObject_Str("pc",[param1,param2,param3,param4,param5,param7 ? "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,GenericListXtCommManager.getAvailListUniqueId(),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 petDefsResponse(param1:DefPacksDefHelper) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:Object = null;
|
||||
var _loc5_:Array = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc2_:Object = new Object();
|
||||
for each(_loc4_ in param1.def)
|
||||
{
|
||||
_loc3_ = {
|
||||
"defId":int(_loc4_.id),
|
||||
"mediaRefId":int(_loc4_.mediaRefId),
|
||||
"type":int(_loc4_.type),
|
||||
"isGround":PetManager.isGround(_loc4_.type),
|
||||
"title":_loc4_.title,
|
||||
"isMember":_loc4_.isMember == "1",
|
||||
"cost":int(_loc4_.cost),
|
||||
"status":int(_loc4_.status)
|
||||
};
|
||||
_loc2_[_loc3_.defId] = _loc3_;
|
||||
}
|
||||
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_PET] = null;
|
||||
PetManager.petDefs = _loc2_;
|
||||
_loc5_ = PetManager.myPetList;
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc5_.length)
|
||||
{
|
||||
if(_loc5_[_loc6_].type == -1)
|
||||
{
|
||||
_loc5_[_loc6_].type = PetManager.petTypeForDefId(_loc5_[_loc6_].defId);
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
if(canLoadPetList)
|
||||
{
|
||||
sendPetListRequest(gMainFrame.server.userName);
|
||||
}
|
||||
canLoadPetList = true;
|
||||
}
|
||||
|
||||
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 onPetSwitchResponse(param1:Array) : void
|
||||
{
|
||||
PetManager.onPetSwitchResponse(param1,_psCallback);
|
||||
_psCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,266 @@
|
||||
package pet
|
||||
{
|
||||
import avatar.AvatarWorldView;
|
||||
import avatar.UserCommXtCommManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Matrix;
|
||||
import gui.SharedAvatarAnimalConstants;
|
||||
|
||||
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 ACTION_CLICK:int = 0;
|
||||
|
||||
public static const ACTION_SPARKLE:int = 1;
|
||||
|
||||
public static const PET_SPARKLE_TIME:int = 60 * 5 * 24;
|
||||
|
||||
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:uint, param3:uint, param4:uint, param5:int = 0)
|
||||
{
|
||||
super(param2,param3,param4,this.onPetLoaded);
|
||||
this._sparkle = param5;
|
||||
this._parent = param1;
|
||||
this._targetX = 0;
|
||||
this._bNewTarget = true;
|
||||
this._mode = 1;
|
||||
this._lastAnim = -1;
|
||||
this._bUpdateState = true;
|
||||
this._bFlip = false;
|
||||
this._bBack = false;
|
||||
this._bSpecialMove = false;
|
||||
this._parent.addChild(this);
|
||||
if(param1.userName == gMainFrame.server.userName)
|
||||
{
|
||||
this.addEventListener(MouseEvent.MOUSE_DOWN,this.onClick,false,0,true);
|
||||
}
|
||||
if(_type == PetManager.TYPE_LAND_LOW || _type == PetManager.TYPE_OCEAN_LOW || _type == PetManager.TYPE_AMPHIB_LOW)
|
||||
{
|
||||
this._y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._y = this._airPetYOffest;
|
||||
}
|
||||
this._parentLastX = this._parent.x;
|
||||
this._parentLastY = this._parent.y;
|
||||
if(_type == PetManager.TYPE_OCEAN_LOW)
|
||||
{
|
||||
this._minX -= this._oceanPetXOffset;
|
||||
this._maxX += this._oceanPetXOffset;
|
||||
}
|
||||
else if(_type == PetManager.TYPE_LAND_LOW)
|
||||
{
|
||||
if(param1.avTypeId != SharedAvatarAnimalConstants.AV_KOALA)
|
||||
{
|
||||
this._minX -= this._petLandLowXOffset;
|
||||
}
|
||||
}
|
||||
this._x = 0;
|
||||
this._targetX = 0;
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
super.destroy();
|
||||
this.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClick);
|
||||
}
|
||||
|
||||
public function heartbeat() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Matrix = null;
|
||||
var _loc4_:int = 0;
|
||||
if(_content)
|
||||
{
|
||||
if(this._targetX == 0)
|
||||
{
|
||||
this._targetX = this._parent.hFlip ? int(this._minX) : int(this._maxX);
|
||||
}
|
||||
if(this._parentLastX != this._parent.x)
|
||||
{
|
||||
this._bFlip = this._parent.x > this._parentLastX ? true : false;
|
||||
if(Math.abs(this._parentLastX - this._parent.x) > 13)
|
||||
{
|
||||
this._targetX = this._bFlip ? int(this._minX) : int(this._maxX);
|
||||
}
|
||||
this._parentLastX = this._parent.x;
|
||||
}
|
||||
if(this._parentLastY != this._parent.y)
|
||||
{
|
||||
this._bBack = this._parent.y < this._parentLastY - 10 ? true : false;
|
||||
this._parentLastY = this._parent.y;
|
||||
}
|
||||
if(this._x > this._targetX)
|
||||
{
|
||||
this._x -= 10;
|
||||
if(this._x <= this._targetX)
|
||||
{
|
||||
this._x = this._targetX;
|
||||
}
|
||||
this._bFlip = this._x == this._targetX ? true : false;
|
||||
}
|
||||
if(this._x < this._targetX)
|
||||
{
|
||||
this._x += 10;
|
||||
if(this._x > this._targetX)
|
||||
{
|
||||
this._x = this._targetX;
|
||||
}
|
||||
this._bFlip = this._x == this._targetX ? false : true;
|
||||
}
|
||||
if(this._bUpdateState)
|
||||
{
|
||||
PetManager.setPetState(_content,_lBits,_uBits,_eBits);
|
||||
this._bUpdateState = false;
|
||||
}
|
||||
_loc1_ = this._parent.inSplashVolume() ? ANIM_IDLE_WATER : ANIM_IDLE;
|
||||
if(Boolean(_loc1_) && this._parent.splashLiquid == "mud")
|
||||
{
|
||||
_loc1_ = ANIM_IDLE_MUD;
|
||||
}
|
||||
if(this._parent.splashLiquid != "mud" && this._parent.splashLiquid != "water")
|
||||
{
|
||||
_loc1_ = ANIM_IDLE;
|
||||
}
|
||||
_loc2_ = this._parent.isPetMovingTest() ? 1 : 0;
|
||||
if(this._x != this._targetX)
|
||||
{
|
||||
_loc2_ = 1;
|
||||
}
|
||||
_loc3_ = _content.transform.matrix;
|
||||
_loc3_.identity();
|
||||
_loc3_.scale(this._bFlip ? -this._scale : this._scale,this._scale);
|
||||
_loc3_.translate(this._x,this._y);
|
||||
_content.transform.matrix = _loc3_;
|
||||
_loc4_ = _loc1_ + _loc2_;
|
||||
if(this._bBack)
|
||||
{
|
||||
_loc4_ += 2;
|
||||
}
|
||||
if(this._lastAnim != _loc4_)
|
||||
{
|
||||
this._lastAnim = _loc4_;
|
||||
_content.pet.setAnim(_loc4_);
|
||||
}
|
||||
if(this._bSpecialMove)
|
||||
{
|
||||
this._bSpecialMove = false;
|
||||
if(!_loc2_)
|
||||
{
|
||||
_content.pet.setAnim(ANIM_CLICK + _loc1_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setState(param1:Array) : void
|
||||
{
|
||||
_lBits = param1[0];
|
||||
_uBits = param1[1];
|
||||
_eBits = param1[2];
|
||||
this._bUpdateState = true;
|
||||
}
|
||||
|
||||
public function setAction(param1:int, param2:int = 0) : void
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case ACTION_CLICK:
|
||||
this.onClick();
|
||||
break;
|
||||
case ACTION_SPARKLE:
|
||||
setSparkle(param2);
|
||||
}
|
||||
}
|
||||
|
||||
private function onClick(param1:MouseEvent = null) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
UserCommXtCommManager.sendPetAction(WorldPet.ACTION_CLICK);
|
||||
}
|
||||
this._bSpecialMove = true;
|
||||
}
|
||||
|
||||
private function onPetLoaded(param1:MovieClip) : void
|
||||
{
|
||||
_content.pet.setSparkle(this._sparkle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user