Brought up to date with the private repository (feea4c7)

This commit is contained in:
S committed 2026-10-14 20:57:33 +03:00
1 parent 1aa738d692
commit 1b1df1ae48
7925 files changed
+2617237 -20

No files matched your search

@@ -0,0 +1,410 @@
package avatar
{
import com.sbi.debug.DebugUtility;
import item.Item;
public class AccessoryState
{
private var _accShownItems:Array;
private var _accShownLayers:Array;
public var ownerAvatar:Avatar;
public function AccessoryState()
{
super();
}
public function init(param1:Avatar) : void
{
this._accShownItems = [];
this._accShownLayers = [];
this.ownerAvatar = param1;
if(this.ownerAvatar.avName == null)
{
DebugUtility.debugTrace("break here");
}
}
public function destroy() : void
{
if(this._accShownItems)
{
this._accShownItems = null;
}
if(this._accShownLayers)
{
this._accShownLayers = null;
}
}
public function copyShownAccRef(param1:AccessoryState) : void
{
DebugUtility.debugTrace("AccState copyAcc - ownerAvatar:" + this.ownerAvatar + (this.ownerAvatar ? " name:" + this.ownerAvatar.avName : "") + " copyFrom avatar:" + param1.ownerAvatar + " name:" + param1.ownerAvatar.avName);
this.accShownItems = param1.accShownItems;
this.accShownLayers = param1.accShownLayers;
}
public function cloneShownAcc(param1:AccessoryState) : void
{
this.accShownItems = param1.accShownItems;
var _loc2_:int = 0;
while(_loc2_ < this.accShownItems.length)
{
this.accShownItems[_loc2_] = this.accShownItems[_loc2_].clone();
_loc2_++;
}
this.accShownLayers = param1.accShownLayers;
}
public function matchShownItems(param1:AccessoryState, param2:Array, param3:Array) : void
{
var _loc6_:int = 0;
var _loc7_:int = 0;
var _loc4_:int = int(param1.accShownItems.length);
this.accShownLayers = param1.accShownLayers;
var _loc5_:int = 0;
while(_loc5_ < _loc4_)
{
if(param1.accShownItems[_loc5_].type == Item.CLOTHING_TYPE)
{
_loc6_ = 0;
while(_loc6_ < param2.length)
{
if(param1.accShownItems[_loc5_].invIdx == param2[_loc6_].invIdx)
{
this.accShownItems[_loc5_] = param2[_loc6_];
break;
}
_loc6_++;
}
}
else if(param1.accShownItems[_loc5_].type == Item.BODY_MOD_TYPE)
{
_loc7_ = 0;
while(_loc7_ < param3.length)
{
if(param1.accShownItems[_loc5_].invIdx == param3[_loc7_].invIdx)
{
this.accShownItems[_loc5_] = param3[_loc7_];
break;
}
_loc7_++;
}
}
_loc5_++;
}
}
public function get accShownItems() : Array
{
return this._accShownItems;
}
public function set accShownItems(param1:Array) : void
{
this._accShownItems = param1.concat();
}
public function get accShownLayers() : Array
{
return this._accShownLayers;
}
public function set accShownLayers(param1:Array) : void
{
this._accShownLayers = param1.concat();
}
public function showAccessory(param1:Item) : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
if(param1)
{
_loc2_ = 0;
_loc3_ = int(this._accShownItems.length);
while(_loc2_ < _loc3_)
{
if(this._accShownItems[_loc2_].invIdx == param1.invIdx)
{
DebugUtility.debugTrace("accessory showId:" + this._accShownItems[_loc2_].invIdx + " is already visible!");
break;
}
_loc2_++;
}
if(_loc2_ == _loc3_)
{
param1.setInUse(this.ownerAvatar.perUserAvId,true);
this.adjustAvatarQuestValues(true,param1);
this._accShownItems.push(param1);
this._accShownLayers.push(param1.layerId);
}
}
else
{
DebugUtility.debugTrace("WARNING: showAccessory received a null item");
}
}
public function replaceAccessory(param1:Item, param2:Item) : void
{
if(param1.accId != param2.accId)
{
throw new Error("Tried to replace accessory with different accId! Layers may not match! oldId:" + param1.accId + " newId:" + param2.accId);
}
var _loc3_:int = int(this._accShownItems.length);
var _loc4_:int = 0;
while(_loc4_ < _loc3_)
{
if(this._accShownItems[_loc4_] == param1)
{
this._accShownItems[_loc4_] = param2;
if(!param2.getInUse(this.ownerAvatar.perUserAvId))
{
this._accShownItems.splice(_loc4_,1);
this._accShownLayers.splice(_loc4_,1);
}
break;
}
_loc4_++;
}
}
public function isAccessoryVisibleByItemId(param1:int) : Boolean
{
var _loc2_:int = int(this._accShownItems.length);
var _loc3_:int = 0;
while(_loc3_ < _loc2_)
{
if(this._accShownItems[_loc3_].invIdx == param1)
{
return true;
}
_loc3_++;
}
return false;
}
public function isAccessoryVisibleByAccId(param1:int) : Boolean
{
var _loc2_:int = int(this._accShownItems.length);
var _loc3_:int = 0;
while(_loc3_ < _loc2_)
{
if(this._accShownItems[_loc3_].accId == param1)
{
return true;
}
_loc3_++;
}
return false;
}
public function isAccessoryVisibleByLayer(param1:int) : Boolean
{
var _loc2_:int = int(this._accShownLayers.length);
var _loc3_:int = 0;
while(_loc3_ < _loc2_)
{
if(this._accShownLayers[_loc3_] == param1)
{
return true;
}
_loc3_++;
}
return false;
}
public function getAccessoryVisibleDefIdByLayer(param1:int) : int
{
var _loc2_:int = int(this._accShownLayers.length);
var _loc3_:int = 0;
while(_loc3_ < _loc2_)
{
if(this._accShownLayers[_loc3_] == param1)
{
return this._accShownItems[_loc3_].defId;
}
_loc3_++;
}
return 0;
}
public function hideAccessory(param1:Item) : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
if(param1)
{
_loc2_ = 0;
_loc3_ = int(this._accShownItems.length);
while(_loc2_ < _loc3_)
{
if(this._accShownItems[_loc2_].invIdx == param1.invIdx)
{
param1.setInUse(this.ownerAvatar.perUserAvId,false);
this.adjustAvatarQuestValues(false,param1);
this._accShownItems.splice(_loc2_,1);
this._accShownLayers.splice(_loc2_,1);
break;
}
_loc2_++;
}
if(_loc2_ == this._accShownItems.length)
{
}
}
}
public function hideAll() : void
{
while(this._accShownItems.length > 0)
{
this.hideAccessory(this._accShownItems[0]);
}
}
public function removeAllItems() : void
{
this._accShownItems = [];
this._accShownLayers = [];
this.ownerAvatar.meleeAttack = [0,0];
this.ownerAvatar.rangedAttack = [0,0];
this.ownerAvatar.fierceAttack = [0,0];
this.ownerAvatar.healingPower = [0,0];
this.ownerAvatar.defense = [0,0];
}
public function hideAllExceptBase() : void
{
var _loc1_:int = 0;
var _loc2_:* = int(this._accShownItems.length);
while(_loc1_ < _loc2_)
{
if(this._accShownLayers[_loc1_] != 1)
{
this.hideAccessory(this._accShownItems[_loc1_]);
_loc2_--;
}
else
{
_loc1_++;
}
}
}
public function hideAllClothingArticles(param1:Array = null) : void
{
var _loc4_:int = 0;
var _loc2_:int = 0;
var _loc3_:* = int(this._accShownItems.length);
while(_loc2_ < _loc3_)
{
_loc4_ = int(this._accShownItems[_loc2_].layerId);
if(_loc4_ > 3)
{
if(param1)
{
param1.push(this._accShownItems[_loc2_].invIdx);
}
this.hideAccessory(this._accShownItems[_loc2_]);
_loc3_--;
}
else
{
_loc2_++;
}
}
}
private function adjustAvatarQuestValues(param1:Boolean, param2:Item) : void
{
if(param2.attack < 0)
{
if(param1)
{
this.ownerAvatar.healingPower[0] += param2.attack * -1;
}
else
{
this.ownerAvatar.healingPower[0] -= param2.attack * -1;
}
}
else if(param2.combatType == Item.COMBAT_TYPE_RANGED)
{
if(param1)
{
this.ownerAvatar.rangedAttack[0] += param2.attack;
}
else
{
this.ownerAvatar.rangedAttack[0] -= param2.attack;
}
}
else if(param1)
{
this.ownerAvatar.meleeAttack[0] += param2.attack;
}
else
{
this.ownerAvatar.meleeAttack[0] -= param2.attack;
}
if(param1)
{
this.ownerAvatar.fierceAttack[0] += param2.fierceAttack;
this.ownerAvatar.defense[0] += param2.defense;
}
else
{
this.ownerAvatar.fierceAttack[0] -= param2.fierceAttack;
this.ownerAvatar.defense[0] -= param2.defense;
}
switch(param2.modifierType)
{
case Item.MODIFIER_TYPE_DEFENSE:
if(param1)
{
this.ownerAvatar.defense[1] += param2.modifierValue;
}
else
{
this.ownerAvatar.defense[1] -= param2.modifierValue;
}
break;
case Item.MODIFIER_TYPE_MELEE:
if(param1)
{
this.ownerAvatar.meleeAttack[1] += param2.modifierValue;
}
else
{
this.ownerAvatar.meleeAttack[1] -= param2.modifierValue;
}
break;
case Item.MODIFIER_TYPE_RANGED:
if(param1)
{
this.ownerAvatar.rangedAttack[1] += param2.modifierValue;
}
else
{
this.ownerAvatar.rangedAttack[1] -= param2.modifierValue;
}
break;
case Item.MODIFIER_TYPE_RESTORE:
if(param1)
{
this.ownerAvatar.healingPower[1] += param2.modifierValue;
}
else
{
this.ownerAvatar.healingPower[1] -= param2.modifierValue;
}
}
}
}
}
@@ -0,0 +1,411 @@
package avatar
{
import com.sbi.debug.DebugUtility;
import flash.events.EventDispatcher;
import item.Inventory;
import item.Item;
import item.ItemXtCommManager;
import localization.LocalizationManager;
public class Avatar extends EventDispatcher
{
private var _avName:String;
private var _userName:String;
private var _uuid:String;
private var _sfsUserId:int;
private var _perUserAvId:int;
private var _avTypeId:int;
private var _roomType:int;
private var _customAvId:int;
private var _enviroTypeFlag:int;
private var _colors:Array;
private var _accState:AccessoryState;
public var inventoryClothing:Inventory;
public var inventoryBodyMod:Inventory;
public var inventoryDenFull:Inventory;
public var inventoryDenPartial:Inventory;
public var isShaman:Boolean;
public var shamanName:String;
public var shamanText:String;
public var rangedAttack:Array;
public var meleeAttack:Array;
public var fierceAttack:Array;
public var healingPower:Array;
public var defense:Array;
public function Avatar()
{
super();
}
public function init(param1:int, param2:String, param3:int, param4:Array, param5:int = -1, param6:AccessoryState = null, param7:String = "", param8:int = -1, param9:int = 0, param10:Array = null, param11:Array = null, param12:Array = null, param13:Array = null, param14:Array = null) : void
{
this.avTypeId = param3;
this._perUserAvId = param1;
this._roomType = param9;
this._customAvId = param5;
this._avName = param2;
this.rangedAttack = param10 == null ? [0,0] : param10;
this.meleeAttack = param11 == null ? [0,0] : param11;
this.fierceAttack = param12 == null ? [0,0] : param12;
this.healingPower = param13 == null ? [0,0] : param13;
this.defense = param14 == null ? [0,0] : param14;
if(param7 != "")
{
this.userName = param7;
}
this._sfsUserId = param8;
this._accState = new AccessoryState();
if(param6)
{
DebugUtility.debugTrace("Avatar init - copying accState");
this._accState.copyShownAccRef(param6);
DebugUtility.debugTrace("old ownerAvatar:" + (this._accState.ownerAvatar ? this._accState.ownerAvatar.avName : this._accState.ownerAvatar));
this._accState.ownerAvatar = this;
DebugUtility.debugTrace("new ownerAvatar:" + this._accState.ownerAvatar.avName);
}
else
{
this._accState.init(this);
}
if(param4)
{
this.copyColors(param4);
}
else
{
this._colors = null;
}
this.inventoryClothing = new Inventory();
this.inventoryBodyMod = new Inventory();
this.inventoryDenFull = new Inventory();
this.inventoryDenPartial = new Inventory();
this.inventoryClothing.init(this._accState);
this.inventoryBodyMod.init(this._accState);
this.inventoryDenFull.init(this._accState);
this.inventoryDenPartial.init(this._accState);
}
public function destroy() : void
{
if(this._accState)
{
this._accState.destroy();
this._accState = null;
}
if(this.inventoryClothing)
{
this.inventoryClothing.destroy();
this.inventoryClothing = null;
}
if(this.inventoryBodyMod)
{
this.inventoryBodyMod.destroy();
this.inventoryBodyMod = null;
}
if(this.inventoryDenFull)
{
this.inventoryDenFull.destroy();
this.inventoryDenFull = null;
}
if(this.inventoryDenPartial)
{
this.inventoryDenPartial.destroy();
this.inventoryDenPartial = null;
}
this._colors = null;
}
public function get perUserAvId() : int
{
return this._perUserAvId;
}
public function set perUserAvId(param1:int) : void
{
this._perUserAvId = param1;
}
public function get avName() : String
{
return LocalizationManager.translateAvatarName(this._avName);
}
public function set avName(param1:String) : void
{
this._avName = param1;
}
public function get userName() : String
{
return this._userName;
}
public function set userName(param1:String) : void
{
this._userName = param1;
}
public function get uuid() : String
{
return this._uuid;
}
public function set uuid(param1:String) : void
{
this._uuid = param1;
}
public function get sfsUserId() : int
{
return this._sfsUserId;
}
public function set avTypeId(param1:int) : void
{
this._avTypeId = param1;
this._enviroTypeFlag = gMainFrame.userInfo.getAvatarEnviroTypeFlagByAvType(this._avTypeId);
}
public function get avTypeId() : int
{
return this._avTypeId;
}
public function get enviroTypeFlag() : int
{
return this._enviroTypeFlag;
}
public function set colors(param1:Array) : void
{
this.setColors(param1[0],param1[1],param1[2]);
}
public function get colors() : Array
{
return this._colors;
}
public function get accShownItems() : Array
{
return this._accState.accShownItems;
}
public function set roomType(param1:int) : void
{
this._roomType = param1;
}
public function get customAvId() : int
{
return this._customAvId;
}
public function set customAvId(param1:int) : void
{
this._customAvId = param1;
}
public function get inUsePatternId() : int
{
return this._accState.getAccessoryVisibleDefIdByLayer(SbiConstants.LAYER_PATTERN_ID);
}
public function get inUseEyeId() : int
{
return this._accState.getAccessoryVisibleDefIdByLayer(SbiConstants.LAYER_EYE_ID);
}
public function copyShownAccRefsFromAvatar(param1:Avatar) : void
{
this._accState.copyShownAccRef(param1._accState);
this.inventoryBodyMod.itemArray = param1.inventoryBodyMod.itemArray.concat();
if(param1.inventoryClothing)
{
this.inventoryClothing.itemArray = param1.inventoryClothing.itemArray.concat();
}
}
public function cloneShownAccFromAvatar(param1:Avatar) : void
{
this._accState.cloneShownAcc(param1._accState);
this.inventoryBodyMod.itemArray = param1.inventoryBodyMod.itemArray.concat();
if(param1.inventoryClothing)
{
this.inventoryClothing.itemArray = param1.inventoryClothing.itemArray.concat();
}
}
public function matchShownAcc(param1:AccessoryState) : void
{
this._accState.matchShownItems(param1,this.inventoryClothing.itemArray,this.inventoryBodyMod.itemArray);
}
public function setColors(param1:uint, param2:uint, param3:uint) : void
{
if(this._colors == null)
{
this._colors = new Array(3);
}
var _loc4_:uint = uint(gMainFrame.userInfo.getAvatarColorLayer1InfoByAvType(this._avTypeId));
var _loc5_:int = param1 >> 24 & 0xFF;
var _loc6_:int = param1 >> 16 & 0xFF;
var _loc7_:int = _loc4_ >> 8 & 0xFF;
var _loc8_:int = _loc4_ & 0xFF;
var _loc9_:uint = uint(gMainFrame.userInfo.getAvatarColorLayer3InfoByAvType(this._avTypeId));
var _loc10_:int = param3 >> 24 & 0xFF;
var _loc11_:int = _loc9_ >> 16 & 0xFF;
var _loc12_:int = _loc9_ >> 8 & 0xFF;
var _loc13_:int = _loc9_ & 0xFF;
this._colors[0] = uint(_loc5_ << 24 | _loc6_ << 16 | _loc7_ << 8 | _loc8_);
this._colors[1] = param2;
this._colors[2] = uint(_loc10_ << 24 | _loc11_ << 16 | _loc12_ << 8 | _loc13_);
dispatchEvent(new AvatarEvent(AvatarEvent.AVATAR_CHANGED));
}
public function copyColors(param1:Array) : void
{
this.colors = param1.concat();
}
public function itemResponseIntegrate(param1:Array) : void
{
var _loc2_:int = 0;
var _loc3_:Item = null;
var _loc4_:Boolean = false;
var _loc5_:int = 0;
if(Boolean(this.inventoryBodyMod) && Boolean(this.inventoryClothing))
{
this.removeAllItems();
_loc2_ = int(param1.length);
_loc4_ = this._customAvId != -1;
_loc5_ = 0;
while(_loc5_ < _loc2_)
{
_loc3_ = param1[_loc5_];
if(_loc3_.type == Item.BODY_MOD_TYPE)
{
if(ItemXtCommManager.canUseItem(_loc3_.defId,this,_loc4_))
{
this.inventoryBodyMod.addItem(_loc3_);
if(_loc3_.getInUse(this._perUserAvId))
{
this._accState.showAccessory(_loc3_);
}
}
}
else if(_loc3_.type == Item.CLOTHING_TYPE)
{
if(this._enviroTypeFlag == 1 << SbiConstants.ENVIRO_LAND || this._enviroTypeFlag == 1 << SbiConstants.ENVIRO_OCEAN || this._enviroTypeFlag == 1 < SbiConstants.ENVIRO_AIR || _loc3_.enviroType == this._roomType)
{
this.inventoryClothing.addItem(_loc3_);
if(_loc3_.getInUse(this._perUserAvId))
{
this._accState.showAccessory(_loc3_);
}
}
}
else
{
DebugUtility.debugTrace("ERROR: Bad item type: " + _loc3_.type);
}
_loc5_++;
}
dispatchEvent(new AvatarEvent(AvatarEvent.AVATAR_CHANGED));
}
}
public function accStateShowAccessory(param1:Item, param2:Function = null) : void
{
var _loc4_:Item = null;
var _loc3_:Array = param1.type == Item.BODY_MOD_TYPE ? this.inventoryBodyMod.itemArray : this.inventoryClothing.itemArray;
var _loc5_:int = 0;
while(_loc5_ < _loc3_.length)
{
_loc4_ = _loc3_[_loc5_];
if(_loc4_.layerId == param1.layerId && _loc4_.getInUse(this._perUserAvId))
{
if(_loc4_ != param1)
{
this.accStateHideAccessory(_loc4_,false);
if(param2 != null)
{
param2(_loc4_);
}
break;
}
}
_loc5_++;
}
this._accState.showAccessory(param1);
dispatchEvent(new AvatarEvent(AvatarEvent.AVATAR_CHANGED));
}
public function accStateHideAccessory(param1:Item, param2:Boolean = true) : void
{
this._accState.hideAccessory(param1);
if(param2)
{
dispatchEvent(new AvatarEvent(AvatarEvent.AVATAR_CHANGED));
}
}
public function removeAllItems() : void
{
this.inventoryBodyMod.itemArray = [];
this.inventoryClothing.itemArray = [];
this._accState.removeAllItems();
}
public function get accState() : AccessoryState
{
return this._accState;
}
public function clone(param1:Avatar) : void
{
this._avTypeId = param1.avTypeId;
this._perUserAvId = param1.perUserAvId;
this._avName = param1.avName;
this.userName = param1.userName;
this._sfsUserId = param1._sfsUserId;
this._accState = new AccessoryState();
this._accState.cloneShownAcc(param1.accState);
this._accState.ownerAvatar = this;
this.copyColors(param1.colors);
this.inventoryClothing = new Inventory();
this.inventoryClothing.clone(param1.inventoryClothing);
this.inventoryBodyMod = new Inventory();
this.inventoryBodyMod.clone(param1.inventoryBodyMod);
this.inventoryDenFull = new Inventory();
this.inventoryDenFull.clone(param1.inventoryDenFull);
this.inventoryDenPartial = new Inventory();
this.inventoryDenPartial.clone(param1.inventoryDenPartial);
}
}
}
@@ -0,0 +1,92 @@
package avatar
{
import com.sbi.graphics.LayerAnim;
import item.Item;
public class AvatarEditorView extends AvatarView
{
public function AvatarEditorView()
{
super();
}
override public function init(param1:Avatar, param2:Function = null) : void
{
var _loc3_:int = 0;
var _loc4_:int = 0;
_avatar = new Avatar();
_avatar.init(param1.perUserAvId,"editorAvatar",param1.avTypeId,param1.colors,param1.customAvId,null,"",-1,0,param1.rangedAttack,param1.meleeAttack,param1.fierceAttack,param1.healingPower,param1.defense);
if(param1.inventoryClothing.itemArray)
{
_avatar.inventoryClothing.itemArray = param1.inventoryClothing.itemArray.concat();
_loc3_ = 0;
while(_loc3_ < _avatar.inventoryClothing.itemArray.length)
{
_avatar.inventoryClothing.itemArray[_loc3_].makeSmallIcon();
_loc3_++;
}
}
if(param1.inventoryBodyMod.itemArray)
{
_avatar.inventoryBodyMod.itemArray = param1.inventoryBodyMod.itemArray.concat();
_loc4_ = 0;
while(_loc4_ < _avatar.inventoryBodyMod.itemArray.length)
{
_avatar.inventoryBodyMod.itemArray[_loc4_].makeSmallIcon();
_loc4_++;
}
}
_avatar.matchShownAcc(param1.accState);
_avatar.addEventListener(AvatarEvent.AVATAR_CHANGED,avatarChanged,false,0,true);
_layerAnim = LayerAnim.getNew();
_layerAnim.avDefId = _avatar.avTypeId;
_layerAnim.layers = AvatarUtility.layerArrayForItemsAndColors(param1.inventoryClothing.itemArray.concat(param1.inventoryBodyMod.itemArray.concat()),param1.colors,param1.perUserAvId);
this.addChild(_layerAnim.bitmap);
}
override public function destroy(param1:Boolean = true) : void
{
if(param1 && Boolean(_avatar))
{
_avatar.removeEventListener(AvatarEvent.AVATAR_CHANGED,avatarChanged);
_avatar.destroy();
_avatar = null;
}
avTypeChangedCallback = null;
LayerAnim.destroy(_layerAnim);
_layerAnim = null;
}
public function get colors() : Array
{
return _avatar.colors;
}
public function set colors(param1:Array) : void
{
_avatar.colors = param1;
}
public function get accState() : AccessoryState
{
return _avatar.accState;
}
public function showAccessory(param1:Item, param2:Function = null) : void
{
_avatar.accStateShowAccessory(param1,param2);
}
public function hideAccessory(param1:Item) : void
{
_avatar.accStateHideAccessory(param1);
}
public function get viewAvatar() : Avatar
{
return _avatar;
}
}
}
@@ -0,0 +1,21 @@
package avatar
{
import flash.events.Event;
public class AvatarEvent extends Event
{
public static const AVATAR_CHANGED:String = "OnAvatarChanged";
public function AvatarEvent(param1:String)
{
super(param1);
}
override public function clone() : Event
{
return new AvatarEvent(type);
}
}
}
@@ -0,0 +1,199 @@
package avatar
{
import localization.LocalizationManager;
import pet.PetManager;
public class AvatarInfo
{
public var perUserAvId:int;
public var uuid:String;
public var type:int;
public var colors:Array;
public var currEnviroType:int;
public var landPetInvId:int;
public var oceanPetInvId:int;
public var questXp:int;
public var questLevel:int;
public var questXPPercentage:int;
public var questHealthPercentage:int;
public var questTorchStatus:Boolean;
public var isDead:Boolean;
public var healthBase:int;
public var attackBase:int;
public var attackMax:int;
public var defenseBase:int;
public var defenseMax:int;
public var customAvId:int;
private var _userName:String;
private var _currPet:Object;
private var _avName:String;
public function AvatarInfo()
{
super();
}
public function init(param1:int = -1, param2:String = "", param3:String = "", param4:String = "", param5:int = -1, param6:Array = null, param7:int = 0, param8:Object = null, param9:int = -1, param10:int = 0, param11:int = 0, param12:int = 0, param13:int = 0, param14:int = 0, param15:int = 0, param16:int = 0, param17:int = 0, param18:int = 0, param19:int = 0, param20:int = 100, param21:Boolean = false) : void
{
this.isDead = false;
this.perUserAvId = param1;
this._avName = param2;
this._userName = param3;
this.uuid = param4;
this.type = param5;
this.colors = param6 == null ? [286331153,286331153,286331153] : param6;
this.currEnviroType = param7;
this.landPetInvId = param10;
this.oceanPetInvId = param11;
this.questXp = param12;
this.questLevel = param13;
this.questXPPercentage = param14;
this.questHealthPercentage = param20;
this.questTorchStatus = param21;
this.attackBase = param16;
this.attackMax = param17;
this.defenseBase = param19;
this.defenseMax = param18;
this.healthBase = param15;
this._currPet = param8;
this.customAvId = param9;
}
public function get currPet() : Object
{
if(this._userName.toLowerCase() == gMainFrame.userInfo.myUserName.toLowerCase())
{
return PetManager.myActivePet;
}
return this._currPet;
}
public function set currPet(param1:Object) : void
{
if(this._userName.toLowerCase() != gMainFrame.userInfo.myUserName.toLowerCase())
{
this._currPet = param1;
}
}
public function getItems(param1:Boolean = false) : Array
{
var _loc2_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(this._userName);
if(_loc2_)
{
return _loc2_.getPartialItemList(this.type,param1);
}
return null;
}
public function getFullItems(param1:Boolean = false) : Array
{
var _loc2_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(this._userName);
if(_loc2_)
{
return _loc2_.getFullItemList(param1);
}
return null;
}
public function set fullItemList(param1:Array) : void
{
var _loc2_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(this._userName);
if(_loc2_)
{
_loc2_.fullItemList = param1;
}
}
public function get denItems() : Array
{
var _loc1_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(this._userName);
if(_loc1_)
{
return _loc1_.denItemsFull;
}
return null;
}
public function get achievements() : Array
{
var _loc1_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(this._userName);
if(_loc1_)
{
return _loc1_.achievements;
}
return null;
}
public function set denItems(param1:Array) : void
{
var _loc2_:UserInfo = null;
if(param1)
{
_loc2_ = gMainFrame.userInfo.getUserInfoByUserName(this._userName);
if(_loc2_)
{
_loc2_.denItemsFull = param1;
}
}
}
public function get accountType() : int
{
var _loc1_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(this._userName);
if(_loc1_)
{
return _loc1_.accountType;
}
return SbiConstants.NON_MEMBER;
}
public function get isMember() : Boolean
{
return Utility.isMember(this.accountType);
}
public function get avName() : String
{
return LocalizationManager.translateAvatarName(this._avName);
}
public function set avName(param1:String) : void
{
this._avName = param1;
}
public function get userName() : String
{
return this._userName;
}
public function set userName(param1:String) : void
{
this._userName = param1;
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,31 @@
package avatar
{
import flash.utils.ByteArray;
import mx.core.MovieClipLoaderAsset;
[Embed(source="/_assets/assets.swf", symbol="symbol1")]
public class AvatarManager_Flower extends MovieClipLoaderAsset
{
private static var bytes:ByteArray = null;
public var dataClass:Class = AvatarManager_Flower_dataClass;
public function AvatarManager_Flower()
{
super();
initialWidth = 2840 / 20;
initialHeight = 2600 / 20;
}
override public function get movieClipData() : ByteArray
{
if(bytes == null)
{
bytes = ByteArray(new this.dataClass());
}
return bytes;
}
}
}
@@ -0,0 +1,31 @@
package avatar
{
import flash.utils.ByteArray;
import mx.core.MovieClipLoaderAsset;
[Embed(source="/_assets/assets.swf", symbol="symbol1")]
public class AvatarManager_FlowerIdle extends MovieClipLoaderAsset
{
private static var bytes:ByteArray = null;
public var dataClass:Class = AvatarManager_FlowerIdle_dataClass;
public function AvatarManager_FlowerIdle()
{
super();
initialWidth = 11000 / 20;
initialHeight = 8000 / 20;
}
override public function get movieClipData() : ByteArray
{
if(bytes == null)
{
bytes = ByteArray(new this.dataClass());
}
return bytes;
}
}
}
@@ -0,0 +1,15 @@
package avatar
{
import mx.core.ByteArrayAsset;
[Embed(source="/_assets/4_avatar.AvatarManager_FlowerIdle_dataClass.bin", mimeType="application/octet-stream")]
public class AvatarManager_FlowerIdle_dataClass extends ByteArrayAsset
{
public function AvatarManager_FlowerIdle_dataClass()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package avatar
{
import mx.core.ByteArrayAsset;
[Embed(source="/_assets/7_avatar.AvatarManager_Flower_dataClass.bin", mimeType="application/octet-stream")]
public class AvatarManager_Flower_dataClass extends ByteArrayAsset
{
public function AvatarManager_Flower_dataClass()
{
super();
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,350 @@
package avatar
{
import com.sbi.graphics.LayerAnim;
import flash.display.Sprite;
import flash.filters.ColorMatrixFilter;
import item.Item;
public class AvatarView extends Sprite
{
protected var _layerAnim:LayerAnim;
protected var _avatar:Avatar;
public var avTypeChangedCallback:Function;
private var _isOffScreen:Boolean;
private var _holdAnimId:int;
private var _lastAnimToHappen:int;
public function AvatarView()
{
super();
}
public function set lastAnimToHappen(param1:int) : void
{
this._lastAnimToHappen = param1;
}
public function get lastAnimToHappen() : int
{
return this._lastAnimToHappen;
}
public function set holdAnimId(param1:int) : void
{
this._holdAnimId = param1;
}
public function init(param1:Avatar, param2:Function = null) : void
{
this._holdAnimId = 0;
this._avatar = param1;
this._avatar.addEventListener(AvatarEvent.AVATAR_CHANGED,this.avatarChanged,false,0,true);
this.avTypeChangedCallback = param2;
this._layerAnim = LayerAnim.getNew();
this._layerAnim.avDefId = this._avatar.avTypeId;
if(this._avatar.colors)
{
this._layerAnim.layers = this.setLayerHelper();
}
this.addChild(this._layerAnim.bitmap);
}
public function destroy(param1:Boolean = false) : void
{
if(param1 && Boolean(this._avatar))
{
this._avatar.removeEventListener(AvatarEvent.AVATAR_CHANGED,this.avatarChanged);
this._avatar.destroy();
this._avatar = null;
}
this.avTypeChangedCallback = null;
LayerAnim.destroy(this._layerAnim);
this._layerAnim = null;
}
public function resetAvatar(param1:Avatar) : void
{
if(Boolean(this._avatar) && this._avatar.hasEventListener(AvatarEvent.AVATAR_CHANGED))
{
this._avatar.removeEventListener(AvatarEvent.AVATAR_CHANGED,this.avatarChanged);
}
this._avatar = param1;
this._avatar.addEventListener(AvatarEvent.AVATAR_CHANGED,this.avatarChanged,false,0,true);
if(this._layerAnim)
{
this._layerAnim.avDefId = this._avatar.avTypeId;
if(this._avatar.colors)
{
this._layerAnim.layers = this.setLayerHelper();
}
}
}
public function isValid() : Boolean
{
return this._layerAnim != null;
}
public function hideAvatar() : void
{
if(this._layerAnim != null)
{
this._layerAnim.visible = false;
}
}
public function showAvatar() : void
{
if(this._layerAnim != null)
{
this._layerAnim.visible = true;
}
}
public function set isOffScreen(param1:Boolean) : void
{
this._isOffScreen = param1;
}
public function get isOffScreen() : Boolean
{
return this._isOffScreen;
}
public function pauseAnim(param1:Boolean) : void
{
this._layerAnim.pause = param1;
}
public function advanceFrame() : void
{
++this._layerAnim.frame;
}
public function get frame() : int
{
return this._layerAnim.frame;
}
public function set frame(param1:int) : void
{
this._layerAnim.frame = param1;
}
public function get flip() : Boolean
{
return this._layerAnim.hFlip;
}
public function get animId() : int
{
return this._layerAnim.animId;
}
protected function avatarChanged(param1:AvatarEvent) : void
{
if(this._layerAnim)
{
if(this._layerAnim.avDefId != this._avatar.avTypeId)
{
this._layerAnim.avDefId = this._avatar.avTypeId;
if(this.avTypeChangedCallback != null)
{
this.avTypeChangedCallback(this);
}
}
this._layerAnim.layers = this.setLayerHelper();
}
}
protected function setLayerHelper() : Array
{
var _loc2_:AvatarInfo = null;
var _loc3_:Array = null;
var _loc1_:Array = null;
if(Boolean(this._avatar.inventoryBodyMod) && Boolean(this._avatar.inventoryBodyMod.itemArray) && this._avatar.inventoryBodyMod.itemArray.length >= 1)
{
_loc1_ = this._avatar.inventoryBodyMod.itemArray.concat(this._avatar.inventoryClothing.itemArray.concat());
}
else
{
_loc2_ = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(this._avatar.userName,this._avatar.perUserAvId);
if(_loc2_)
{
_loc3_ = _loc2_.getItems(true);
if(_loc3_)
{
_loc1_ = _loc3_;
}
}
}
return AvatarUtility.layerArrayForItemsAndColors(_loc1_,this._avatar.colors,this._avatar.perUserAvId);
}
public function playAnim(param1:int, param2:Boolean = false, param3:int = 0, param4:Function = null) : void
{
var _loc5_:Boolean = false;
var _loc6_:Array = null;
var _loc7_:int = 0;
var _loc8_:int = 0;
var _loc9_:Array = null;
var _loc10_:Array = null;
var _loc11_:Object = null;
var _loc12_:Array = null;
var _loc13_:uint = 0;
var _loc14_:Item = null;
if(Boolean(this._layerAnim) && Boolean(this._layerAnim.visible) && (this._holdAnimId == 0 || param1 == this._holdAnimId))
{
if(!this._isOffScreen)
{
_loc5_ = false;
_loc6_ = this._avatar.accShownItems;
if(!this._layerAnim.layers)
{
_loc5_ = true;
}
else if(this._layerAnim.layers.length != _loc6_.length)
{
_loc5_ = true;
}
else
{
_loc7_ = int(_loc6_.length);
_loc8_ = 0;
while(_loc8_ < _loc7_)
{
if(this._layerAnim.layers.indexOf(_loc6_[_loc8_].accId) == -1)
{
_loc5_ = true;
break;
}
_loc8_++;
}
}
if(_loc5_)
{
_loc9_ = [];
_loc10_ = _loc6_;
_loc12_ = this._avatar.colors;
for each(_loc14_ in _loc10_)
{
if(_loc14_.getInUse(this._avatar.perUserAvId))
{
if(_loc14_.layerId == 1)
{
_loc13_ = uint(_loc12_[0]);
}
else if(_loc14_.layerId == 2)
{
_loc13_ = uint(_loc12_[1]);
}
else if(_loc14_.layerId == 3)
{
_loc13_ = uint(_loc12_[2]);
}
else
{
_loc13_ = _loc14_.color;
}
_loc11_ = {
"l":_loc14_.accId,
"c":_loc13_
};
_loc9_.push(_loc11_);
}
}
this._layerAnim.layers = _loc9_;
}
this._layerAnim.hFlip = param2;
this._layerAnim.playAnim(param1,param3,param4);
}
else
{
this._lastAnimToHappen = param1;
}
}
}
public function reloadItemsFromCache() : void
{
var _loc1_:Array = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(this._avatar.userName,this._avatar.perUserAvId).getItems(true);
this._avatar.itemResponseIntegrate(_loc1_);
}
public function preloadAnims(param1:Array, param2:Function = null) : void
{
this._layerAnim.preload(param1,param2);
}
public function blackOut() : void
{
var _loc1_:Array = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0];
this._layerAnim.bitmap.filters = [new ColorMatrixFilter(_loc1_)];
}
public function get avatarData() : Avatar
{
return this._avatar;
}
public function get userName() : String
{
if(this._avatar != null)
{
return this._avatar.userName;
}
return null;
}
public function get userId() : int
{
if(this._avatar == null)
{
return -1;
}
return this._avatar.sfsUserId;
}
public function get avTypeId() : int
{
return this._avatar.avTypeId;
}
public function get customAvId() : int
{
return this._avatar.customAvId;
}
public function get perUserAvId() : int
{
return this._avatar.perUserAvId;
}
public function get inventoryBodyModItems() : Array
{
return this._avatar.inventoryBodyMod.itemArray;
}
public function get inventoryClothingItems() : Array
{
return this._avatar.inventoryClothing.itemArray;
}
public function setAvtColors(param1:Array) : void
{
this._avatar.colors = param1;
}
public function get avName() : String
{
return this._avatar.avName;
}
}
}
@@ -0,0 +1,212 @@
package avatar
{
import flash.display.Bitmap;
import flash.display.DisplayObject;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Shape;
import flash.display.Sprite;
import flash.geom.Matrix;
import flash.utils.ByteArray;
public class AvatarViewExt_Splash
{
private static const SHADOW_X_OFFSET:int = -100;
private static const SHADOW_Y_OFFSET:int = -20;
private static const Shadow:Class = AvatarViewExt_Splash_Shadow;
private static const WaterSplashSWF:Class = AvatarViewExt_Splash_WaterSplashSWF;
private const _constSplash:ByteArray = new WaterSplashSWF();
private var _mask:Shape;
private var _shadow:Bitmap;
private var _splash:Loader;
private var _parent:Sprite;
private var _maskLayer:DisplayObject;
private var _bLastSplashVolume:Boolean;
private var _bSplashInProgress:Boolean;
private var _lastSplashLiquid:String;
private var _shadowChildIndex:int;
public function AvatarViewExt_Splash(param1:Sprite, param2:DisplayObject)
{
super();
this._parent = param1;
this._bSplashInProgress = false;
this._bLastSplashVolume = false;
this.createShadow();
this.createMask(param2);
this._parent.addChild(param2);
this.createSplash();
}
public function destroy() : void
{
if(Boolean(this._shadow) && this._shadow.parent != null)
{
this._shadow.parent.removeChild(this._shadow);
this._shadow = null;
}
if(this._splash)
{
this._parent.removeChild(this._splash);
this._splash.unloadAndStop();
this._splash = null;
}
if(this._mask)
{
this._parent.removeChild(this._mask);
this._mask = null;
}
}
public function showShadow(param1:Boolean = true) : void
{
this._shadow.visible = param1;
}
private function createShadow() : void
{
this._shadow = new Shadow();
this._shadow.x = SHADOW_X_OFFSET;
this._shadow.y = SHADOW_Y_OFFSET;
this._parent.addChild(this._shadow);
}
private function createMask(param1:DisplayObject) : void
{
var _loc2_:Number = NaN;
var _loc3_:Number = NaN;
this._maskLayer = param1;
this._mask = new Shape();
this._parent.addChild(this._mask);
this._mask.graphics.lineStyle();
this._mask.graphics.beginFill(16777215,1);
_loc2_ = -150;
_loc3_ = -275;
this._mask.graphics.moveTo(_loc2_,_loc3_);
this._mask.graphics.lineTo(_loc2_ + 245,_loc3_);
this._mask.graphics.lineTo(_loc2_ + 245,_loc3_ + 235);
this._mask.graphics.curveTo(_loc2_ + 122.5,_loc3_ + 260,_loc2_,_loc3_ + 235);
this._mask.graphics.lineTo(_loc2_,_loc3_);
this._mask.graphics.endFill();
this._maskLayer.mask = null;
this._mask.visible = false;
}
private function createSplash() : void
{
this._splash = new Loader();
this._splash.loadBytes(this._constSplash);
this._splash.x = -18;
this._splash.y = -28;
this._parent.addChild(this._splash);
this._splash.visible = false;
}
public function flipSplash(param1:Boolean) : void
{
var _loc2_:Matrix = this._shadow.transform.matrix;
if(param1)
{
if(_loc2_.a != -1)
{
_loc2_.scale(-1,1);
this._shadow.transform.matrix = _loc2_;
_loc2_ = this._splash.content.transform.matrix;
_loc2_.scale(-1,1);
this._splash.content.transform.matrix = _loc2_;
}
}
else if(_loc2_.a == -1)
{
_loc2_.scale(-1,1);
this._shadow.transform.matrix = _loc2_;
_loc2_ = this._splash.content.transform.matrix;
_loc2_.scale(-1,1);
this._splash.content.transform.matrix = _loc2_;
}
}
public function heartbeat(param1:Boolean, param2:Boolean, param3:String, param4:Boolean) : void
{
if(this._shadow)
{
if(param4)
{
if(this._shadow.parent != null)
{
this._shadowChildIndex = this._shadow.parent.getChildIndex(this._shadow);
this._shadow.parent.removeChild(this._shadow);
}
}
else if(this._shadow.parent == null)
{
this._parent.addChildAt(this._shadow,this._shadowChildIndex);
}
}
var _loc5_:MovieClip = MovieClip(this._splash.content);
if(_loc5_)
{
if(param3 == "ice" || param3 == "fire" || param3 == "ghost")
{
param1 = false;
}
if(param1)
{
_loc5_.setState(param2 ? 1 : 2);
}
else if(_loc5_.currentFrame == 1 && this._splash.visible == true)
{
this._splash.visible = false;
}
if(param1 != this._bLastSplashVolume || param3 != this._lastSplashLiquid)
{
_loc5_.setLiquid(param3);
this._bLastSplashVolume = param1;
this._lastSplashLiquid = param3;
this.showMask(param1);
if(param1)
{
if(this._splash.visible == false)
{
this._splash.visible = true;
}
_loc5_.setState(param2 ? 1 : 2);
}
else
{
_loc5_.setState(0);
}
}
}
}
private function showMask(param1:Boolean = true) : void
{
if(param1)
{
this._maskLayer.mask = this._mask;
this.showShadow(false);
}
else
{
this._maskLayer.mask = null;
this.showShadow(true);
}
}
}
}
@@ -0,0 +1,15 @@
package avatar
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/3_avatar.AvatarViewExt_Splash_Shadow.png")]
public class AvatarViewExt_Splash_Shadow extends BitmapAsset
{
public function AvatarViewExt_Splash_Shadow()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package avatar
{
import mx.core.ByteArrayAsset;
[Embed(source="/_assets/6_avatar.AvatarViewExt_Splash_WaterSplashSWF.bin", mimeType="application/octet-stream")]
public class AvatarViewExt_Splash_WaterSplashSWF extends ByteArrayAsset
{
public function AvatarViewExt_Splash_WaterSplashSWF()
{
super();
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,889 @@
package avatar
{
import com.sbi.client.SFClient;
import com.sbi.client.SFEvent;
import com.sbi.debug.DebugUtility;
import com.sbi.loader.FileServerEvent;
import flash.geom.Point;
import flash.utils.Dictionary;
import gui.GuiManager;
import item.Item;
import item.ItemXtCommManager;
import loader.DefPacksDefHelper;
import pet.PetManager;
public class AvatarXtCommManager
{
public static var avSlotInfo:Object;
private static var _adAvatarQueue:Array;
private static var _agQueue:Dictionary;
private static var _agsQueue:Dictionary;
private static var _avatarCreateResponse:Function;
private static var _avatarUpdateResponse:Function;
private static var _avatarPaintResponse:Function;
private static var _avatarRemoveResponse:Function;
private static var _avatarListResponse:Function;
private static var _getAvatarByUsername:Function;
private static var _buddyCardUpdateDropDownHandler:Function;
private static var _avatarInfoCallback:Function;
private static var _abCallback:Function;
private static var _asCallback:Function;
private static var _aaCallback:Function;
private static var _alCallback:Function;
private static var _handleCreateAvatarData:Function;
private static var _akCallback:Function;
private static var _aoCallback:Function;
private static var _photoTakeCallback:Function;
private static var _afpCallback:Function;
private static var _avatarsInRoom:Object;
public function AvatarXtCommManager()
{
super();
}
public static function init(param1:Function = null, param2:Function = null, param3:Function = null, param4:Function = null, param5:Function = null, param6:Object = null, param7:Function = null, param8:Function = null, param9:Function = null) : void
{
_avatarCreateResponse = param1;
_avatarUpdateResponse = param2;
_avatarPaintResponse = param3;
_avatarRemoveResponse = param4;
_avatarListResponse = param5;
_getAvatarByUsername = param7;
_asCallback = param8;
_buddyCardUpdateDropDownHandler = param9;
_adAvatarQueue = [];
avSlotInfo = new Object();
_agQueue = new Dictionary(false);
_agsQueue = new Dictionary(false);
_avatarsInRoom = param6;
XtReplyDemuxer.addModule(handleXtReply,"a");
}
public static function destroy() : void
{
_adAvatarQueue = null;
XtReplyDemuxer.removeModule(handleXtReply);
}
public static function requestAvatarMake(param1:Function) : void
{
_handleCreateAvatarData = param1;
gMainFrame.server.setXtObject_Str("am",[],gMainFrame.server.isWorldZone);
}
public static function requestAvatarInfo(param1:Function) : void
{
var _loc2_:DefPacksDefHelper = null;
_avatarInfoCallback = param1;
if(gMainFrame.userInfo.avtDefsCached)
{
if(_avatarInfoCallback != null)
{
_avatarInfoCallback();
_avatarInfoCallback = null;
}
}
else
{
_loc2_ = new DefPacksDefHelper();
_loc2_.init(DefPacksDefHelper.DEF_AVATAR,avatarInfoResponse,null,FileServerEvent.AMF3_TYPE);
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_AVATAR] = _loc2_;
}
}
public static function requestADForAvatar(param1:int, param2:Boolean, param3:Function, param4:Avatar) : void
{
_adAvatarQueue.push({
"a":param4,
"c":(param2 ? null : param3)
});
var _loc5_:Boolean = gMainFrame.userInfo.myUserName.toLowerCase() == param4.userName.toLowerCase() ? ItemXtCommManager.hasRequestedFullItemList : true;
var _loc6_:AvatarInfo = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(param4.userName,param1);
if((Boolean(_loc6_)) && _loc6_.type != -1)
{
avatarDataResponseIntegrate([_loc6_.perUserAvId,_loc6_.avName,_loc6_.userName,_loc6_.uuid,_loc6_.type,_loc6_.customAvId,_loc6_.colors[0],_loc6_.colors[1],_loc6_.colors[2]]);
if(param2)
{
if(param4 == null)
{
throw new Error("requestAvatarData got requestItemList=true but getAvDataAvatar=null!");
}
if(param4.userName != gMainFrame.userInfo.myUserName)
{
ItemXtCommManager.requestItemListForAvatar(param3,param4,!_loc5_);
}
else
{
param3();
}
}
}
else
{
if(param2)
{
ItemXtCommManager.insertIntoILAvatarQueue(param1,param3,param4);
}
sendAvatarDataRequest([param4.userName,param1,param2 ? (_loc5_ ? "2" : "1") : "0"]);
}
}
public static function requestAvatarList(param1:Array, param2:Function = null) : void
{
_alCallback = param2;
gMainFrame.server.setXtObject_Str("al",param1,gMainFrame.server.isWorldZone);
}
public static function requestAvatarBuy(param1:Function) : void
{
_abCallback = param1;
gMainFrame.server.setXtObject_Str("ab",[]);
}
public static function requestAvatarSwitch(param1:Array) : void
{
gMainFrame.server.setXtObject_Str("as",param1);
}
public static function requestAvatarAdd(param1:Array, param2:Function) : void
{
_aaCallback = param2;
gMainFrame.server.setXtObject_Str("aa",param1,gMainFrame.server.isWorldZone);
}
public static function requestAvatarKill(param1:Array, param2:Function) : void
{
_akCallback = param2;
gMainFrame.server.setXtObject_Str("ak",param1);
}
public static function requestAvatarOrdain(param1:Array, param2:Function) : void
{
_aoCallback = param2;
gMainFrame.server.setXtObject_Str("ao",param1);
}
public static function requestAvatarGet(param1:String, param2:Function, param3:Boolean = false) : void
{
_agQueue[param1.toLowerCase()] = param2;
gMainFrame.server.setXtObject_Str("ag",[param1,param3 ? "1" : "0"]);
}
public static function requestAvatarGetBySfsId(param1:int, param2:Function) : void
{
_agsQueue[param1] = param2;
gMainFrame.server.setXtObject_Str("ags",[param1,"0"]);
}
public static function requestColorChange(param1:Array, param2:int, param3:Function = null) : void
{
if(param3 != null)
{
_avatarPaintResponse = param3;
}
gMainFrame.server.setXtObject_Str("ap",[param1[0],param1[1],param1[2],param2],gMainFrame.server.isWorldZone);
}
public static function sendAvatarPendingFlagsUpdate(param1:int) : void
{
gMainFrame.server.setXtObject_Str("af",[param1]);
gMainFrame.userInfo.pendingFlags |= 1 << param1;
}
public static function sendAvatarPhotoTakeCheck(param1:Function) : void
{
_photoTakeCallback = param1;
gMainFrame.server.setXtObject_Str("apc",[]);
}
public static function sendAvatarPhotoTake(param1:Function) : void
{
_photoTakeCallback = param1;
gMainFrame.server.setXtObject_Str("apb",[]);
}
public static function requestAvatarFastPassAdd(param1:Array, param2:Function) : void
{
_afpCallback = param2;
gMainFrame.server.setXtObject_Str("afp",param1,gMainFrame.server.isWorldZone);
}
private static function sendAvatarDataRequest(param1:Array) : void
{
gMainFrame.server.setXtObject_Str("ad",param1,gMainFrame.server.isWorldZone);
}
public static function handleXtReply(param1:SFEvent) : void
{
if(!param1.status)
{
DebugUtility.debugTrace("ERROR: AvatarXtCommManager handleXtReply was called with bad evt.status:" + param1.status);
return;
}
var _loc2_:Array = param1.obj;
switch(_loc2_[0])
{
case "au":
if(_avatarUpdateResponse != null)
{
_avatarUpdateResponse(_loc2_);
}
break;
case "ad":
avatarDataResponse(_loc2_);
break;
case "ac":
if(_avatarCreateResponse != null)
{
_avatarCreateResponse(_loc2_);
}
break;
case "ap":
if(_avatarPaintResponse != null)
{
_avatarPaintResponse(_loc2_);
}
break;
case "ag":
avatarGetResponse(_loc2_);
break;
case "ar":
if(_avatarRemoveResponse != null)
{
_avatarRemoveResponse(_loc2_);
}
break;
case "al":
avatarListResponse(_loc2_);
break;
case "ab":
avatarBuyResponse(_loc2_);
break;
case "as":
avatarSwitchResponse(_loc2_);
break;
case "aa":
avatarAddResponse(_loc2_);
break;
case "ak":
avatarKillResponse(_loc2_);
break;
case "am":
_handleCreateAvatarData(_loc2_);
break;
case "ao":
avatarOrdainResponse(_loc2_);
break;
case "apb":
case "apc":
if(_photoTakeCallback != null)
{
_photoTakeCallback(_loc2_);
_photoTakeCallback = null;
}
break;
case "afp":
avatarFastPassResponse(_loc2_);
break;
default:
throw new Error("AvatarXtCommManager illegal data:" + _loc2_[0]);
}
}
private static function avatarInfoResponse(param1:DefPacksDefHelper) : void
{
var _loc3_:int = 0;
var _loc6_:Object = null;
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_AVATAR] = null;
var _loc2_:Object = param1.def;
var _loc4_:Object = new Object();
var _loc5_:Array = [];
for each(_loc6_ in _loc2_)
{
_loc5_[int(_loc6_.id)] = new Point(_loc6_.x,_loc6_.y);
_loc4_[int(_loc6_.id)] = {
"colorLayer1":uint(_loc6_.colorLayer1),
"colorLayer2":uint(_loc6_.colorLayer2),
"colorLayer3":uint(_loc6_.colorLayer3),
"defPattern":int(_loc6_.basePatternId),
"defEyes":int(_loc6_.baseEyesId),
"isMemOnly":Boolean(_loc6_.membersOnly == "1"),
"enviroTypeFlag":int(_loc6_.enviroTypeFlags),
"cost":int(_loc6_.cost),
"titleStrRef":int(_loc6_.titleStrRef),
"availability":int(_loc6_.availability),
"attackItemRefId":int(_loc6_.attackItemRefId),
"iconMediaId":int(_loc6_.iconMediaRefId),
"status":int(_loc6_.status)
};
}
if(!gMainFrame.userInfo.avtDefsCached)
{
gMainFrame.setAvatarOffsets(_loc5_);
gMainFrame.userInfo.setAvatarDefs(_loc4_);
}
var _loc7_:DefPacksDefHelper = new DefPacksDefHelper();
_loc7_.init(DefPacksDefHelper.DEF_AVATAR_CUSTOM,customAvatarDefPacksResponse,null,FileServerEvent.AMF3_TYPE);
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_AVATAR_CUSTOM] = _loc7_;
}
private static function customAvatarDefPacksResponse(param1:DefPacksDefHelper) : void
{
var _loc3_:int = 0;
var _loc5_:Object = null;
var _loc6_:DefPacksDefHelper = null;
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_AVATAR_CUSTOM] = null;
var _loc2_:Object = param1.def;
var _loc4_:Object = new Object();
for each(_loc5_ in _loc2_)
{
if(_loc5_.avatarIconRefId != "0")
{
_loc4_[int(_loc5_.id)] = {
"id":int(_loc5_.id),
"avatarRefId":int(_loc5_.avatarRef),
"iconRefId":int(_loc5_.iconRefId),
"particleRefId":int(_loc5_.particleRefId),
"patternRefId":int(_loc5_.patternRefId),
"titleStrRef":int(_loc5_.titleStrRef),
"iconMediaId":int(_loc5_.avatarIconRefId)
};
}
}
gMainFrame.userInfo.setCustomAvatarDefs(_loc4_);
_loc6_ = new DefPacksDefHelper();
_loc6_.init(DefPacksDefHelper.DEF_LAYER,liDefPacksResponse,null,FileServerEvent.AMF3_TYPE);
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_LAYER] = _loc6_;
}
private static function liDefPacksResponse(param1:DefPacksDefHelper) : void
{
var _loc4_:Object = null;
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_LAYER] = null;
var _loc2_:Object = param1.def;
var _loc3_:Object = {};
for each(_loc4_ in _loc2_)
{
_loc3_[int(_loc4_.id)] = int(_loc4_.layerId);
}
gMainFrame.layerInfo = _loc3_;
if(_avatarInfoCallback != null)
{
_avatarInfoCallback();
_avatarInfoCallback = null;
}
}
private static function avatarDataResponse(param1:Array) : void
{
var _loc16_:Boolean = false;
var _loc22_:int = 0;
var _loc23_:int = 0;
var _loc24_:int = 0;
var _loc25_:int = 0;
var _loc26_:int = 0;
var _loc27_:int = 0;
var _loc28_:int = 0;
var _loc29_:int = 0;
var _loc32_:AvatarInfo = null;
var _loc34_:AvatarInfo = null;
var _loc35_:UserInfo = null;
var _loc36_:Array = null;
var _loc2_:* = 2;
var _loc3_:String = param1[_loc2_++];
var _loc4_:String = param1[_loc2_++];
var _loc5_:int = int(param1[_loc2_++]);
var _loc6_:int = int(param1[_loc2_++]);
var _loc7_:int = int(param1[_loc2_++]);
var _loc8_:int = int(param1[_loc2_++]);
var _loc9_:int = int(param1[_loc2_++]);
var _loc10_:int = int(param1[_loc2_++]);
var _loc11_:uint = uint(param1[_loc2_++]);
var _loc12_:uint = uint(param1[_loc2_++]);
var _loc13_:uint = uint(param1[_loc2_++]);
var _loc14_:String = param1[_loc2_++];
var _loc15_:int = int(param1[_loc2_++]);
var _loc17_:int = -1;
var _loc18_:int = 0;
var _loc19_:int = 0;
var _loc20_:int = 0;
var _loc21_:int = 0;
var _loc30_:String = "";
if(_loc3_.toLowerCase() == gMainFrame.userInfo.myUserName.toLowerCase())
{
_loc16_ = true;
_loc17_ = int(param1[_loc2_++]);
_loc18_ = int(param1[_loc2_++]);
_loc19_ = int(param1[_loc2_++]);
_loc22_ = int(param1[_loc2_++]);
_loc23_ = int(param1[_loc2_++]);
_loc24_ = int(param1[_loc2_++]);
_loc25_ = int(param1[_loc2_++]);
_loc26_ = int(param1[_loc2_++]);
}
else
{
_loc27_ = int(param1[_loc2_++]);
_loc28_ = int(param1[_loc2_++]);
_loc29_ = int(param1[_loc2_++]);
_loc30_ = param1[_loc2_++];
}
var _loc31_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(_loc3_);
if(_loc31_)
{
for each(_loc34_ in _loc31_.avList)
{
if(_loc34_.perUserAvId == _loc8_)
{
_loc32_ = _loc34_;
break;
}
}
_loc31_.uuid = _loc4_;
_loc31_.nameBarData = _loc5_;
_loc31_.userNameModeratedFlag = _loc7_;
}
var _loc33_:Object = {
"name":_loc30_,
"lBits":_loc27_,
"uBits":_loc28_,
"eBits":_loc29_
};
_loc33_.defId = PetManager.getDefIdFromLBits(_loc33_.lBits);
_loc33_.type = PetManager.petTypeForDefId(_loc33_.defId);
_loc33_.isGround = PetManager.isGround(_loc33_.type);
if(_loc32_)
{
_loc32_.avName = _loc14_;
_loc32_.userName = _loc3_;
_loc32_.uuid = _loc4_;
_loc32_.type = _loc9_;
_loc32_.colors = [_loc11_,_loc12_,_loc13_];
_loc32_.currEnviroType = _loc6_;
_loc32_.questLevel = _loc15_;
_loc32_.currPet = _loc33_;
_loc32_.customAvId = _loc10_;
if(_loc16_)
{
if(_loc17_ >= 0)
{
avSlotInfo[_loc32_.perUserAvId].avInvId = _loc17_;
}
_loc32_.landPetInvId = _loc18_;
_loc32_.oceanPetInvId = _loc19_;
_loc32_.questXp = _loc20_;
_loc32_.healthBase = _loc26_;
_loc32_.attackBase = _loc22_;
_loc32_.attackMax = _loc23_;
_loc32_.defenseBase = _loc24_;
_loc32_.defenseMax = _loc25_;
}
}
else
{
_loc32_ = new AvatarInfo();
_loc32_.init(_loc8_,_loc14_,_loc3_,_loc4_,_loc9_,[_loc11_,_loc12_,_loc13_],0,_loc33_,_loc10_);
_loc32_.questLevel = _loc15_;
if(_loc16_)
{
if(_loc17_ >= 0)
{
avSlotInfo[_loc32_.perUserAvId] = {
"slotId":-1,
"avInvId":_loc17_
};
}
_loc32_.landPetInvId = _loc18_;
_loc32_.oceanPetInvId = _loc19_;
_loc32_.questXp = _loc20_;
_loc32_.healthBase = _loc26_;
_loc32_.attackBase = _loc22_;
_loc32_.attackMax = _loc23_;
_loc32_.defenseBase = _loc24_;
_loc32_.defenseMax = _loc25_;
}
if(_loc31_)
{
_loc31_.addAvatarToList(_loc32_);
_loc31_.uuid = _loc4_;
_loc31_.nameBarData = _loc5_;
_loc31_.userNameModeratedFlag = _loc7_;
}
else
{
_loc35_ = new UserInfo();
_loc36_ = new Array();
_loc36_[_loc32_.perUserAvId] = _loc32_;
_loc35_.init(_loc3_,_loc4_,_loc36_,_loc32_.perUserAvId,1,_loc7_);
_loc35_.nameBarData = _loc5_;
gMainFrame.userInfo.setUserInfoByUserName(_loc3_,_loc35_);
}
}
avatarDataResponseIntegrate([_loc8_,_loc14_,_loc3_,_loc4_,_loc9_,_loc10_,_loc11_,_loc12_,_loc13_]);
}
private static function avatarDataResponseIntegrate(param1:Array) : void
{
var _loc4_:Boolean = false;
var _loc5_:int = 0;
var _loc6_:String = null;
var _loc7_:Avatar = null;
var _loc8_:* = 0;
var _loc2_:Avatar = null;
var _loc3_:Function = null;
if(Boolean(_adAvatarQueue) && _adAvatarQueue.length > 0)
{
_loc5_ = 0;
while(_loc5_ < _adAvatarQueue.length)
{
if(_adAvatarQueue[_loc5_].a.perUserAvId == param1[0])
{
_loc2_ = _adAvatarQueue[_loc5_].a;
_loc3_ = _adAvatarQueue[_loc5_].c;
_adAvatarQueue.splice(_loc5_,1);
break;
}
_loc5_++;
}
}
else if(_avatarsInRoom)
{
_loc6_ = param1[2];
if(_getAvatarByUsername != null)
{
_loc7_ = _getAvatarByUsername(_loc6_);
}
if(_loc7_)
{
_loc2_ = _loc7_;
_loc4_ = true;
}
}
if(_loc2_)
{
_loc8_ = 0;
_loc2_.perUserAvId = param1[_loc8_++];
_loc2_.avName = param1[_loc8_++];
_loc2_.userName = param1[_loc8_++];
_loc2_.uuid = param1[_loc8_++];
_loc2_.avTypeId = int(param1[_loc8_++]);
_loc2_.customAvId = int(param1[_loc8_++]);
_loc2_.setColors(uint(param1[_loc8_++]),uint(param1[_loc8_++]),uint(param1[_loc8_++]));
if(!_loc4_)
{
if(_loc3_ != null)
{
_loc3_(true);
_loc3_ = null;
}
}
_buddyCardUpdateDropDownHandler(_loc2_.userName);
}
else if(_loc3_ != null)
{
DebugUtility.debugTrace("calling loadDataAvatarResult even though dataAvatar was null...");
_loc3_(false);
_loc3_ = null;
}
}
private static function avatarGetResponse(param1:Array) : void
{
var _loc8_:int = 0;
var _loc9_:Boolean = false;
var _loc10_:int = 0;
var _loc11_:int = 0;
var _loc12_:int = 0;
var _loc13_:int = 0;
var _loc14_:Array = null;
var _loc15_:String = null;
var _loc16_:int = 0;
var _loc17_:int = 0;
var _loc18_:int = 0;
var _loc19_:int = 0;
var _loc20_:int = 0;
var _loc21_:int = 0;
var _loc22_:int = 0;
var _loc23_:int = 0;
var _loc24_:int = 0;
var _loc25_:String = null;
var _loc26_:int = 0;
var _loc27_:Array = null;
var _loc28_:* = 0;
var _loc29_:Object = null;
var _loc30_:UserInfo = null;
var _loc31_:AvatarInfo = null;
var _loc32_:Item = null;
var _loc33_:Array = null;
var _loc2_:* = 2;
var _loc3_:String = param1[_loc2_++];
var _loc4_:String = param1[_loc2_++];
var _loc5_:int = int(param1[_loc2_++]);
var _loc6_:int = _loc5_ == 0 ? SFClient.STATUS_OFFLINE_ACTIVE : (_loc5_ == 1 ? SFClient.STATUS_ONLINE : (_loc5_ == 2 ? SFClient.STATUS_OFFLINE_ARCHIVED : SFClient.STATUS_OFFLINE_UNKNOWN));
if(_loc5_ >= 2 && GuiManager.isVersionPopupOpen())
{
_loc5_ = SFClient.STATUS_OFFLINE_UNKNOWN;
_loc6_ = SFClient.STATUS_DIFFERENT_VERSION;
}
if(_loc5_ == 0 || _loc5_ == 1)
{
_loc8_ = int(param1[_loc2_++]);
_loc9_ = param1[_loc2_++] == "1";
_loc10_ = int(param1[_loc2_++]);
_loc11_ = int(param1[_loc2_++]);
_loc12_ = int(param1[_loc2_++]);
_loc13_ = int(param1[_loc2_++]);
_loc14_ = new Array(3);
_loc14_[0] = uint(param1[_loc2_++]);
_loc14_[1] = uint(param1[_loc2_++]);
_loc14_[2] = uint(param1[_loc2_++]);
_loc15_ = param1[_loc2_++];
_loc16_ = int(param1[_loc2_++]);
_loc17_ = int(param1[_loc2_++]);
_loc18_ = int(param1[_loc2_++]);
_loc19_ = int(param1[_loc2_++]);
_loc20_ = int(param1[_loc2_++]);
_loc21_ = int(param1[_loc2_++]);
_loc22_ = int(param1[_loc2_++]);
_loc23_ = int(param1[_loc2_++]);
_loc24_ = int(param1[_loc2_++]);
_loc25_ = param1[_loc2_++];
_loc26_ = _loc17_ > 0 ? 3 : 2;
_loc27_ = new Array(_loc19_ + _loc26_);
_loc28_ = 0;
var _loc34_:Number;
_loc27_[_loc34_ = _loc28_++] = ItemXtCommManager.getBodyModFromDefId(1,_loc10_,true);
var _loc35_:Number;
_loc27_[_loc35_ = _loc28_++] = ItemXtCommManager.getBodyModFromDefId(_loc16_,_loc10_,true);
if(_loc17_ > 0)
{
var _loc36_:Number;
_loc27_[_loc36_ = _loc28_++] = ItemXtCommManager.getBodyModFromDefId(_loc17_,_loc10_,true);
}
DebugUtility.debugTrace("avatarGetResponse userName:" + _loc3_ + " numClothingItems:" + _loc19_ + " numBodyModItems:" + _loc26_ + " pattDefId:" + _loc17_);
while(_loc28_ < _loc19_ + _loc26_)
{
_loc32_ = new Item();
_loc32_.init(int(param1[_loc2_++]),_loc28_,uint(param1[_loc2_++]));
_loc32_.setInUse(_loc10_,true);
_loc27_[_loc28_] = _loc32_;
_loc28_++;
}
_loc29_ = {
"name":_loc25_,
"lBits":_loc22_,
"uBits":_loc23_,
"eBits":_loc24_
};
_loc29_.defId = PetManager.getDefIdFromLBits(_loc29_.lBits);
_loc29_.type = PetManager.petTypeForDefId(_loc29_.defId);
_loc29_.isGround = PetManager.isGround(_loc29_.type);
_loc30_ = gMainFrame.userInfo.getUserInfoByUserName(_loc3_);
_loc31_ = new AvatarInfo();
_loc31_.init(_loc10_,_loc15_,_loc3_,_loc4_,_loc12_,_loc14_,0,_loc29_,_loc13_,0,0,0,_loc18_);
if(!_loc30_)
{
_loc33_ = new Array(1);
_loc33_[_loc10_] = _loc31_;
_loc30_ = new UserInfo();
_loc30_.init(_loc3_,_loc4_,_loc33_,_loc10_,_loc8_);
}
else
{
_loc30_.currPerUserAvId = _loc10_;
_loc30_.accountType = _loc8_;
_loc30_.addAvatarToList(_loc31_);
}
_loc30_.userNameModeratedFlag = _loc21_;
_loc30_.nameBarData = _loc11_;
_loc30_.isGuide = _loc9_;
gMainFrame.userInfo.setUserInfoByUserName(_loc3_,_loc30_);
}
var _loc7_:String = _loc3_.toLowerCase();
if(_agQueue[_loc7_])
{
_agQueue[_loc7_](_loc3_,_loc5_ < 3,_loc6_);
delete _agQueue[_loc7_];
}
if(_agsQueue[_loc20_])
{
_agsQueue[_loc20_](_loc3_,_loc5_ < 3,_loc6_,_loc20_);
delete _agsQueue[_loc20_];
}
}
private static function avatarListResponse(param1:Array) : void
{
var _loc5_:String = null;
var _loc6_:Boolean = false;
var _loc8_:String = null;
var _loc9_:int = 0;
var _loc10_:Array = null;
var _loc11_:int = 0;
var _loc12_:UserInfo = null;
var _loc13_:int = 0;
var _loc14_:UserInfo = null;
var _loc15_:int = 0;
var _loc16_:int = 0;
var _loc17_:String = null;
var _loc18_:AvatarInfo = null;
var _loc2_:* = 2;
var _loc3_:int = int(param1[_loc2_++]);
var _loc4_:uint = 0;
var _loc7_:int = 0;
while(_loc7_ < _loc3_)
{
_loc8_ = param1[_loc2_++];
if(_loc8_.toLowerCase() == gMainFrame.server.userName.toLowerCase())
{
_loc6_ = true;
_loc4_ = uint(param1[_loc2_++]);
_loc5_ = param1[_loc2_++];
}
_loc9_ = int(param1[_loc2_++]);
_loc10_ = [];
_loc12_ = gMainFrame.userInfo.getUserInfoByUserName(_loc8_);
_loc13_ = 0;
while(_loc13_ < _loc9_)
{
_loc15_ = int(param1[_loc2_++]);
if(_loc13_ == 0)
{
_loc11_ = _loc15_;
}
_loc16_ = int(param1[_loc2_++]);
_loc17_ = param1[_loc2_++];
if(_loc12_)
{
_loc18_ = _loc12_.getAvatarInfoByPerUserAvId(_loc15_);
if(!_loc18_)
{
_loc18_ = new AvatarInfo();
_loc18_.init(_loc15_,_loc17_,_loc8_);
}
_loc10_[_loc15_] = _loc18_;
}
else
{
_loc18_ = new AvatarInfo();
_loc18_.init(_loc15_,_loc17_,_loc8_);
_loc10_[_loc15_] = _loc18_;
}
if(_loc6_)
{
avSlotInfo[_loc15_] = {
"slotId":_loc13_,
"avInvId":_loc16_
};
}
_loc13_++;
}
_loc14_ = new UserInfo();
if(_loc12_)
{
_loc12_.avList = _loc10_;
_loc12_.currPerUserAvId = _loc11_;
_loc12_.uuid = _loc5_;
_loc14_ = _loc12_;
}
else
{
_loc14_.init(_loc8_,_loc5_,_loc10_,_loc11_);
}
gMainFrame.userInfo.setUserInfoByUserName(_loc8_,_loc14_);
_loc7_++;
}
if(_loc8_ != gMainFrame.server.userName)
{
if(_avatarListResponse != null)
{
_avatarListResponse();
}
}
if(_alCallback != null)
{
if(_loc6_)
{
_alCallback(_loc4_);
}
else
{
_alCallback(_loc3_ == -1);
}
_alCallback = null;
}
}
private static function avatarBuyResponse(param1:Array) : void
{
if(_abCallback != null)
{
_abCallback(Boolean(int(param1[2])));
}
}
private static function avatarSwitchResponse(param1:Array) : void
{
if(_asCallback != null)
{
_asCallback(param1);
}
}
private static function avatarAddResponse(param1:Array) : void
{
if(_aaCallback != null)
{
_aaCallback(int(param1[2]),int(param1[3]),int(param1[4]));
}
}
private static function avatarKillResponse(param1:Array) : void
{
if(_akCallback != null)
{
_akCallback(Boolean(int(param1[2])),int(param1[3]));
}
}
private static function avatarOrdainResponse(param1:Array) : void
{
if(_aoCallback != null)
{
_aoCallback(Boolean(int(param1[2])));
}
}
private static function avatarFastPassResponse(param1:Array) : void
{
if(_afpCallback != null)
{
_afpCallback(Boolean(int(param1[2])));
}
}
}
}
@@ -0,0 +1,21 @@
package avatar
{
import flash.display.MovieClip;
public interface INewAvatar
{
function screenInitCallback(param1:MovieClip) : void;
function get playSound() : Boolean;
function newAvatarData(param1:int, param2:String, param3:Array, param4:Function, param5:int = -1, param6:int = -1, param7:Boolean = false) : void;
function hideConnectingMsg() : void;
function logInForCreateAvatarData() : void;
function nameTypeScreenDone() : void;
}
}
@@ -0,0 +1,878 @@
package avatar
{
import com.sbi.graphics.LayerAnim;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.filters.GlowFilter;
import flash.geom.Point;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import gskinner.motion.GTween;
import gskinner.motion.easing.Linear;
import item.Item;
import item.ItemXtCommManager;
import loader.MediaHelper;
import localization.LocalizationManager;
import quest.QuestManager;
import room.RoomManagerWorld;
public class NPCView extends Sprite
{
public static const NPC_STATE_LOADING:int = -2;
public static const NPC_STATE_LOADED:int = -1;
public static const NPC_STATE_IDLE:int = 0;
public static const NPC_STATE_MOVE:int = 1;
public static const NPC_STATE_ATTACK:int = 2;
public static const NPC_STATE_RECOIL:int = 3;
public static const NPC_STATE_DEATH:int = 4;
public static const NPC_STATE_TREASURE_APPEAR:int = 5;
public static const NPC_STATE_TREASURE_OPEN:int = 6;
public static const NPC_STATE_TREASURE_DISAPPEAR:int = 7;
public static const NPC_STATE_DANCE:int = 8;
private var _npcDef:Object;
private var _npcMC:MovieClip;
private var _npcAvatarView:AvatarWorldView;
private var _playerId:int;
private var _namebar:NameBar;
private var _mediaHelperObj:MediaHelper;
private var _onLoadingCompleteCallback:Function;
private var _npcState:int;
private var _npcAngle:int;
private var _healthBar:MovieClip;
private var _hitText:TextField;
private var _hitTextTween:GTween;
private var _secondaryNpcMC:MovieClip;
public var _eye:MovieClip;
public var _beam:MovieClip;
public var _npcFacingSW:Boolean;
public function NPCView()
{
super();
}
public function get npcState() : int
{
return this._npcState;
}
public function get npcStateComplete() : Boolean
{
switch(this._npcState)
{
case NPC_STATE_LOADING:
return false;
case NPC_STATE_LOADED:
return true;
case NPC_STATE_TREASURE_APPEAR:
case NPC_STATE_TREASURE_OPEN:
case NPC_STATE_TREASURE_DISAPPEAR:
return this._npcMC == null || Boolean(this._npcMC.finished);
default:
throw new Error("NPVView: npcStateComplete: Unsupported state");
}
}
public function get readyToLaunchAttack() : Boolean
{
if(this._npcState == NPC_STATE_ATTACK)
{
if(this._npcMC != null)
{
if(this._npcMC.attacking == true)
{
this._npcMC.attacking = false;
return true;
}
if(this._npcMC.hasOwnProperty("counterAttacking") && this._npcMC.counterAttacking == true)
{
this._npcMC.counterAttacking = false;
return true;
}
}
return false;
}
return true;
}
public function get readyToAttack() : Boolean
{
var _loc1_:Array = null;
var _loc2_:int = 0;
var _loc3_:Object = null;
if(this._npcMC != null && this._npcMC.hasOwnProperty("getCustomCollisionPoints"))
{
_loc1_ = this._npcMC.getCustomCollisionPoints();
if(_loc1_ != null)
{
_loc2_ = 0;
while(_loc2_ < _loc1_.length)
{
_loc3_ = _loc1_[_loc2_];
if(_loc3_.Type == 2)
{
return !this._npcMC.animActive && Boolean(this._npcMC.readyForAttack);
}
_loc2_++;
}
}
}
if(this._npcState != NPC_STATE_ATTACK && this._npcState != NPC_STATE_DEATH)
{
return true;
}
return false;
}
public function get isDead() : Boolean
{
if(this._npcState == NPC_STATE_DEATH && (this._npcMC == null || this._npcMC.animActive == false))
{
return true;
}
return false;
}
public function get isDying() : Boolean
{
return this._npcState == NPC_STATE_DEATH;
}
public function moveFaceAnim(param1:Number) : void
{
var _loc2_:int = 0;
var _loc3_:Boolean = false;
if(this._npcAvatarView)
{
_loc2_ = 0;
_loc3_ = false;
while(param1 < 0)
{
param1 += 360;
}
while(param1 >= 360)
{
param1 -= 360;
}
if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_LAND)
{
if(param1 < 180)
{
if(param1 < 35)
{
_loc2_ = LayerAnim.AN_MOVE_NNE;
}
else if(param1 < 70)
{
_loc2_ = LayerAnim.AN_MOVE_NE;
}
else if(param1 < 110)
{
_loc2_ = LayerAnim.AN_MOVE_E;
}
else if(param1 < 145)
{
_loc2_ = LayerAnim.AN_MOVE_SE;
}
else
{
_loc2_ = LayerAnim.AN_MOVE_SSE;
}
}
else
{
_loc3_ = true;
if(param1 < 215)
{
_loc2_ = LayerAnim.AN_MOVE_SSE;
}
else if(param1 < 250)
{
_loc2_ = LayerAnim.AN_MOVE_SE;
}
else if(param1 < 290)
{
_loc2_ = LayerAnim.AN_MOVE_E;
}
else if(param1 < 325)
{
_loc2_ = LayerAnim.AN_MOVE_NE;
}
else
{
_loc2_ = LayerAnim.AN_MOVE_NNE;
}
}
}
else if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
if(param1 < 180)
{
_loc2_ = LayerAnim.AN_SWIM_E;
}
else
{
_loc3_ = true;
_loc2_ = LayerAnim.AN_SWIM_E;
}
}
this._npcAvatarView.playAnim(_loc2_,_loc3_,LayerAnim.PLAY_LOOP__KEEP_CURRENT_FRAME);
}
}
public function setNpcState(param1:int, param2:Number = 0) : void
{
if(this._npcState != NPC_STATE_DEATH)
{
switch(param1)
{
case NPC_STATE_TREASURE_APPEAR:
if(this._npcMC)
{
this._npcMC.appear();
this._npcState = param1;
}
break;
case NPC_STATE_TREASURE_OPEN:
if(this._npcMC)
{
this._npcMC.openChest();
this._npcState = param1;
}
break;
case NPC_STATE_TREASURE_DISAPPEAR:
if(this._npcMC)
{
this._npcMC.disappear();
this._npcState = param1;
}
break;
case NPC_STATE_DEATH:
if(this._npcMC)
{
this._npcState = param1;
this._npcMC.noHealth();
}
break;
case NPC_STATE_IDLE:
if(this._npcMC)
{
if(this._npcMC.animActive == false)
{
this._npcState = param1;
this._npcMC.idle(270);
}
if(this._npcMC.hasOwnProperty("getSortHeight"))
{
if(this._npcMC.parent.parent)
{
this._npcMC.parent.parent.name = this._npcMC.getSortHeight();
}
}
}
else if(this._npcAvatarView)
{
if(this._npcState != param1)
{
if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_LAND)
{
this.playAnimationState(LayerAnim.AN_IDLE_SE,false,LayerAnim.PLAY_LOOP,null);
}
else if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this.playAnimationState(LayerAnim.AN_FLOAT,false,LayerAnim.PLAY_LOOP,null);
}
this._npcState = param1;
}
}
break;
case NPC_STATE_MOVE:
if(this._npcAvatarView != null)
{
this._npcState = param1;
if(this._npcAngle != param2)
{
this._npcAngle = param2;
this.moveFaceAnim(this._npcAngle);
}
}
else if(this._npcMC != null)
{
this._npcAngle = param2;
if(this._npcMC.animActive == false)
{
this._npcState = param1;
this._npcMC.moveCycle(this._npcAngle);
}
}
break;
case NPC_STATE_ATTACK:
if(this._npcMC != null)
{
this._npcState = param1;
this._npcAngle = param2;
this._npcMC.attack(this._npcAngle);
}
break;
case NPC_STATE_RECOIL:
if(this._npcMC != null)
{
if(this._npcState != NPC_STATE_RECOIL || this._npcMC.hasOwnProperty("animActive") == false || this._npcMC.animActive == false)
{
if(this._npcState == NPC_STATE_IDLE || this._npcState == NPC_STATE_MOVE)
{
this._npcState = param1;
}
this._npcMC.recoil(this._npcAngle);
}
}
break;
case NPC_STATE_DANCE:
if(this._npcAvatarView != null)
{
this._npcState = param1;
if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_LAND)
{
this.playAnimationState(LayerAnim.AN_DANCE,false,LayerAnim.PLAY_LOOP,null);
}
else if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this.playAnimationState(LayerAnim.AN_WATER_JIG,false,LayerAnim.PLAY_LOOP,null);
}
}
}
}
}
public function get collisionZapRadius() : Number
{
if(this._npcMC != null)
{
return this._npcMC.getCollisionRadius(0);
}
return 20;
}
public function get collisionRadiusMoving() : Number
{
if(this._npcMC != null)
{
if("getCollisionRadius" in this._npcMC)
{
return this._npcMC.getCollisionRadius(1);
}
}
return 20;
}
public function get collisionRadiusAttack() : Number
{
if(this._npcMC != null)
{
if("getCollisionRadius" in this._npcMC)
{
return this._npcMC.getCollisionRadius(2);
}
}
return 20;
}
public function get collisionMovingPoint() : Point
{
if(this._npcMC != null)
{
if("getCollisionPoint" in this._npcMC)
{
return this._npcMC.getCollisionPoint(1);
}
}
return new Point(0,0);
}
public function get collisionZapPoint() : Point
{
if(this._npcMC != null)
{
if("getCollisionPoint" in this._npcMC)
{
return this._npcMC.getCollisionPoint(2);
}
}
return new Point(0,0);
}
public function get collisionPointAttack() : Point
{
if(this._npcMC != null)
{
if("getCollisionPoint" in this._npcMC)
{
return this._npcMC.getCollisionPoint(0);
}
}
return new Point(0,0);
}
public function get avatar() : Avatar
{
if(this._npcAvatarView != null)
{
return this._npcAvatarView.avatarData;
}
return null;
}
public function get talkingHeadMediaId() : int
{
if(this._npcDef != null)
{
return this._npcDef.headMediaRefId;
}
return 0;
}
public function reset() : void
{
this._npcState = NPC_STATE_LOADING;
}
public function init(param1:int, param2:int, param3:int = -1, param4:int = 0, param5:Boolean = false, param6:Function = null) : void
{
var _loc7_:Avatar = null;
var _loc8_:Array = null;
var _loc9_:int = 0;
var _loc10_:Item = null;
var _loc11_:* = 0;
var _loc12_:Array = null;
var _loc13_:Array = null;
var _loc14_:String = null;
this._npcFacingSW = false;
this._npcState = NPC_STATE_LOADING;
this._npcAngle = 0;
this._npcDef = QuestManager.getNPCDef(param1);
this._playerId = param2;
this._onLoadingCompleteCallback = param6;
this._hitText = new TextField();
this._hitText.selectable = false;
this._hitText.multiline = false;
this._hitText.autoSize = TextFieldAutoSize.CENTER;
this._hitText.visible = false;
this._hitText.embedFonts = true;
this._hitText.defaultTextFormat = new TextFormat("TikiIsland-Regular",36,4286945);
this._hitText.filters = [new GlowFilter(0,1,3,3,10,2)];
switch(this._npcDef.type)
{
case 0:
this._mediaHelperObj = new MediaHelper();
this._mediaHelperObj.init(this._npcDef.mediaRefId,this.onMediaLoaded);
break;
case 1:
_loc7_ = new Avatar();
_loc7_.avName = "";
_loc7_.userName = "";
_loc7_.isShaman = param4 == 32;
this._npcAvatarView = new AvatarWorldView();
this._npcAvatarView.initWorldView(_loc7_,QuestManager._layerManager.room_chat,SbiConstants.NON_MEMBER,true);
_loc7_.init(-1,_loc7_.avName,this._npcDef.avatarRefId,[this._npcDef.baseColor,this._npcDef.patternColor,this._npcDef.eyesColor]);
_loc7_.itemResponseIntegrate(ItemXtCommManager.generateBodyModList(this._npcDef.avatarRefId,this._npcDef.patternItemRefId,this._npcDef.eyesItemRefId,false));
if(param3 > 0)
{
if(this._npcAvatarView != null && this._npcAvatarView.avatarData != null)
{
_loc14_ = LocalizationManager.translateIdOnly(param3);
this._npcAvatarView.avatarData.avName = _loc14_;
this._npcAvatarView.avatarData.userName = _loc14_;
if(this._npcAvatarView.nameBar != null)
{
this._npcAvatarView.nameBar.setAvName(_loc14_);
this._npcAvatarView.nameBar.visible = true;
}
}
}
_loc8_ = new Array();
_loc11_ = 100;
_loc9_ = 0;
while(_loc9_ < this._npcAvatarView.avatarData.inventoryBodyMod.itemArray.length)
{
_loc8_.push(this._npcAvatarView.avatarData.inventoryBodyMod.itemArray[_loc9_]);
_loc9_++;
}
if(this._npcDef.backItemRefId != 0)
{
_loc10_ = new Item();
_loc12_ = ItemXtCommManager.getItemDef(this._npcDef.backItemRefId).colors;
_loc10_.init(this._npcDef.backItemRefId,_loc11_++,_loc12_[Math.min(this._npcDef.backColor,_loc12_.length - 1)],-1,-1);
_loc8_.push(_loc10_);
}
if(this._npcDef.headItemRefId != 0)
{
_loc10_ = new Item();
_loc12_ = ItemXtCommManager.getItemDef(this._npcDef.headItemRefId).colors;
_loc10_.init(this._npcDef.headItemRefId,_loc11_++,_loc12_[Math.min(this._npcDef.headColor,_loc12_.length - 1)],-1,-1);
_loc8_.push(_loc10_);
}
if(this._npcDef.legItemRefId != 0)
{
_loc10_ = new Item();
_loc12_ = ItemXtCommManager.getItemDef(this._npcDef.legItemRefId).colors;
_loc10_.init(this._npcDef.legItemRefId,_loc11_++,_loc12_[Math.min(this._npcDef.legColor,_loc12_.length - 1)],-1,-1);
_loc8_.push(_loc10_);
}
if(this._npcDef.neckItemRefId != 0)
{
_loc10_ = new Item();
_loc12_ = ItemXtCommManager.getItemDef(this._npcDef.neckItemRefId).colors;
_loc10_.init(this._npcDef.neckItemRefId,_loc11_++,_loc12_[Math.min(this._npcDef.neckColor,_loc12_.length - 1)],-1,-1);
_loc8_.push(_loc10_);
}
if(this._npcDef.tailItemRefId != 0)
{
_loc10_ = new Item();
_loc12_ = ItemXtCommManager.getItemDef(this._npcDef.tailItemRefId).colors;
_loc10_.init(this._npcDef.tailItemRefId,_loc11_++,_loc12_[Math.min(this._npcDef.tailColor,_loc12_.length - 1)],-1,-1);
_loc8_.push(_loc10_);
}
this._npcAvatarView.avatarData.itemResponseIntegrate(_loc8_);
_loc13_ = new Array(15);
this.redrawCallback(null);
}
if(param5)
{
this._healthBar = GETDEFINITIONBYNAME("NPCHealth");
this._healthBar.x = -this._healthBar.width * 0.5;
this._healthBar.y = 18;
this._healthBar.hpBar.width = this._healthBar.hpEnemyBarContainer.width;
addChild(this._healthBar);
}
}
public function destroy() : void
{
if(this._mediaHelperObj)
{
this._mediaHelperObj.destroy();
this._mediaHelperObj = null;
}
if(this._npcMC)
{
if(this._npcMC.hasOwnProperty("destroyPhantomNPC"))
{
this._npcMC.destroyPhantomNPC();
}
if(this._npcMC.parent != null)
{
this._npcMC.parent.removeChild(this._npcMC);
}
}
if(Boolean(this._secondaryNpcMC) && Boolean(this._secondaryNpcMC.parent != null) && this._secondaryNpcMC.parent is MovieClip)
{
this._secondaryNpcMC.parent.removeChild(this._secondaryNpcMC);
}
if(this._namebar)
{
this._namebar.destroy();
this._namebar = null;
}
if(this._healthBar)
{
this._healthBar = null;
}
if(this._npcAvatarView)
{
if(this._npcAvatarView.parent != null)
{
this._npcAvatarView.parent.removeChild(this._npcAvatarView);
}
this._npcAvatarView.destroy(true);
}
this._hitTextTween = null;
}
public function updateHealthBar(param1:int, param2:int, param3:Boolean, param4:Boolean) : void
{
var _loc5_:String = null;
if(this._healthBar)
{
if(param1 == 0)
{
this._healthBar.visible = false;
}
else
{
this._healthBar.hpBar.width = this._healthBar.hpEnemyBarContainer.width * (param1 / 100);
}
}
if(param4)
{
if(param2 > 0 && Boolean(this._npcMC))
{
if(param3)
{
_loc5_ = "Fierce!\n" + Math.abs(param2) * -1;
}
else
{
_loc5_ = String(Math.abs(param2) * -1);
}
this.playHitText(_loc5_);
}
}
}
public function playHitText(param1:String) : void
{
var attachmentPoint:Point = null;
var hitString:String = param1;
this._hitText.visible = true;
this._hitText.alpha = 2;
this._hitText.text = hitString;
try
{
attachmentPoint = this._npcMC.getAttachmentPoint();
this._hitText.x = attachmentPoint.x + this.x - this._hitText.textWidth * 0.5;
this._hitText.y = attachmentPoint.y + this.y;
}
catch(e:Error)
{
_hitText.x = this.x - _hitText.textWidth * 0.5;
_hitText.y = this.y - _hitText.textHeight;
}
if(parent != null)
{
this._hitText.x += parent.x;
this._hitText.y += parent.y;
}
if(this._hitTextTween)
{
this._hitTextTween.resetValues({
"y":this._hitText.y - 90,
"alpha":0
});
this._hitTextTween.beginning();
this._hitTextTween.paused = false;
}
else
{
this._hitTextTween = new GTween(this._hitText,1,{
"y":this._hitText.y - 90,
"alpha":0
},{"ease":Linear.easeNone});
}
}
public function playAnimationState(param1:int, param2:Boolean, param3:int, param4:Function) : void
{
if(this._npcAvatarView)
{
this._npcAvatarView.playAnim(param1,param2,param3,param4);
}
}
public function get npcMC() : MovieClip
{
return this._npcMC;
}
public function get defId() : int
{
return this._npcDef.defId;
}
public function get npcDef() : Object
{
return this._npcDef;
}
public function get secondaryNpcMC() : MovieClip
{
return this._secondaryNpcMC;
}
private function onMediaLoaded(param1:MovieClip) : void
{
this._npcMC = param1;
addChild(this._npcMC);
if(this._npcMC.hasOwnProperty("eye"))
{
this._eye = this._npcMC.eye;
}
if(this._npcDef.headMediaRefId != 0)
{
this._mediaHelperObj = new MediaHelper();
this._mediaHelperObj.init(this._npcDef.headMediaRefId,this.secondaryNPCLoaded);
}
else
{
this.loadingComplete();
}
}
private function secondaryNPCLoaded(param1:MovieClip) : void
{
if(param1.getChildAt(0) is MovieClip)
{
this._secondaryNpcMC = MovieClip(param1.getChildAt(0));
}
else
{
this._secondaryNpcMC = param1;
}
this._mediaHelperObj.destroy();
this._mediaHelperObj = null;
this.loadingComplete();
}
private function redrawCallback(param1:LayerAnim) : void
{
if(this._npcAvatarView)
{
if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_LAND)
{
this.playAnimationState(LayerAnim.AN_IDLE_SE,false,LayerAnim.PLAY_LOOP,null);
}
else if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this.playAnimationState(LayerAnim.AN_FLOAT,false,LayerAnim.AN_FLOAT,null);
}
addChild(this._npcAvatarView);
this.loadingComplete();
}
}
private function loadingComplete() : void
{
this._npcState = NPC_STATE_LOADED;
if(this._npcMC != null && this._npcMC.hasOwnProperty("setInit"))
{
this._npcMC.setInit(QuestManager._questDifficultyLevel);
if(this._npcMC.hasOwnProperty("watcher"))
{
this._beam = this._npcMC.watcher;
}
}
QuestManager._layerManager.room_chat.addChild(this._hitText);
if(this._onLoadingCompleteCallback != null)
{
this._onLoadingCompleteCallback();
}
}
public function setSwfState(param1:String) : Number
{
if(this._npcMC != null)
{
if(param1 == "facesw_k")
{
param1 = "facesw";
}
else if(param1 == "facese_k")
{
param1 = "facese";
}
return this._npcMC.setStateByScript(param1);
}
if(this._npcAvatarView != null)
{
if(param1 == "dance")
{
if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_LAND)
{
this.playAnimationState(LayerAnim.AN_DANCE,this._npcFacingSW,LayerAnim.PLAY_LOOP,null);
}
else if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this.playAnimationState(LayerAnim.AN_WATER_JIG,this._npcFacingSW,LayerAnim.PLAY_LOOP,null);
}
}
else if(param1 == "hop")
{
if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_LAND)
{
this.playAnimationState(LayerAnim.AN_HOP,this._npcFacingSW,LayerAnim.PLAY_LOOP,null);
}
else if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this.playAnimationState(LayerAnim.AN_WATER_DIVE,this._npcFacingSW,LayerAnim.PLAY_LOOP,null);
}
}
else if(param1 == "spin")
{
if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this.playAnimationState(LayerAnim.AN_WATER_SPIN,this._npcFacingSW,LayerAnim.PLAY_LOOP,null);
}
}
else if(param1 == "idle" || param1 == "facese")
{
this._npcFacingSW = false;
if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_LAND)
{
this.playAnimationState(LayerAnim.AN_IDLE_SE,false,LayerAnim.PLAY_LOOP,null);
}
else if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this.playAnimationState(LayerAnim.AN_FLOAT,false,LayerAnim.PLAY_LOOP,null);
}
}
else if(param1 == "facesw")
{
this._npcFacingSW = true;
if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_LAND)
{
this.playAnimationState(LayerAnim.AN_IDLE_SE,true,LayerAnim.PLAY_LOOP,null);
}
else if(RoomManagerWorld.instance.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this.playAnimationState(LayerAnim.AN_FLOAT,true,LayerAnim.PLAY_LOOP,null);
}
}
else if(param1 == "facesw_k")
{
if(this._npcFacingSW == false && Boolean(this._npcAvatarView))
{
this._npcFacingSW = true;
this.playAnimationState(this._npcAvatarView.animId,true,LayerAnim.PLAY_LOOP,null);
}
}
else if(param1 == "facese_k")
{
if(this._npcFacingSW == true && Boolean(this._npcAvatarView))
{
this._npcFacingSW = false;
this.playAnimationState(this._npcAvatarView.animId,false,LayerAnim.PLAY_LOOP,null);
}
}
}
return 0;
}
}
}
@@ -0,0 +1,743 @@
package avatar
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import loader.MediaHelper;
public class NameBar extends MovieClip
{
private static var _getNamebarIconsFunc:Function;
public static var NON_BUDDY:String = "nonBuddy";
public static var BUDDY:String = "buddy";
public static var GUIDE:String = "guide";
public static const LEVEL_SHAPES:Array = new Array(1851,1858,1853,1857);
public static const MAX_COLORS:int = 10;
private static var BADGE_ID_VIP_CAMERA:int = 31;
private var _iconIdsArray:Array;
private var _isBlocked:Boolean;
private var _nubType:String;
private var _left:MovieClip;
private var _mid:MovieClip;
private var _right:MovieClip;
private var _avName:MovieClip;
private var _meter:MovieClip;
private var _shape:MovieClip;
private var _iconsMediaHelperArray:Array;
private var _iconImages:Array;
private var _nubDataArray:Array;
private var _nameBarDataToBeLoaded:int;
private var _currframeName:String;
private var _packedNameBarData:int;
private var _badgeId:int;
private var _levelShapeHelper:MediaHelper;
private var _shapesMediaHelperArray:Array;
private var _currShapeMouse:MovieClip;
private var _currShapeUp:MovieClip;
private var _isMember:Boolean;
public function NameBar(param1:String = "nonBuddy", param2:Boolean = false)
{
super();
if(this["e"].currentFrameLabel)
{
this._left = this["e"][String(this["e"].currentFrameLabel)];
}
else
{
this._left = this["e"];
}
if(this["n"].currentFrameLabel)
{
this._mid = this["n"][String(this["n"].currentFrameLabel)];
}
else
{
this._mid = this["n"];
}
if(this["meter"] != null)
{
if(this["meter"].currentFrameLabel)
{
this._meter = this["meter"][String(this["meter"].currentFrameLabel)];
}
else
{
this._meter = this["meter"];
}
}
if(this["shape"] != null)
{
if(this["shape"].currentFrameLabel)
{
this._shape = this["shape"][String(this["shape"].currentFrameLabel)];
}
else
{
this._shape = this["shape"];
}
}
this._right = this["selnub"];
this._avName = this["c"];
if(!(Boolean(this._left) && Boolean(this._mid) && Boolean(this._right) && Boolean(this._avName) && this._avName.txt))
{
throw new Error("NameBar is missing parts or parts are named improperly!");
}
this._currframeName = "black";
this.isBlocked = param2;
this.nubType = param1;
this._iconsMediaHelperArray = [];
this._shapesMediaHelperArray = [];
this._iconImages = [];
this._nubDataArray = [];
if(_getNamebarIconsFunc != null)
{
this._iconIdsArray = _getNamebarIconsFunc();
}
if(!this._iconIdsArray)
{
this._iconIdsArray = [];
}
this._nameBarDataToBeLoaded = -1;
this.cacheAsBitmap = true;
addEventListener(MouseEvent.ROLL_OVER,this.onOverHandler,false,0,true);
addEventListener(MouseEvent.ROLL_OUT,this.onOutHandler,false,0,true);
}
public static function set getNamebarIconsFunc(param1:Function) : void
{
_getNamebarIconsFunc = param1;
}
public static function isVIPBadge(param1:int) : Boolean
{
var _loc2_:int = param1 >> 8 & 0xFF;
return _loc2_ + 1 == BADGE_ID_VIP_CAMERA;
}
public function destroy() : void
{
this.removeListeners();
}
public function set isBlocked(param1:Boolean) : void
{
this._isBlocked = param1;
if(this._nubType != GUIDE)
{
this._right.blocked.visible = this._isBlocked;
}
}
public function setColorAndBadge(param1:int) : void
{
this._packedNameBarData = param1;
var _loc2_:int = param1 & 0xFF;
var _loc3_:int = param1 >> 8 & 0xFF;
this._badgeId = _loc3_ + 1;
if(this["e"].currentFrameLabel)
{
this.setColor(_loc2_);
this.setBadgeIcon(_loc3_);
}
}
public function setColorBadgeAndXp(param1:int, param2:int, param3:Boolean, param4:Boolean = false) : void
{
this.setColorAndBadge(param1);
var _loc5_:Boolean = (param1 >> 16 & 0xFF) == 0 && param3;
this._isMember = param3;
if(param2 > 0 && (param4 || _loc5_))
{
if(Boolean(this._currShapeMouse) && Boolean(this._currShapeMouse.level != null) && this._currShapeMouse.level == param2)
{
this.setCurrShape();
}
else if(param2 > 0)
{
this.setShape(param2);
}
}
else
{
while(this._shape.mouse.up.icon.numChildren > 0)
{
this._shape.mouse.up.icon.removeChildAt(0);
}
while(this._shape.mouse.mouse.icon.numChildren > 0)
{
this._shape.mouse.mouse.icon.removeChildAt(0);
}
}
}
public function setNubType(param1:String, param2:Boolean = true) : void
{
this.nubType = param1;
this.resize(param2);
}
public function setAvName(param1:String, param2:Boolean = true) : void
{
this._avName.txt.text = param1;
this.resize(param2);
}
public function removeShape() : void
{
while(this._shape.mouse.up.icon.numChildren > 0)
{
this._shape.mouse.up.icon.removeChildAt(0);
}
while(this._shape.mouse.mouse.icon.numChildren > 0)
{
this._shape.mouse.mouse.icon.removeChildAt(0);
}
}
public function updateMeter(param1:int) : void
{
this.setMeter(param1);
}
public function getMeterValue() : int
{
if(this["meter"])
{
return this["meter"].hpBar.width;
}
return 0;
}
public function removeListeners() : void
{
removeEventListener(MouseEvent.ROLL_OVER,this.onOverHandler);
removeEventListener(MouseEvent.ROLL_OUT,this.onOutHandler);
}
public function get nubData() : Array
{
return this._nubDataArray;
}
public function set nubData(param1:Array) : void
{
this._nubDataArray = param1;
}
public function get iconIds() : Array
{
return this._iconIdsArray;
}
public function set iconIds(param1:Array) : void
{
this._iconIdsArray = param1;
}
public function get packedNameBarData() : int
{
return this._packedNameBarData;
}
public function get xpShapeIcons() : Object
{
return {
"mouseIcon":this._currShapeMouse,
"upIcon":this._currShapeUp
};
}
public function set xpShapeIcons(param1:Object) : void
{
this._currShapeMouse = param1.mouseIcon;
this._currShapeUp = param1.upIcon;
if(Boolean(this._currShapeMouse) && this._currShapeMouse.level != null)
{
this.setShape(this._currShapeMouse.level);
}
}
public function get currentLevel() : int
{
if(Boolean(this._currShapeMouse) && this._currShapeMouse.level != null)
{
return this._currShapeMouse.level;
}
return 0;
}
private function setColor(param1:int) : void
{
var _loc2_:int = 0;
if(param1 == 0)
{
_loc2_ = 4;
}
else if(param1 > 3 && param1 <= MAX_COLORS)
{
_loc2_ = param1 + 1;
}
else
{
_loc2_ = Math.min(4,param1);
}
this._currframeName = this["e"].currentLabels[_loc2_ - 1].name;
this["e"].gotoAndStop(this._currframeName);
this._left = this["e"][this._currframeName];
this["n"].gotoAndStop(this._currframeName);
this._mid = this["n"][this._currframeName];
if(this._meter)
{
this["meter"].gotoAndStop(this._currframeName);
this._meter = this["meter"][this._currframeName];
}
if(this._shape)
{
this["shape"].gotoAndStop(this._currframeName);
this._shape = this["shape"][this._currframeName];
}
if(this["selnub"].nub.currentFrameLabel)
{
this["selnub"].nub.gotoAndStop(this._currframeName);
this._right = this["selnub"];
}
if(this._avName.currentFrameLabel)
{
this._avName.gotoAndStop(this._currframeName);
}
this._left.mouse.gotoAndStop(1);
this._mid.mouse.gotoAndStop(1);
if(this._shape)
{
this._shape.mouse.gotoAndStop(1);
}
if(this._right.nub.currentFrameLabel)
{
this._right.nub[this._currframeName].mouse.gotoAndStop(1);
}
else
{
this._right.nub.mouse.gotoAndStop(1);
}
}
private function setBadgeIcon(param1:int) : void
{
var _loc2_:int = 0;
if(this._iconIdsArray.length > 0)
{
if(this["selnub"].currentFrameLabel == "buddy")
{
while(this._right.nub[String(this._right.nub.currentFrameLabel)].mouse.mouse.icon.numChildren > 0)
{
this._right.nub[String(this._right.nub.currentFrameLabel)].mouse.mouse.icon.removeChildAt(0);
}
while(this._right.nub[String(this._right.nub.currentFrameLabel)].mouse.up.icon.numChildren > 0)
{
this._right.nub[String(this._right.nub.currentFrameLabel)].mouse.up.icon.removeChildAt(0);
}
_loc2_ = int(this._iconIdsArray[param1]);
param1 *= 2;
if(param1 % 2 != 0)
{
param1++;
}
if(Boolean(this._iconImages[param1]) && Boolean(this._iconImages[param1 + 1]))
{
this._right.nub[String(this._right.nub.currentFrameLabel)].mouse.mouse.icon.addChild(this._iconImages[param1]);
this._right.nub[String(this._right.nub.currentFrameLabel)].mouse.up.icon.addChild(this._iconImages[param1 + 1]);
}
else
{
this._nubDataArray[param1] = this._right.nub[String(this._right.nub.currentFrameLabel)].mouse;
this.loadIcon(_loc2_,param1);
}
}
}
else
{
this._nameBarDataToBeLoaded = this._packedNameBarData;
}
}
private function set nubType(param1:String) : void
{
if(param1 == "")
{
this._right.visible = false;
}
else
{
this._right.visible = true;
this._nubType = param1;
this._right.gotoAndStop(this._nubType);
if(this._right.nub.currentFrameLabel)
{
this._right.nub.gotoAndStop(this._currframeName);
this._right.nub[this._currframeName].mouse.gotoAndStop(1);
}
else
{
this._right.nub.mouse.gotoAndStop(1);
}
if(this._isBlocked && this._nubType != GUIDE)
{
this._right.blocked.gotoAndStop(1);
}
}
}
private function resize(param1:Boolean) : void
{
var _loc2_:int = 0;
var _loc3_:MovieClip = null;
var _loc4_:MovieClip = null;
var _loc5_:MovieClip = null;
var _loc6_:MovieClip = null;
if(param1)
{
_loc3_ = this._mid.parent != this ? MovieClip(this._mid.parent) : this._mid;
_loc4_ = this._left.parent != this ? MovieClip(this._left.parent) : this._left;
_loc5_ = Boolean(this._shape) && this._shape.parent != this ? MovieClip(this._shape.parent) : this._shape;
_loc6_ = Boolean(this._meter) && this._meter.parent != this ? MovieClip(this._meter.parent) : this._meter;
if(this._nubType == NON_BUDDY && !this._isBlocked)
{
_loc2_ = 10;
}
else
{
_loc2_ = 20;
}
this._avName.txt.width = 300;
if(this._avName.txt.textWidth + _loc2_ < 60)
{
_loc3_.width = 60 + 0.5 * this._right.width;
}
else
{
_loc3_.width = Math.ceil(this._avName.txt.textWidth + _loc2_);
}
_loc3_.x = _loc3_.width * 0.5 * -1;
this._avName.txt.width = _loc3_.width - _loc2_ + 5;
_loc4_.x = _loc3_.x - _loc4_.width;
this._avName.x = _loc3_.x + (this._isMember ? 2 : -2);
this._right.x = _loc3_.x + _loc3_.width - 1;
if(_loc5_)
{
_loc5_.x = _loc4_.x;
}
if(_loc6_)
{
_loc6_.width = this._avName.txt.width + 18;
_loc6_.x = this._avName.x - 7;
}
}
this._left.mouse.gotoAndStop(1);
this._mid.mouse.gotoAndStop(1);
if(this._shape)
{
this._shape.mouse.gotoAndStop(1);
}
if(this._right.nub.currentFrameLabel)
{
this._right.nub[this._currframeName].mouse.gotoAndStop(1);
}
else
{
this._right.nub.mouse.gotoAndStop(1);
}
}
private function loadIcon(param1:int, param2:int) : void
{
var _loc3_:MediaHelper = new MediaHelper();
_loc3_.init(param1,this.onIconsLoaded,param2);
this._iconsMediaHelperArray[param2] = _loc3_;
_loc3_ = new MediaHelper();
_loc3_.init(param1,this.onIconsLoaded,param2 + 1);
this._iconsMediaHelperArray[param2 + 1] = _loc3_;
}
private function onIconsLoaded(param1:MovieClip) : void
{
var _loc2_:Object = null;
var _loc3_:int = 0;
if(param1)
{
param1.cacheAsBitmap = true;
_loc3_ = int(param1.passback);
this._iconImages[_loc3_] = param1;
if(param1.passback % 2 == 0)
{
_loc2_ = this._nubDataArray[_loc3_].mouse.icon;
while(_loc2_.numChildren > 0)
{
_loc2_.removeChildAt(0);
}
_loc2_.addChild(param1);
}
else
{
_loc2_ = this._nubDataArray[_loc3_ - 1].up.icon;
while(_loc2_.numChildren > 0)
{
_loc2_.removeChildAt(0);
}
_loc2_.addChild(param1);
}
if(this._iconsMediaHelperArray[_loc3_])
{
this._iconsMediaHelperArray[_loc3_].destroy();
this._iconsMediaHelperArray[_loc3_] = null;
delete this._iconsMediaHelperArray[_loc3_];
}
}
}
private function setCurrShape() : void
{
while(this._shape.mouse.up.icon.numChildren > 0)
{
this._shape.mouse.up.icon.removeChildAt(0);
}
this._shape.mouse.up.icon.addChild(this._currShapeUp);
while(this._shape.mouse.mouse.icon.numChildren > 0)
{
this._shape.mouse.mouse.icon.removeChildAt(0);
}
this._shape.mouse.mouse.icon.addChild(this._currShapeMouse);
}
private function setShape(param1:int) : void
{
var _loc2_:int = 0;
if(param1 > 0)
{
if(this._currShapeMouse == null || this._currShapeMouse.level != param1 && Math.floor(this._currShapeMouse.level / 5) != Math.floor(param1 / 5))
{
_loc2_ = Math.floor(param1 / 5) > LEVEL_SHAPES.length - 1 ? int(LEVEL_SHAPES[LEVEL_SHAPES.length - 1]) : int(LEVEL_SHAPES[Math.floor(param1 / 5)]);
this._levelShapeHelper = new MediaHelper();
this._levelShapeHelper.init(_loc2_,this.onLevelShapeLoaded,-1);
this._shapesMediaHelperArray.push(this._levelShapeHelper);
this._levelShapeHelper = new MediaHelper();
this._levelShapeHelper.init(_loc2_,this.onLevelShapeLoaded,param1);
this._shapesMediaHelperArray.push(this._levelShapeHelper);
}
else
{
while(this._shape.mouse.up.icon.numChildren > 0)
{
this._shape.mouse.up.icon.removeChildAt(0);
}
this._shape.mouse.up.icon.addChild(this._currShapeUp);
while(this._shape.mouse.mouse.icon.numChildren > 0)
{
this._shape.mouse.mouse.icon.removeChildAt(0);
}
this._shape.mouse.mouse.icon.addChild(this._currShapeMouse);
this._currShapeMouse.text.text = param1;
this._currShapeUp.text.text = param1;
}
}
else
{
while(this._shape.mouse.up.icon.numChildren > 0)
{
this._shape.mouse.up.icon.removeChildAt(0);
}
while(this._shape.mouse.mouse.icon.numChildren > 0)
{
this._shape.mouse.mouse.icon.removeChildAt(0);
}
}
}
private function onLevelShapeLoaded(param1:MovieClip) : void
{
var _loc2_:MovieClip = null;
if(param1)
{
_loc2_ = MovieClip(param1.getChildAt(0));
if(param1.passback == -1)
{
this._currShapeUp = _loc2_;
if(this._isMember)
{
this._currShapeUp.gotoAndStop("member");
}
if(this._currShapeMouse)
{
this._currShapeUp.text.text = this._currShapeMouse.level;
}
this._shapesMediaHelperArray[0].destroy();
this._shapesMediaHelperArray.splice(0,1);
while(this._shape.mouse.up.icon.numChildren > 0)
{
this._shape.mouse.up.icon.removeChildAt(0);
}
this._shape.mouse.up.icon.addChild(this._currShapeUp);
}
else
{
this._currShapeMouse = _loc2_;
if(this._isMember)
{
this._currShapeMouse.gotoAndStop("member");
}
this._currShapeMouse.level = this._currShapeMouse.text.text = param1.passback;
if(this._currShapeUp)
{
this._currShapeUp.text.text = this._currShapeMouse.level;
}
this._shapesMediaHelperArray[this._shapesMediaHelperArray.length - 1].destroy();
this._shapesMediaHelperArray.pop();
while(this._shape.mouse.mouse.icon.numChildren > 0)
{
this._shape.mouse.mouse.icon.removeChildAt(0);
}
this._shape.mouse.mouse.icon.addChild(this._currShapeMouse);
}
this._shape.mouse.gotoAndStop(1);
}
}
private function setMeter(param1:int) : void
{
if(this["meter"])
{
this["meter"].hpBar.width = this["meter"].hpBarContainer.width * (param1 / 100);
}
}
private function onOverHandler(param1:MouseEvent) : void
{
this._left.mouse.gotoAndPlay(1);
this._mid.mouse.gotoAndPlay(1);
if(this._shape)
{
this._shape.mouse.gotoAndPlay(1);
}
if(this._right.nub.currentFrameLabel)
{
this._right.nub[String(this._right.nub.currentFrameLabel)].mouse.gotoAndPlay(1);
}
else
{
this._right.nub.mouse.gotoAndPlay(1);
}
if(this._isBlocked && this._nubType != GUIDE)
{
this._right.blocked.mouse.gotoAndPlay(1);
}
}
private function onOutHandler(param1:MouseEvent) : void
{
var _loc2_:MovieClip = null;
if(this._right.nub[String(this._right.nub.currentFrameLabel)])
{
_loc2_ = this._right.nub[String(this._right.nub.currentFrameLabel)];
}
else
{
_loc2_ = this._right.nub;
}
if(this._left.mouse.currentFrame > 1)
{
this.playBackwards(this._left.mouse);
}
else
{
this._left.mouse.stop();
}
if(this._mid.mouse.currentFrame > 1)
{
this.playBackwards(this._mid.mouse);
}
else
{
this._mid.mouse.stop();
}
if(this._shape)
{
if(this._shape.mouse.currentFrame > 1)
{
this.playBackwards(this._shape.mouse);
}
else
{
this._shape.mouse.stop();
}
}
if(_loc2_.mouse.currentFrame > 1)
{
this.playBackwards(_loc2_.mouse);
}
else
{
_loc2_.mouse.stop();
}
if(this._isBlocked && this._nubType != GUIDE)
{
if(this._right.blocked.mouse.currentFrame > 1)
{
this.playBackwards(this._right.blocked.mouse);
}
else
{
this._right.blocked.mouse.stop();
}
}
}
private function playBackwards(param1:MovieClip) : void
{
param1.addEventListener(Event.ENTER_FRAME,this.pbFrameHandler,false,0,true);
}
private function pbFrameHandler(param1:Event) : void
{
var _loc2_:MovieClip = null;
if(param1.target as MovieClip)
{
_loc2_ = MovieClip(param1.target);
if(_loc2_.currentFrame == 1)
{
_loc2_.removeEventListener(Event.ENTER_FRAME,this.pbFrameHandler);
return;
}
_loc2_.prevFrame();
}
}
}
}
@@ -0,0 +1,58 @@
package avatar
{
import com.sbi.analytics.SBTracker;
import flash.display.MovieClip;
import gui.DarkenManager;
import gui.GuiManager;
public class NewWorldAvatar implements INewAvatar
{
public function NewWorldAvatar()
{
super();
}
public function screenInitCallback(param1:MovieClip) : void
{
param1.visible = false;
}
public function get playSound() : Boolean
{
return false;
}
public function newAvatarData(param1:int, param2:String, param3:Array, param4:Function, param5:int = -1, param6:int = -1, param7:Boolean = false) : void
{
SBTracker.trackPageview("/game/play/popup/avatarSwitch/buyAnimal");
var _loc8_:Boolean = Boolean(param2 && param2 != "" && RegExp(/a-zA-Z0-9 /)["exec"](param2) == null);
if(_loc8_)
{
AvatarSwitch.addNewWorldAvatar(param1,param2,param3,param5,param6,param7);
}
if(param4 != null && !AvatarSwitch.isAddingSlot && !param7)
{
param4(_loc8_);
}
if(_loc8_)
{
DarkenManager.showLoadingSpiral(true);
}
}
public function hideConnectingMsg() : void
{
}
public function nameTypeScreenDone() : void
{
GuiManager.closeAvatarCreator();
}
public function logInForCreateAvatarData() : void
{
}
}
}
@@ -0,0 +1,812 @@
package avatar
{
import com.adobe.utils.StringUtil;
import com.sbi.client.SFEvent;
import com.sbi.debug.DebugUtility;
import com.sbi.loader.FileServerEvent;
import com.sbi.popup.*;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.external.ExternalInterface;
import flash.text.TextFormat;
import flash.utils.setTimeout;
import game.MinigameInfo;
import game.MinigameManager;
import gui.ActionManager;
import gui.ChatHistory;
import gui.EmoticonManager;
import gui.EmoticonUtility;
import gui.GuiManager;
import gui.SafeChatManager;
import loader.DefPacksDefHelper;
import loader.JCDefHelper;
import localization.LocalizationManager;
import quest.QuestXtCommManager;
import room.RoomManagerWorld;
public class UserCommXtCommManager
{
public static var RAW_STR:String;
private static var _drainPopupDelay:Number;
private static var _mainHud:MovieClip;
private static var _chatHist:ChatHistory;
private static var _emoteMgr:EmoticonManager;
private static var _actionMgr:ActionManager;
private static var _roomMgr:RoomManagerWorld;
private static var _spellingCorrections:Object;
private static var _emoteDefs:Object;
private static var _specialWords:Object;
private static var _replacedWords:Object;
private static var _customPVPMessageCallback:Object;
private static var _customPVPPassback:Object;
private static const BROADCAST_MESSAGE_LOC_ID_UPDATING_AJ_FULL_DEPLOY_IN_ONE_MINUTE:int = 22367;
private static const BROADCAST_MESSAGE_LOC_ID_UPDATING_AJ_FULL_DEPLOY_IN_N_MINUTES:int = 22368;
private static const BROADCAST_MESSAGE_LOC_ID_UPDATING_AJ_HOTFIX_IN_ONE_MINUTE:int = 22369;
private static const BROADCAST_MESSAGE_LOC_ID_UPDATING_AJ_HOTFIX_IN_N_MINUTES:int = 22370;
private static var _playerSfsUserId:int = -1;
public function UserCommXtCommManager()
{
super();
}
public static function init() : void
{
DebugUtility.debugTrace("UserCommXtCommManager init - initializing");
_mainHud = GuiManager.mainHud;
_chatHist = GuiManager.chatHist;
_emoteMgr = GuiManager.emoteMgr;
_actionMgr = GuiManager.actionMgr;
_roomMgr = RoomManagerWorld.instance;
_drainPopupDelay = Math.random() * 10 * 60 * 1000;
if(_drainPopupDelay < 5 * 60 * 1000)
{
_drainPopupDelay = Math.random() * 10 * 60 * 1000;
}
_playerSfsUserId = AvatarManager.playerSfsUserId;
RAW_STR = gMainFrame.server.rawProtocolSeparator;
var _loc1_:DefPacksDefHelper = new DefPacksDefHelper();
_loc1_.init(DefPacksDefHelper.DEF_EMOTICON,onEmoticonDefsLoaded,null,FileServerEvent.AMF3_TYPE);
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_EMOTICON] = _loc1_;
_loc1_ = new DefPacksDefHelper();
_loc1_.init(uint(DefPacksDefHelper.AUTO_CORRECT_TEXT_FILE_TO_APPEND_TO + "" + 0),onAutoCorrectListLoaded,null,FileServerEvent.PLAIN_TEXT_TYPE);
DefPacksDefHelper.mediaArray[DefPacksDefHelper.AUTO_CORRECT_TEXT_FILE_TO_APPEND_TO + "" + 0] = _loc1_;
_specialWords = {};
_specialWords[LocalizationManager.translateIdOnly(14855)] = LocalizationManager.translateIdOnly(11142);
}
private static function onAutoCorrectListLoaded(param1:DefPacksDefHelper) : void
{
DefPacksDefHelper.mediaArray[DefPacksDefHelper.AUTO_CORRECT_TEXT_FILE_TO_APPEND_TO + "" + 0] = null;
var _loc2_:String = param1.def.toString().toLowerCase() as String;
_spellingCorrections = {};
var _loc3_:Array = _loc2_.split("\r\n");
var _loc4_:int = 0;
while(_loc4_ < _loc3_.length)
{
_loc3_[_loc4_] = _loc3_[_loc4_].split(",");
if(!(_loc3_[_loc4_][0] == null || _loc3_[_loc4_][0].length == 0 || _loc3_[_loc4_][1] == null || _loc3_[_loc4_][1].length == 0))
{
_spellingCorrections[StringUtil.trim(_loc3_[_loc4_][0])] = StringUtil.trim(_loc3_[_loc4_][1]);
}
_loc4_++;
}
}
private static function onEmoticonDefsLoaded(param1:DefPacksDefHelper) : void
{
var _loc4_:Object = null;
DefPacksDefHelper.mediaArray[DefPacksDefHelper.DEF_EMOTICON] = null;
var _loc2_:Object = param1.def;
var _loc3_:Object = new Object();
for each(_loc4_ in _loc2_)
{
_loc3_[_loc4_.id] = int(_loc4_.mediaRef);
}
_emoteDefs = _loc3_;
}
public static function destroy() : void
{
}
public static function set playerSfsUserId(param1:int) : void
{
_playerSfsUserId = param1;
}
public static function getEmoticonMediaId(param1:int) : int
{
if(!_emoteDefs[param1])
{
return 0;
}
return _emoteDefs[param1];
}
public static function getEmoticonDefId(param1:int) : int
{
var _loc2_:String = null;
for(_loc2_ in _emoteDefs)
{
if(_emoteDefs[_loc2_] == param1)
{
return int(_loc2_);
}
}
return 0;
}
public static function addChatMessage(param1:String) : void
{
_chatHist.addMessage(gMainFrame.userInfo.playerAvatarInfo.avName,gMainFrame.userInfo.playerAvatarInfo.userName,param1);
}
public static function sendAvatarSafeChat(param1:String, param2:String, param3:Boolean = true) : void
{
if(gMainFrame.clientInfo.invisMode)
{
return;
}
AvatarManager.addAvatarMessage(param1,_playerSfsUserId,0);
addChatMessage(param1);
gMainFrame.server.sendMessage(param2 + RAW_STR + int(MinigameManager.inMinigame) + RAW_STR + SbiConstants.CHAT_TYPE_SAFE);
if(_chatHist.enableFreeChatValue)
{
_chatHist.resetTreeSearch();
_chatHist.chatMsgText.text = "";
_chatHist.setFocusOnMsgText();
}
if(param3)
{
GuiManager.safeChatBtnDownHandler(null);
}
}
public static function sendAvatarEmote(param1:Sprite) : void
{
if(gMainFrame.clientInfo.invisMode)
{
return;
}
AvatarManager.setAvatarEmote(param1);
if(!EmoticonUtility.getEmoteString(param1))
{
throw new Error("setAvatarEmote: sent invalid emote sprite?!");
}
addChatMessage(EmoticonUtility.getEmoteString(param1));
gMainFrame.server.sendMessage(EmoticonUtility.idForEmote(param1) + RAW_STR + int(MinigameManager.inMinigame) + RAW_STR + SbiConstants.CHAT_TYPE_EMOTE);
if(_chatHist.enableFreeChatValue)
{
_chatHist.resetTreeSearch();
_chatHist.chatMsgText.text = "";
_chatHist.setFocusOnMsgText();
}
}
public static function sendAvatarAction(param1:Sprite) : void
{
if(gMainFrame.clientInfo.invisMode)
{
return;
}
AvatarManager.setAvatarAction(param1);
if(!_actionMgr.getActionString(param1))
{
throw new Error("setAvatarAction: sent invalid action sprite?!");
}
addChatMessage(_actionMgr.getActionString(param1));
var _loc2_:AvatarWorldView = AvatarManager.avatarViewList[AvatarManager.playerSfsUserId];
var _loc3_:int = _loc2_.lastIdleAnim;
gMainFrame.server.sendMessage(_actionMgr.getActionString(param1) + RAW_STR + int(MinigameManager.inMinigame) + RAW_STR + SbiConstants.CHAT_TYPE_ACTION + RAW_STR + _loc3_);
if(_chatHist.enableFreeChatValue)
{
_chatHist.resetTreeSearch();
_chatHist.chatMsgText.text = "";
_chatHist.setFocusOnMsgText();
}
}
public static function sendAvatarAttachmentEmot(param1:int, param2:String = null) : void
{
if(gMainFrame.clientInfo.invisMode)
{
return;
}
if(param2 == null)
{
param2 = "";
}
gMainFrame.server.sendMessage(param1 + "," + param2 + RAW_STR + int(MinigameManager.inMinigame) + RAW_STR + SbiConstants.CHAT_TYPE_ATTACHMENT);
}
public static function sendAvatarBlendColor(param1:uint) : void
{
gMainFrame.server.sendMessage(int(param1) + RAW_STR + int(MinigameManager.inMinigame) + RAW_STR + SbiConstants.CHAT_TYPE_BLEND_COLOR);
}
public static function sendAvatarAlphaLevel(param1:uint) : void
{
gMainFrame.server.sendMessage(int(param1) + RAW_STR + int(MinigameManager.inMinigame) + RAW_STR + SbiConstants.CHAT_TYPE_ALPHA_LEVEL);
}
public static function sendChatMessage(param1:int, param2:String, param3:Boolean) : void
{
if(Boolean(gMainFrame.clientInfo.invisMode) || !Utility.canChat())
{
return;
}
param2 = fixMispellings(param2);
param2 = adjustCamelCase(param2);
AvatarManager.addAvatarMessage("...",param1,0);
param2 = adjustSpecialWords(param2);
var _loc4_:int = gMainFrame.userInfo.sgChatType == ChatHistory.SG_CHAT_TYPE_FREE ? SbiConstants.CHAT_TYPE_TYPED : SbiConstants.CHAT_TYPE_LIMITED;
gMainFrame.server.sendMessage(param2 + RAW_STR + int(param3) + RAW_STR + _loc4_);
if(_chatHist.enableFreeChatValue)
{
_chatHist.resetTreeSearch();
_chatHist.chatMsgText.text = "";
gMainFrame.stage.focus = _chatHist.chatMsgText;
}
}
public static function adjustSpecialWords(param1:String) : String
{
var _loc3_:String = null;
var _loc4_:String = null;
var _loc7_:String = null;
var _loc8_:int = 0;
var _loc9_:String = null;
var _loc10_:String = null;
var _loc11_:String = null;
_replacedWords = {};
var _loc2_:Array = param1.split(" ");
var _loc5_:int = 0;
var _loc6_:int = 0;
while(_loc6_ < _loc2_.length)
{
_loc3_ = _loc2_[_loc6_];
_loc4_ = _loc3_.toLowerCase();
for(_loc7_ in _specialWords)
{
_loc8_ = _loc4_.indexOf(_loc7_);
if(_loc8_ >= 0)
{
_loc9_ = _loc3_.substr(0,_loc8_);
_loc10_ = _loc3_.substr(_loc8_,_loc7_.length);
_loc11_ = _loc3_.substr(_loc8_ + _loc7_.length);
_loc5_ = getCaseType(_loc10_);
_loc10_ = setCaseType(_specialWords[_loc7_],_loc5_);
_loc2_[_loc6_] = _loc9_ + _loc10_ + _loc11_;
_replacedWords[_loc2_[_loc6_]] = _loc3_;
}
}
_loc6_++;
}
return _loc2_.join(" ");
}
private static function getCaseType(param1:String) : int
{
if(param1.toLowerCase() == param1)
{
return 0;
}
var _loc2_:String = param1.charAt(0);
var _loc3_:int = int(param1.match(/[A-Z]/g).length);
if(_loc3_ == param1.length)
{
return 1;
}
return 2;
}
private static function setCaseType(param1:String, param2:int) : String
{
if(param2 == 0)
{
return param1.toLowerCase();
}
if(param2 == 1)
{
return param1.toUpperCase();
}
param1 = param1.toLowerCase();
var _loc3_:String = param1.charAt(0).toUpperCase();
return _loc3_ + param1.substr(1);
}
public static function reverseSpecialWords(param1:String) : String
{
var _loc2_:String = null;
if(_replacedWords == null)
{
return param1;
}
var _loc3_:Array = param1.split(" ");
var _loc4_:int = 0;
while(_loc4_ < _loc3_.length)
{
_loc2_ = _loc3_[_loc4_].toLowerCase();
if(!(_replacedWords[_loc2_] == null || _loc2_ == "constructor"))
{
_loc3_[_loc4_] = _replacedWords[_loc2_];
}
_loc4_++;
}
_replacedWords = null;
return _loc3_.join(" ");
}
public static function adjustCamelCase(param1:String) : String
{
var _loc3_:int = 0;
var _loc4_:String = null;
var _loc5_:String = null;
var _loc6_:String = null;
var _loc8_:int = 0;
var _loc2_:Array = param1.split(" ");
var _loc7_:int = 0;
while(_loc7_ < _loc2_.length)
{
_loc4_ = _loc2_[_loc7_];
_loc5_ = _loc4_.match(/[a-zA-Z]/g).join("");
_loc6_ = _loc5_.charAt(0);
_loc3_ = int(_loc5_.match(/[A-Z]/g).length);
if(_loc3_ > 0 && _loc3_ != _loc5_.length)
{
if(_loc6_.match(/[A-z]/g).length == 1)
{
_loc8_ = getIndexOfFirstLetter(_loc4_,_loc5_);
_loc2_[_loc7_] = _loc4_.substr(0,_loc8_) + _loc6_ + _loc4_.toLowerCase().substr(_loc8_ + 1,_loc4_.length);
}
else
{
_loc2_[_loc7_] = _loc4_.toLowerCase();
}
}
_loc7_++;
}
return _loc2_.join(" ");
}
public static function getFirstLetter(param1:String) : String
{
var _loc2_:String = param1.match(/[a-zA-Z]/g).join("");
if(_loc2_.length > 0)
{
return _loc2_.charAt(0);
}
return null;
}
public static function getIndexOfFirstLetter(param1:String, param2:String) : int
{
if(param2 == "")
{
param2 = param1.match(/[a-zA-Z]/g).join();
}
var _loc3_:int = 0;
while(_loc3_ < param1.length)
{
if(param1.charAt(_loc3_) == param2.charAt(0))
{
return _loc3_;
}
_loc3_++;
}
return -1;
}
public static function fixMispellings(param1:String) : String
{
var _loc3_:String = null;
if(!_spellingCorrections || LocalizationManager.currentLanguage != LocalizationManager.LANG_ENG)
{
return param1;
}
var _loc2_:Array = param1.split(" ");
var _loc4_:int = 0;
while(_loc4_ < _loc2_.length)
{
_loc3_ = _loc2_[_loc4_].toLowerCase();
_loc3_ = stripPunctuation(_loc3_);
if(_spellingCorrections[_loc3_] != null)
{
_loc3_ = _spellingCorrections[_loc3_];
_loc2_[_loc4_] = _loc3_;
}
_loc4_++;
}
return _loc2_.join(" ");
}
public static function stripPunctuation(param1:String) : String
{
return param1.replace(/[^A-Za-z0-9 ']+/g,"");
}
public static function sendAvatarSlide(param1:String) : void
{
if(gMainFrame.clientInfo.invisMode)
{
return;
}
gMainFrame.server.sendMessage(param1 + RAW_STR + int(MinigameManager.inMinigame) + RAW_STR + SbiConstants.CHAT_TYPE_SLIDE);
}
public static function sendPermEmote(param1:int, param2:Boolean) : void
{
gMainFrame.server.sendMessage(param1 + RAW_STR + int(param2) + RAW_STR + SbiConstants.CHAT_TYPE_PERM_EMOTE);
}
public static function sendPetAction(param1:int, param2:int = 0) : void
{
gMainFrame.server.sendMessage(param1 + "," + param2 + RAW_STR + int(MinigameManager.inMinigame) + RAW_STR + SbiConstants.CHAT_TYPE_PET_ACTION);
}
public static function sendCustomAdventureMessage(param1:Boolean) : void
{
gMainFrame.server.sendMessage((param1 ? "on" : "off") + RAW_STR + 0 + RAW_STR + SbiConstants.CHAT_TYPE_CUST_ADVENTURE);
}
public static function sendCustomPVPMessage(param1:Boolean, param2:int, param3:Function = null, param4:Object = null) : void
{
_customPVPMessageCallback = param3;
_customPVPPassback = param4;
gMainFrame.server.sendMessage((param1 ? "on" : "off") + RAW_STR + 0 + RAW_STR + SbiConstants.CHAT_TYPE_CUST_PVP + RAW_STR + param2);
}
public static function onSendMessage(param1:MouseEvent, param2:String = "") : void
{
var _loc5_:Sprite = null;
var _loc6_:String = null;
if(_playerSfsUserId == -1)
{
DebugUtility.debugTrace("WARNING - UserCommXtCommManager.init was never called or the playerAvatarId is bad");
_playerSfsUserId = AvatarManager.playerSfsUserId;
}
var _loc3_:String = param2 == "" ? _mainHud.chatBar.text01_chat.text : param2;
_loc3_ = _loc3_.split("\r").join("");
_loc3_ = _loc3_.split(RAW_STR).join("");
_loc3_ = StringUtil.trim(_loc3_);
if(_loc3_.length <= 0)
{
return;
}
var _loc4_:Object = EmoticonUtility.matchEmoteString(_loc3_);
if(_loc4_.status)
{
if(_loc4_.sprite)
{
sendAvatarEmote(_loc4_.sprite);
AvatarManager.setAvatarEmote(_loc4_.sprite,-2);
}
else
{
_loc5_ = _actionMgr.matchActionString(_loc3_);
if(_loc5_)
{
sendAvatarAction(_loc5_);
AvatarManager.setAvatarAction(_loc5_,-2);
}
else
{
_loc6_ = SafeChatManager.safeChatCodeForString(_loc3_);
if(_loc6_)
{
sendAvatarSafeChat(_loc3_,_loc6_,false);
AvatarManager.addAvatarMessage(_loc3_,_playerSfsUserId,0);
}
else
{
sendChatMessage(_playerSfsUserId,_loc3_,MinigameManager.inMinigame());
}
}
}
return;
}
_chatHist.resetTreeSearch();
_chatHist.chatMsgText.text = "";
gMainFrame.stage.focus = _chatHist.chatMsgText;
}
public static function handleXtReply(param1:SFEvent) : void
{
var _loc2_:Array = param1.obj;
switch(_loc2_[0])
{
case "uc":
userCommChatResponse(_loc2_);
break;
case "ua":
userCommAdminMessageResponse(_loc2_);
break;
default:
throw new Error("UserCommXtCommManager illegal data:" + _loc2_[0]);
}
}
private static function userCommChatResponse(param1:Array) : void
{
var _loc6_:String = null;
var _loc7_:int = 0;
var _loc8_:Array = null;
var _loc9_:Array = null;
var _loc10_:Array = null;
var _loc11_:Object = null;
var _loc12_:Array = null;
var _loc13_:MinigameInfo = null;
var _loc14_:Boolean = false;
var _loc15_:String = null;
var _loc16_:Sprite = null;
var _loc17_:Sprite = null;
var _loc18_:Array = null;
var _loc19_:int = 0;
var _loc20_:Avatar = null;
var _loc21_:Array = null;
var _loc2_:int = int(param1[2]);
var _loc3_:Boolean = Boolean(int(param1[4]));
var _loc4_:int = int(param1[5]);
var _loc5_:Boolean = true;
if(_loc5_)
{
if(_loc4_ == SbiConstants.CHAT_TYPE_PERM_EMOTE)
{
_loc7_ = int(param1[3]);
if(_loc7_ >= 0)
{
AvatarManager.setAvatarEmote(null,_loc2_,_loc7_);
}
else
{
AvatarManager.setChatBalloonReadyForClear(_loc2_);
}
}
else if(_loc4_ == SbiConstants.CHAT_TYPE_SLIDE)
{
if(_loc2_ != gMainFrame.server.userId)
{
_roomMgr.attachAvatarToSlide(AvatarManager.avatarViewList[_loc2_],param1[3]);
}
}
else if(_loc4_ == SbiConstants.CHAT_TYPE_PET_ACTION)
{
_loc8_ = param1[3].split(",");
AvatarManager.setPetAction(_loc2_,_loc8_[0],_loc8_[1]);
}
else if(_loc4_ == SbiConstants.CHAT_TYPE_CUST_ADVENTURE)
{
_loc6_ = param1[3];
if(_loc6_ == "off")
{
AvatarManager.addCustomAdventureMessage("","off",_loc2_,0,0);
}
else
{
_loc9_ = _loc6_.split("|");
_loc10_ = _loc9_[0].split(",");
_loc11_ = QuestXtCommManager.getScriptDef(_loc10_[0]);
if(_loc11_)
{
AvatarManager.addCustomAdventureMessage(LocalizationManager.translateIdOnly(_loc11_.titleStrId),_loc9_[1] + "|" + _loc10_[0],_loc2_,_loc10_[2],int(param1[6]));
}
}
}
else if(_loc4_ == SbiConstants.CHAT_TYPE_CUST_PVP)
{
_loc6_ = param1[3];
_loc12_ = param1[3].split("|");
if(_loc12_[0] == "off")
{
if(Boolean(_loc2_ == AvatarManager.playerSfsUserId) && Boolean(_loc12_[1]) && !MinigameManager.isInReadyModeForPVP())
{
MinigameManager.readySelfForPvpGame({"typeDefId":_loc12_[1]},_loc12_[2],true,true);
}
AvatarManager.addCustomPvpMessage("",_loc12_[0],_loc2_,0,0);
}
else
{
_loc13_ = MinigameManager.minigameInfoCache.getMinigameInfo(_loc12_[1]);
AvatarManager.addCustomPvpMessage(LocalizationManager.translateIdOnly(_loc13_.titleStrId),_loc6_,_loc2_,0,int(param1[6]));
}
if(_customPVPMessageCallback)
{
if(_customPVPPassback != null)
{
_customPVPMessageCallback(_customPVPPassback);
}
else
{
_customPVPMessageCallback();
}
_customPVPMessageCallback = null;
}
}
else
{
_loc6_ = param1[3];
_loc14_ = false;
if(_loc4_ == SbiConstants.CHAT_TYPE_SAFE)
{
_loc15_ = SafeChatManager.safeChatStringForCode(_loc6_);
if(_loc15_)
{
_loc6_ = _loc15_;
}
else
{
_loc14_ = true;
}
}
if(!_loc14_)
{
switch(_loc4_)
{
case SbiConstants.CHAT_TYPE_TYPED:
case SbiConstants.CHAT_TYPE_LIMITED:
case SbiConstants.CHAT_TYPE_SAFE:
_loc6_ = adjustCamelCase(_loc6_);
if(_loc2_ == gMainFrame.server.userId)
{
_loc6_ = reverseSpecialWords(_loc6_);
}
AvatarManager.addAvatarMessage(_loc6_,_loc2_,int(param1[6]));
break;
case SbiConstants.CHAT_TYPE_EMOTE:
_loc16_ = EmoticonUtility.emoteForId(int(_loc6_));
if(_loc16_)
{
AvatarManager.setAvatarEmote(_loc16_,_loc2_);
}
else
{
_loc14_ = true;
}
_loc6_ = EmoticonUtility.stringForId(int(_loc6_));
break;
case SbiConstants.CHAT_TYPE_ACTION:
_loc17_ = _actionMgr.matchActionString(_loc6_);
if(_loc17_)
{
AvatarManager.setAvatarAction(_loc17_,_loc2_);
}
else
{
_loc14_ = true;
}
break;
case SbiConstants.CHAT_TYPE_ATTACHMENT:
_loc18_ = _loc6_.split(",");
_loc19_ = int(_loc18_[0]);
AvatarManager._setAvatarAttachmentEmot(_loc19_,_loc18_[1],_loc2_);
break;
case SbiConstants.CHAT_TYPE_BLEND_COLOR:
AvatarManager._setAvatarBlendColor(_loc2_,uint(param1[3]));
return;
case SbiConstants.CHAT_TYPE_ALPHA_LEVEL:
AvatarManager._setAvatarAlphaLevel(_loc2_,uint(param1[3]));
return;
default:
_loc14_ = true;
}
}
if(_loc14_)
{
DebugUtility.debugTrace("WARNING - got bad chat! msg:" + _loc6_ + " chatType:" + _loc4_ + " from userId:" + _loc2_);
return;
}
if(_loc4_ != SbiConstants.CHAT_TYPE_ATTACHMENT)
{
if(gMainFrame.clientInfo.extCallsActive)
{
_loc20_ = AvatarManager.getAvatarBySfsUserId(_loc2_);
DebugUtility.debugTrace("mrc:sending cm command - chattyUserId:" + _loc2_ + " chattyAv:" + _loc20_);
if(int(param1[6]) == 2)
{
_loc21_ = _loc6_.split("|");
_loc21_.splice(0,1);
_loc6_ = _loc21_.join("|");
}
ExternalInterface.call("mrc",["cm",_loc20_.userName,_loc6_,int(param1[6])]);
DebugUtility.debugTrace("mrc:cm command sent - chattyUserName:" + _loc20_.userName + " msg:" + _loc6_);
}
if((_loc2_ != gMainFrame.server.userId || _loc2_ == gMainFrame.server.userId && (_loc4_ == SbiConstants.CHAT_TYPE_TYPED || _loc4_ == SbiConstants.CHAT_TYPE_LIMITED)) && int(param1[6]) <= 1)
{
_chatHist.addMessageById(_loc2_,_loc6_);
}
}
}
}
}
private static function userCommAdminMessageResponse(param1:Array) : void
{
var adminMsg:String = null;
var jcDefHelper:JCDefHelper = null;
var msgId:int = 0;
var msgSplit:Array = null;
var isSystemMsg:Boolean = false;
var data:Array = param1;
adminMsg = data[1];
if(adminMsg == "__ABSU_CBS__")
{
jcDefHelper = new JCDefHelper();
jcDefHelper.deleteIndexFileFromCache();
jcDefHelper.destroy();
jcDefHelper = null;
GuiManager.refreshJammerCentral();
}
else if(adminMsg == "__FORCE_RELOGIN__")
{
setTimeout(refreshPage,Math.abs(_roomMgr.shardId) * 911 % 5000,{"status":true});
}
else
{
msgSplit = adminMsg.split("|");
if(msgSplit.length > 1)
{
msgId = int(msgSplit[0]);
adminMsg = LocalizationManager.translateIdAndInsertOnly(msgId,msgSplit.slice(1));
}
isSystemMsg = data[2] == null || int(data[2]) == 1;
if(!isSystemMsg)
{
gMainFrame.clientInfo.lastBroadcastMessage = adminMsg;
GuiManager.updateSettingsMessage();
}
if(isSystemMsg || !gMainFrame.isInMinigame() && gMainFrame.clientInfo.roomType != SbiConstants.ROOMTYPE_QUEST)
{
if(msgId != BROADCAST_MESSAGE_LOC_ID_UPDATING_AJ_FULL_DEPLOY_IN_N_MINUTES && msgId != BROADCAST_MESSAGE_LOC_ID_UPDATING_AJ_FULL_DEPLOY_IN_N_MINUTES && msgId != BROADCAST_MESSAGE_LOC_ID_UPDATING_AJ_HOTFIX_IN_N_MINUTES && msgId != BROADCAST_MESSAGE_LOC_ID_UPDATING_AJ_HOTFIX_IN_ONE_MINUTE)
{
new SBAJOkPopup(GuiManager.guiLayer,adminMsg);
}
else
{
setTimeout(function():void
{
new SBYesNoPopup(GuiManager.guiLayer,adminMsg,true,refreshPage);
},_drainPopupDelay);
}
}
_chatHist.addPrivateMessage(LocalizationManager.translateIdOnly(15964),null,adminMsg);
}
}
private static function refreshPage(param1:Object) : void
{
if(param1["status"])
{
Utility.reloadSWFOrGetIp();
}
}
private static function getSpecialFormat() : TextFormat
{
var _loc1_:TextFormat = new TextFormat();
_loc1_.color = 12845056;
_loc1_.bold = true;
return _loc1_;
}
}
}
@@ -0,0 +1,206 @@
package avatar
{
import localization.LocalizationManager;
public class UserInfo
{
public var uuid:String;
public var currPerUserAvId:int;
public var avList:Object;
public var denItemsFull:Array;
public var denItemsPartial:Array;
public var accountType:int;
public var nameBarData:int;
public var isGuide:Boolean;
public var userNameModeratedFlag:int;
public var _userName:String;
private var _allItems:Array;
private var _achievements:Array;
private var _timeStampSinceLastRequest:Number;
public function UserInfo()
{
super();
}
public function init(param1:String, param2:String, param3:Array = null, param4:int = -1, param5:int = 1, param6:int = 0) : void
{
this._userName = param1;
this.uuid = param2;
this._timeStampSinceLastRequest = 0;
this._allItems = [];
if(param3)
{
this.avList = param3;
}
else
{
this.avList = {};
}
if(param4 > 0)
{
this.currPerUserAvId = param4;
}
this.accountType = param5;
this.userNameModeratedFlag = param6;
}
public function addAvatarToList(param1:AvatarInfo) : void
{
this.avList[param1.perUserAvId] = param1;
}
public function getAvatarInfoByPerUserAvId(param1:int) : AvatarInfo
{
if(param1 == -1)
{
return this.avList[this.currPerUserAvId];
}
if(this.avList[param1])
{
return this.avList[param1];
}
return null;
}
public function addAchievementsTolist(param1:Array) : void
{
if(!this._achievements)
{
this._achievements = [];
}
var _loc2_:* = int(this._achievements.length);
var _loc3_:int = 0;
while(_loc3_ < param1.length)
{
var _loc4_:Number;
this._achievements[_loc4_ = _loc2_++] = param1[_loc3_];
_loc3_++;
}
}
public function set fullItemList(param1:Array) : void
{
this._allItems = param1;
}
public function get fullItemList() : Array
{
return this._allItems;
}
public function getFullItemList(param1:Boolean) : Array
{
var _loc2_:Array = [];
var _loc3_:int = 0;
while(_loc3_ < this._allItems.length)
{
if(param1)
{
_loc2_.push(this._allItems[_loc3_]);
}
else if(this._allItems[_loc3_].invIdx >= 0)
{
_loc2_.push(this._allItems[_loc3_]);
}
_loc3_++;
}
return _loc2_;
}
public function getPartialItemList(param1:int, param2:Boolean) : Array
{
var _loc3_:Array = [];
var _loc4_:int = 0;
while(_loc4_ < this._allItems.length)
{
if(this._allItems[_loc4_].invIdx < 0 && param2 || Utility.isSameEnviroType(gMainFrame.userInfo.getAvatarEnviroTypeFlagByAvType(param1),this._allItems[_loc4_].enviroType))
{
if(param2)
{
_loc3_.push(this._allItems[_loc4_]);
}
else if(this._allItems[_loc4_].invIdx >= 0)
{
_loc3_.push(this._allItems[_loc4_]);
}
}
_loc4_++;
}
return _loc3_;
}
public function allItemsInUseOff(param1:int) : void
{
var _loc2_:int = 0;
while(_loc2_ < this._allItems.length)
{
this._allItems[_loc2_].setInUse(param1,false);
_loc2_++;
}
}
public function get userName() : String
{
return this._userName;
}
public function set userName(param1:String) : void
{
this._userName = param1;
}
public function get achievements() : Array
{
return this._achievements;
}
public function get isMember() : Boolean
{
return Utility.isMember(this.accountType);
}
public function resetAchievements() : void
{
this._achievements = [];
}
public function getTimeOfLastAchievementRequest() : Number
{
return this._timeStampSinceLastRequest;
}
public function setTimeOfLastAchievementRequest(param1:Number) : void
{
this._timeStampSinceLastRequest = param1;
}
public function getModeratedUserName() : String
{
if(this.userNameModeratedFlag > 0)
{
return this.userName;
}
return LocalizationManager.translateIdOnly(LocalizationManager.NEW_JAMMER_USERNAME);
}
public function getAccountType() : int
{
return this.accountType;
}
}
}
@@ -0,0 +1,434 @@
package avatar
{
import com.sbi.debug.DebugUtility;
import flash.utils.Dictionary;
import localization.LocalizationManager;
public class UserInfoCache
{
public var myBuddyCount:int;
public var myUUID:String;
public var isMember:Boolean;
public var isModerator:Boolean;
public var isGuide:Boolean;
public var isSilenced:Boolean;
public var isMyDenPrivate:Boolean;
public var sgChatType:int;
public var sgChatTypeNonDegraded:int;
public var firstFiveMinutes:int;
public var needFastPass:Boolean;
public var pendingFlags:Number;
public var activeDenRoomInvId:int;
public var numLogins:int;
public var playerWallSettings:int;
public var worldMapRoomName:String;
public var avtDefsCached:Boolean;
private var _myUserName:String;
private var _userInfo:Object;
private var _perUserAvIdToUserName:Dictionary;
private var _myPerUserAvId:int;
private var _myUserVarCache:UserVarCache;
private var _avatarDefs:Object;
private var _customAvatarDefs:Object;
private var _denRoomDefs:Object;
private var _genericListDefsInfo:Object;
private var _myTradeList:Array;
private var _myPetsInDen:Array;
public function UserInfoCache()
{
super();
}
public function init() : void
{
this._userInfo = {};
this._myPerUserAvId = -1;
this._myUserName = "";
this.avtDefsCached = false;
this._myUserVarCache = new UserVarCache();
this._myUserVarCache.init();
this._perUserAvIdToUserName = new Dictionary(true);
this._avatarDefs = new Object();
this._customAvatarDefs = new Object();
this._genericListDefsInfo = new Object();
this._myTradeList = [];
}
public function destroy() : void
{
this._userInfo = null;
this._avatarDefs = null;
this._customAvatarDefs = null;
this._denRoomDefs = null;
this._genericListDefsInfo = null;
this._myTradeList = null;
}
public function getUserInfoByUserName(param1:String) : UserInfo
{
return this._userInfo[param1];
}
public function setUserInfoByUserName(param1:String, param2:UserInfo) : void
{
var _loc3_:UserInfo = null;
var _loc4_:AvatarInfo = null;
if(Boolean(param1) && param1 != "")
{
_loc3_ = this._userInfo[param1] = param2;
for each(_loc4_ in _loc3_.avList)
{
this._perUserAvIdToUserName[_loc4_.perUserAvId] = param1;
}
}
}
public function getAvatarInfoByUsernamePerUserAvId(param1:String, param2:int) : AvatarInfo
{
var _loc3_:UserInfo = null;
var _loc4_:AvatarInfo = null;
loop0:
for each(_loc3_ in this._userInfo)
{
var _loc7_:int = 0;
var _loc8_:* = _loc3_.avList;
do
{
for each(_loc4_ in _loc8_)
{
}
continue loop0;
}
while(!(_loc4_.userName.toLowerCase() == param1.toLowerCase() && _loc4_.perUserAvId == param2));
return _loc4_;
}
return null;
}
public function changeUserName(param1:String, param2:String, param3:int) : void
{
var _loc4_:UserInfo = null;
var _loc5_:AvatarInfo = null;
if(this._userInfo.hasOwnProperty(param1))
{
_loc4_ = this._userInfo[param1];
this._userInfo[param2] = _loc4_;
this._userInfo[param2].userName = param2;
this._userInfo[param2].userNameModeratedFlag = param3;
for each(_loc5_ in _loc4_.avList)
{
_loc5_.userName = param2;
this._perUserAvIdToUserName[_loc5_.perUserAvId] = param2;
}
delete this._userInfo[param1];
}
}
public function getAvatarInfoByUserName(param1:String) : AvatarInfo
{
param1 = param1;
if(this._userInfo.hasOwnProperty(param1))
{
return this._userInfo[param1].avList[this._userInfo[param1].currPerUserAvId];
}
return null;
}
public function getAvatarInfoByUserNameThenPerUserAvId(param1:String, param2:int) : AvatarInfo
{
var _loc3_:Object = null;
if(this._userInfo.hasOwnProperty(param1))
{
_loc3_ = this._userInfo[param1];
return this._userInfo[param1].avList[param2];
}
return null;
}
public function get myPerUserAvId() : int
{
return this._myPerUserAvId;
}
public function setCurrAvDbId(param1:String, param2:int) : void
{
if(this._userInfo.hasOwnProperty(param1))
{
this._userInfo[param1].currPerUserAvId = param2;
}
}
public function set myPerUserAvId(param1:int) : void
{
this._myPerUserAvId = param1;
if(this._userInfo.hasOwnProperty(this.myUserName) && Boolean(this._userInfo[this.myUserName]))
{
UserInfo(this._userInfo[this.myUserName]).currPerUserAvId = param1;
}
}
public function setAvatarInfoByUsernamePerUserAvId(param1:int, param2:AvatarInfo, param3:Boolean = false) : void
{
var _loc4_:String = param2.userName;
if(!this._userInfo.hasOwnProperty(_loc4_))
{
throw new Error("Invalid setAvatarInfo! Needs userName!");
}
this._userInfo[_loc4_].avList[param1] = param2;
if(param3)
{
this._userInfo[_loc4_].currPerUserAvId = param1;
this._perUserAvIdToUserName[param1] = _loc4_;
}
}
public function setAccountTypeByUserName(param1:String, param2:int) : void
{
param1 = param1.toLowerCase();
if(this._userInfo.hasOwnProperty(param1))
{
this._userInfo[param1].accountType = param2;
}
}
public function set playerAvatarInfo(param1:AvatarInfo) : void
{
this._myPerUserAvId = param1.perUserAvId;
this.myUserName = param1.userName;
var _loc2_:UserInfo = UserInfo(this._userInfo[this.myUserName]);
if(_loc2_)
{
_loc2_.avList[this._myPerUserAvId] = param1;
_loc2_.currPerUserAvId = this._myPerUserAvId;
}
}
public function get playerAvatarInfo() : AvatarInfo
{
try
{
return this._userInfo[this.myUserName].avList[this._myPerUserAvId];
}
catch(e:Error)
{
DebugUtility.debugTrace("Error trying to get playerAvatarInfo! msg:" + e.message);
}
return null;
}
public function get myUserName() : String
{
return this._myUserName;
}
public function set myUserName(param1:String) : void
{
this._myUserName = param1;
}
public function get playerUserInfo() : UserInfo
{
return this.getUserInfoByUserName(this.myUserName);
}
public function get userVarCache() : UserVarCache
{
return this._myUserVarCache;
}
public function get userNameModerated() : String
{
if(gMainFrame.clientInfo.userNameModerated > 0)
{
return this._myUserName;
}
return LocalizationManager.translateIdOnly(LocalizationManager.NEW_JAMMER_USERNAME);
}
public function setAvatarDefs(param1:Object) : void
{
this._avatarDefs = param1;
this.avtDefsCached = true;
}
public function setCustomAvatarDefs(param1:Object) : void
{
this._customAvatarDefs = param1;
}
public function getAvatarColorLayer1InfoByAvType(param1:uint) : uint
{
if(this._avatarDefs[param1])
{
return this._avatarDefs[param1].colorLayer1;
}
return 0;
}
public function getAvatarColorLayer2InfoByAvType(param1:uint) : uint
{
if(this._avatarDefs[param1])
{
return this._avatarDefs[param1].colorLayer2;
}
return 0;
}
public function getAvatarColorLayer3InfoByAvType(param1:uint) : uint
{
if(this._avatarDefs[param1])
{
return this._avatarDefs[param1].colorLayer3;
}
return 0;
}
public function getAvatarDefEyesInfoByAvType(param1:int) : uint
{
if(this._avatarDefs[param1])
{
return this._avatarDefs[param1].defEyes;
}
return 0;
}
public function getAvatarMemberInfoByAvType(param1:int) : Boolean
{
if(this._avatarDefs[param1])
{
return this._avatarDefs[param1].isMemOnly;
}
return false;
}
public function getAvatarEnviroTypeFlagByAvType(param1:int) : int
{
if(this._avatarDefs[param1])
{
return this._avatarDefs[param1].enviroTypeFlag;
}
return 0;
}
public function getAllCustomAvatarDefsByAvType(param1:int) : Array
{
var _loc3_:Object = null;
var _loc2_:Array = [];
for each(_loc3_ in this._customAvatarDefs)
{
if(_loc3_.avatarRefId == param1)
{
_loc2_.push(_loc3_);
}
}
return _loc2_;
}
public function getAvatarDefByAvType(param1:int, param2:Boolean) : Object
{
if(param2)
{
return this._customAvatarDefs[param1];
}
return this._avatarDefs[param1];
}
public function getAvatarDefByAvatar(param1:Avatar) : Object
{
if(param1)
{
if(param1.customAvId != -1)
{
return this._customAvatarDefs[param1.customAvId];
}
return this._avatarDefs[param1.avTypeId];
}
return null;
}
public function set denRoomDefs(param1:Object) : void
{
this._denRoomDefs = param1;
}
public function get denRoomDefs() : Object
{
return this._denRoomDefs;
}
public function getDenRoomDefByDefId(param1:int) : Object
{
return this._denRoomDefs[param1];
}
public function set genericListDefs(param1:Object) : void
{
this._genericListDefsInfo = param1;
}
public function getGenericListDefByDefId(param1:int) : Object
{
return this._genericListDefsInfo[param1];
}
public function getMyTradeList() : Array
{
return this._myTradeList;
}
public function set myTradeList(param1:Array) : void
{
this._myTradeList = param1;
}
public function removeFromMyTradeList(param1:int) : void
{
this._myTradeList.splice(param1,1);
}
public function set myPetsInDen(param1:Array) : void
{
this._myPetsInDen = param1;
}
public function get myPetsInDen() : Array
{
return this._myPetsInDen;
}
public function isPendingFlagSet(param1:int) : Boolean
{
return (this.pendingFlags & 1 << param1) != 0;
}
}
}
@@ -0,0 +1,102 @@
package avatar
{
public class UserVarCache
{
private var _cache:Object;
public function UserVarCache()
{
super();
}
public function init() : void
{
this._cache = new Object();
}
public function set playerUserVars(param1:Object) : void
{
var _loc2_:String = null;
this._cache = new Object();
for(_loc2_ in param1)
{
this._cache[_loc2_] = {
"value":param1[_loc2_].value,
"type":param1[_loc2_].type
};
}
}
public function get playerUserVars() : Object
{
return this._cache;
}
public function getUserVarValueById(param1:int) : Number
{
if(Boolean(this._cache) && Boolean(this._cache[param1]))
{
return this._cache[param1].value;
}
return -1;
}
public function getUserVarTypeById(param1:int) : int
{
if(Boolean(this._cache) && Boolean(this._cache[param1]))
{
return this._cache[param1].type;
}
return -1;
}
public function isBitSet(param1:int, param2:int) : Boolean
{
if(Boolean(this._cache) && Boolean(this._cache[param1]))
{
return Utility.areTwoAndedNumbersEqual(this._cache[param1].value,Utility.leftShiftNumbers(param2));
}
return false;
}
public function numBitsSet(param1:int, param2:int) : int
{
if(param1 == 0)
{
return 0;
}
var _loc3_:int = 0;
var _loc4_:int = 0;
while(_loc4_ < param2)
{
if(Utility.areTwoAndedNumbersEqual(param1,Utility.leftShiftNumbers(_loc4_)))
{
_loc3_++;
}
_loc4_++;
}
return _loc3_;
}
public function updateUserVar(param1:int, param2:Number, param3:int = -1) : void
{
if(!this._cache)
{
this._cache = new Object();
}
if(this._cache[param1])
{
this._cache[param1].value = param2;
}
else
{
this._cache[param1] = {
"value":param2,
"type":param3
};
}
}
}
}