mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 01:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,190 @@
|
||||
package item
|
||||
{
|
||||
import avatar.AccessoryState;
|
||||
|
||||
public class Inventory
|
||||
{
|
||||
|
||||
private var _itemArray:Array;
|
||||
|
||||
private var _accState:AccessoryState;
|
||||
|
||||
public function Inventory()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:AccessoryState) : void
|
||||
{
|
||||
_itemArray = [];
|
||||
_accState = param1;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(_itemArray)
|
||||
{
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _itemArray.length)
|
||||
{
|
||||
_itemArray[_loc1_].destroy();
|
||||
_loc1_++;
|
||||
}
|
||||
_itemArray = null;
|
||||
}
|
||||
if(_accState)
|
||||
{
|
||||
_accState.destroy();
|
||||
_accState = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function itemTypeMatch(param1:Item) : Boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function eraseAll() : void
|
||||
{
|
||||
_itemArray = [];
|
||||
}
|
||||
|
||||
public function clone(param1:Inventory) : void
|
||||
{
|
||||
_itemArray = [];
|
||||
_accState = param1._accState;
|
||||
var _loc2_:Array = param1._itemArray;
|
||||
for each(var _loc3_:Item in _loc2_)
|
||||
{
|
||||
addItem(_loc3_.clone());
|
||||
}
|
||||
}
|
||||
|
||||
public function addItem(param1:Item) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
if(_itemArray != null)
|
||||
{
|
||||
if(hasItem(param1))
|
||||
{
|
||||
_loc2_ = int(_itemArray.length);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc2_)
|
||||
{
|
||||
if(_itemArray[_loc3_].ifItemDiffers(param1))
|
||||
{
|
||||
updateItem(param1);
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_itemArray.push(param1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_itemArray.push(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeItem(param1:Item) : void
|
||||
{
|
||||
var _loc2_:int = getItemIndexInItemArray(param1.invIdx);
|
||||
if(_loc2_ >= 0)
|
||||
{
|
||||
_itemArray.splice(_loc2_,1);
|
||||
}
|
||||
}
|
||||
|
||||
private function updateItem(param1:Item) : void
|
||||
{
|
||||
var _loc2_:int = getItemIndexInItemArray(param1.invIdx);
|
||||
if(_loc2_ >= 0)
|
||||
{
|
||||
if(_accState != null)
|
||||
{
|
||||
_accState.replaceAccessory(_itemArray[_loc2_],param1);
|
||||
}
|
||||
_itemArray[_loc2_] = param1;
|
||||
return;
|
||||
}
|
||||
throw new Error("WARNING: Inventory- Cannot update an item that doesn\'t exist in inventory.");
|
||||
}
|
||||
|
||||
public function hasItem(param1:Item) : Boolean
|
||||
{
|
||||
if(getItemIndexInItemArray(param1.invIdx) >= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasItemByAccId(param1:int) : Boolean
|
||||
{
|
||||
return getItemIndexInItemArrayByAccId(param1) >= 0;
|
||||
}
|
||||
|
||||
public function get itemArray() : Array
|
||||
{
|
||||
return _itemArray;
|
||||
}
|
||||
|
||||
public function set itemArray(param1:Array) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
_itemArray = param1;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _itemArray.length)
|
||||
{
|
||||
_itemArray[_loc2_] = _itemArray[_loc2_].clone();
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get numItems() : int
|
||||
{
|
||||
return _itemArray.length;
|
||||
}
|
||||
|
||||
private function getItemIndexInItemArray(param1:int) : int
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:int = int(_itemArray.length);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc2_)
|
||||
{
|
||||
if(_itemArray[_loc3_].invIdx == param1)
|
||||
{
|
||||
return _loc3_;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private function getItemIndexInItemArrayByAccId(param1:int) : int
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _itemArray.length)
|
||||
{
|
||||
if(_itemArray[_loc2_].accId == param1)
|
||||
{
|
||||
return _loc2_;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,608 @@
|
||||
package item
|
||||
{
|
||||
import avatar.AvatarXtCommManager;
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import com.sbi.graphics.LayerBitmap;
|
||||
import currency.CombinedCurrencyItem;
|
||||
import diamond.DiamondXtCommManager;
|
||||
import flash.display.Sprite;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class Item
|
||||
{
|
||||
|
||||
public static const BODY_MOD_TYPE:int = 0;
|
||||
|
||||
public static const CLOTHING_TYPE:int = 1;
|
||||
|
||||
public static const BASE_LAYER:int = 1;
|
||||
|
||||
public static const PATTERN_LAYER:int = 2;
|
||||
|
||||
public static const EYE_LAYER:int = 3;
|
||||
|
||||
public static const TAIL_LAYER:int = 4;
|
||||
|
||||
public static const LEG_LAYER:int = 5;
|
||||
|
||||
public static const BACK_LAYER:int = 6;
|
||||
|
||||
public static const NECK_LAYER:int = 7;
|
||||
|
||||
public static const HEAD_LAYER_1:int = 8;
|
||||
|
||||
public static const HEAD_LAYER_2:int = 9;
|
||||
|
||||
public static const HEAD_LAYER_3:int = 10;
|
||||
|
||||
public static const OCEAN_LEG_LAYER:int = 8;
|
||||
|
||||
public static const OCEAN_BACK_LAYER:int = 6;
|
||||
|
||||
public static const OCEAN_HEAD_LAYER:int = 7;
|
||||
|
||||
public static const OCEAN_NECK_LAYER:int = 5;
|
||||
|
||||
public static const NUM_DETAILS_PER_ITEM:int = 11;
|
||||
|
||||
public static const NORMAL_ITEM:int = 0;
|
||||
|
||||
public static const NEW_ITEM:int = 1;
|
||||
|
||||
public static const SALE_ITEM:int = 2;
|
||||
|
||||
public static const CLEARANCE_ITEM:int = 3;
|
||||
|
||||
public static const RARE_ITEM:int = 4;
|
||||
|
||||
public static const COMBAT_TYPE_MELEE:int = 0;
|
||||
|
||||
public static const COMBAT_TYPE_RANGED:int = 1;
|
||||
|
||||
public static const MODIFIER_TYPE_NONE:int = 0;
|
||||
|
||||
public static const MODIFIER_TYPE_RANGED:int = 1;
|
||||
|
||||
public static const MODIFIER_TYPE_MELEE:int = 2;
|
||||
|
||||
public static const MODIFIER_TYPE_DEFENSE:int = 3;
|
||||
|
||||
public static const MODIFIER_TYPE_RESTORE:int = 4;
|
||||
|
||||
public var layerId:int;
|
||||
|
||||
public var invIdx:int;
|
||||
|
||||
public var accId:int;
|
||||
|
||||
public var color:uint;
|
||||
|
||||
public var name:String;
|
||||
|
||||
public var isGiftable:Boolean;
|
||||
|
||||
public var isMemberOnly:Boolean;
|
||||
|
||||
public var itemStatus:int;
|
||||
|
||||
public var type:int;
|
||||
|
||||
public var enviroType:int;
|
||||
|
||||
public var recycleValue:int;
|
||||
|
||||
public var currencyType:int;
|
||||
|
||||
public var avatarUseFlag:Object;
|
||||
|
||||
public var endTime:uint;
|
||||
|
||||
public var colors:Array;
|
||||
|
||||
private var _inUseFlagLand:Number;
|
||||
|
||||
private var _inUseFlagOcean:Number;
|
||||
|
||||
private var _value:int;
|
||||
|
||||
private var _diamondDefId:int = -1;
|
||||
|
||||
private var _defId:int;
|
||||
|
||||
private var _icon:Sprite;
|
||||
|
||||
private var _iconHelper:SimpleIcon;
|
||||
|
||||
private var _iconBitmap:LayerBitmap;
|
||||
|
||||
private var _largeIcon:Sprite;
|
||||
|
||||
private var _largeIconHelper:SimpleIcon;
|
||||
|
||||
private var _largeIconBitmap:LayerBitmap;
|
||||
|
||||
private var _isShopItem:Boolean;
|
||||
|
||||
public var isIconLoaded:Boolean;
|
||||
|
||||
public var imageLoadedCallback:Function;
|
||||
|
||||
private var _iconLayerID:int = -1;
|
||||
|
||||
private var _iconColorID:int = 0;
|
||||
|
||||
private var _attackMediaRefId:int = 0;
|
||||
|
||||
private var _defense:int = 0;
|
||||
|
||||
private var _attack:int = 0;
|
||||
|
||||
private var _combatType:int = 0;
|
||||
|
||||
private var _fierce:int = 0;
|
||||
|
||||
private var _modifierType:int = 0;
|
||||
|
||||
private var _modifierValue:int = 0;
|
||||
|
||||
private var _combinedCurrencyItem:CombinedCurrencyItem;
|
||||
|
||||
public function Item()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:int, param2:int = 0, param3:uint = 0, param4:Number = 0, param5:Number = 0, param6:Boolean = false, param7:uint = 0) : void
|
||||
{
|
||||
_defId = param1;
|
||||
invIdx = param2;
|
||||
color = param3;
|
||||
_inUseFlagLand = param4;
|
||||
_inUseFlagOcean = param5;
|
||||
_isShopItem = param6;
|
||||
endTime = param7;
|
||||
var _loc8_:Object = ItemXtCommManager.getItemDef(param1);
|
||||
if(_loc8_ == null)
|
||||
{
|
||||
DebugUtility.debugTrace("Item.init got invalid itemDefId? defId:" + param1,16711680);
|
||||
}
|
||||
layerId = _loc8_.layerId;
|
||||
accId = _loc8_.accId;
|
||||
name = _loc8_.name;
|
||||
isGiftable = _loc8_.isGiftable;
|
||||
type = _loc8_.type;
|
||||
isMemberOnly = _loc8_.isMembersOnly;
|
||||
itemStatus = _loc8_.itemStatus;
|
||||
_value = isOnSale ? _loc8_.cost * 0.5 : _loc8_.cost;
|
||||
enviroType = _loc8_.enviroType;
|
||||
recycleValue = _loc8_.recycleValue == 0 ? _loc8_.cost * gMainFrame.clientInfo.recyclePercentage : _loc8_.recycleValue;
|
||||
currencyType = _loc8_.currencyType;
|
||||
avatarUseFlag = _loc8_.avatarUseFlag;
|
||||
colors = _loc8_.colors;
|
||||
_attackMediaRefId = _loc8_.attackMediaRefId;
|
||||
_defense = _loc8_.defense;
|
||||
_attack = _loc8_.attack;
|
||||
_combatType = _loc8_.combatType;
|
||||
_fierce = _loc8_.criticalHit;
|
||||
_modifierType = _loc8_.modifierType;
|
||||
_modifierValue = _loc8_.modifierValue;
|
||||
_diamondDefId = DiamondXtCommManager.getDiamondDefIdByRefId(_loc8_.defId,0);
|
||||
if(currencyType == 100)
|
||||
{
|
||||
_combinedCurrencyItem = new CombinedCurrencyItem(_loc8_.combinedCurrencyString);
|
||||
}
|
||||
isIconLoaded = false;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_iconHelper)
|
||||
{
|
||||
_iconHelper.destroy();
|
||||
_iconHelper = null;
|
||||
}
|
||||
if(_iconBitmap)
|
||||
{
|
||||
_iconBitmap.release();
|
||||
_iconBitmap = null;
|
||||
}
|
||||
if(_largeIconHelper)
|
||||
{
|
||||
_largeIconHelper.destroy();
|
||||
_largeIconHelper = null;
|
||||
}
|
||||
if(_largeIconBitmap)
|
||||
{
|
||||
_largeIconBitmap.release();
|
||||
_largeIconBitmap = null;
|
||||
}
|
||||
if(_icon)
|
||||
{
|
||||
_icon = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function ifItemDiffers(param1:Item) : Boolean
|
||||
{
|
||||
if(_defId == param1.defId)
|
||||
{
|
||||
if(_inUseFlagLand != param1._inUseFlagLand || _inUseFlagOcean != param1._inUseFlagOcean || value != param1.value || color != param1.color || name != param1.name || isGiftable != param1.isGiftable || type != param1.type || layerId != param1.layerId || accId != param1.accId || isMemberOnly != param1.isMemberOnly || isNew != param1.isNew || isOnSale != param1.isOnSale || recycleValue != param1.recycleValue || currencyType != param1.currencyType || endTime != param1.endTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function clone() : Item
|
||||
{
|
||||
var _loc1_:Item = new Item();
|
||||
_loc1_.init(_defId,invIdx,color,_inUseFlagLand,_inUseFlagOcean,_isShopItem,endTime);
|
||||
if(diamondDefId != -1)
|
||||
{
|
||||
_loc1_.diamondDefId = diamondDefId;
|
||||
_loc1_.value = value;
|
||||
_loc1_.currencyType = currencyType;
|
||||
_loc1_.endTime = endTime;
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
public function makeSmallIcon() : void
|
||||
{
|
||||
if(accId == 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
isIconLoaded = false;
|
||||
_icon = new Sprite();
|
||||
_iconBitmap = new LayerBitmap();
|
||||
_iconHelper = new SimpleIcon();
|
||||
_iconHelper.init(_iconBitmap,color,accId,1,_isShopItem,false,smallIconReceived);
|
||||
}
|
||||
|
||||
public function makeLargeIcon() : void
|
||||
{
|
||||
if(accId == 3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
isIconLoaded = false;
|
||||
_largeIcon = new Sprite();
|
||||
_largeIconBitmap = new LayerBitmap();
|
||||
_largeIconHelper = new SimpleIcon();
|
||||
_largeIconHelper.init(_largeIconBitmap,color,accId,1,_isShopItem,false,largeIconReceived);
|
||||
}
|
||||
|
||||
private function smallIconReceived() : void
|
||||
{
|
||||
_icon.addChild(_iconBitmap);
|
||||
resizeAndPositionIcon(false);
|
||||
isIconLoaded = true;
|
||||
if(_iconLayerID >= 0)
|
||||
{
|
||||
LayerBitmap(_icon.getChildAt(0)).setLayerColor(_iconLayerID,_iconColorID);
|
||||
LayerBitmap(_icon.getChildAt(0)).paint(0);
|
||||
_iconLayerID = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private function largeIconReceived() : void
|
||||
{
|
||||
_largeIcon.addChild(_largeIconBitmap);
|
||||
resizeAndPositionIcon(true);
|
||||
isIconLoaded = true;
|
||||
}
|
||||
|
||||
public function setIconColor(param1:int, param2:uint) : void
|
||||
{
|
||||
if(_icon && _icon.getChildAt(0))
|
||||
{
|
||||
LayerBitmap(_icon.getChildAt(0)).setLayerColor(param1,param2);
|
||||
LayerBitmap(_icon.getChildAt(0)).paint(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_iconLayerID = param1;
|
||||
_iconColorID = param2;
|
||||
}
|
||||
}
|
||||
|
||||
public function resizeAndPositionIcon(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
if(_isShopItem)
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_loc2_ = 1;
|
||||
_largeIcon.width *= _loc2_;
|
||||
_largeIcon.height *= _loc2_;
|
||||
_largeIcon.x = -(_largeIcon.width * 0.5);
|
||||
_largeIcon.y = -(_largeIcon.height * 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = 0.6;
|
||||
_icon.width *= _loc2_;
|
||||
_icon.height *= _loc2_;
|
||||
_icon.x = -(_icon.width * 0.5);
|
||||
_icon.y = -(_icon.height * 0.5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = 0.75;
|
||||
_icon.width *= _loc2_;
|
||||
_icon.height *= _loc2_;
|
||||
_icon.x = -(_icon.width * 0.5);
|
||||
_icon.y = -(_icon.height * 0.5);
|
||||
}
|
||||
if(imageLoadedCallback != null)
|
||||
{
|
||||
imageLoadedCallback();
|
||||
}
|
||||
}
|
||||
|
||||
public function get inUseFlagLand() : Number
|
||||
{
|
||||
return _inUseFlagLand;
|
||||
}
|
||||
|
||||
public function set inUseFlagLand(param1:Number) : void
|
||||
{
|
||||
_inUseFlagLand = param1;
|
||||
}
|
||||
|
||||
public function get inUseFlagOcean() : Number
|
||||
{
|
||||
return _inUseFlagOcean;
|
||||
}
|
||||
|
||||
public function set inUseFlagOcean(param1:Number) : void
|
||||
{
|
||||
_inUseFlagOcean = param1;
|
||||
}
|
||||
|
||||
public function get diamondDefId() : int
|
||||
{
|
||||
return _diamondDefId;
|
||||
}
|
||||
|
||||
public function set diamondDefId(param1:int) : void
|
||||
{
|
||||
_diamondDefId = param1;
|
||||
}
|
||||
|
||||
public function get defId() : int
|
||||
{
|
||||
return _defId;
|
||||
}
|
||||
|
||||
public function set defId(param1:int) : void
|
||||
{
|
||||
_defId = param1;
|
||||
}
|
||||
|
||||
public function get itemDefId() : int
|
||||
{
|
||||
return _defId;
|
||||
}
|
||||
|
||||
public function get icon() : Sprite
|
||||
{
|
||||
if(!_icon)
|
||||
{
|
||||
makeSmallIcon();
|
||||
}
|
||||
return _icon;
|
||||
}
|
||||
|
||||
public function get largeIcon() : Sprite
|
||||
{
|
||||
if(!_largeIcon)
|
||||
{
|
||||
makeLargeIcon();
|
||||
}
|
||||
return _largeIcon;
|
||||
}
|
||||
|
||||
public function get isOnSale() : Boolean
|
||||
{
|
||||
return itemStatus == 2;
|
||||
}
|
||||
|
||||
public function get isOnClearance() : Boolean
|
||||
{
|
||||
return itemStatus == 3;
|
||||
}
|
||||
|
||||
public function get isRare() : Boolean
|
||||
{
|
||||
return itemStatus == 4;
|
||||
}
|
||||
|
||||
public function get isNew() : Boolean
|
||||
{
|
||||
return itemStatus == 1;
|
||||
}
|
||||
|
||||
public function get isOcean() : Boolean
|
||||
{
|
||||
return enviroType == 1;
|
||||
}
|
||||
|
||||
public function get isLand() : Boolean
|
||||
{
|
||||
return enviroType == 0;
|
||||
}
|
||||
|
||||
public function get isDiamond() : Boolean
|
||||
{
|
||||
return _diamondDefId != -1;
|
||||
}
|
||||
|
||||
public function get isRareDiamond() : Boolean
|
||||
{
|
||||
return isRare && isDiamond;
|
||||
}
|
||||
|
||||
public function get attackMediaRefId() : int
|
||||
{
|
||||
return _attackMediaRefId;
|
||||
}
|
||||
|
||||
public function get defense() : int
|
||||
{
|
||||
return _defense;
|
||||
}
|
||||
|
||||
public function get attack() : int
|
||||
{
|
||||
return _attack;
|
||||
}
|
||||
|
||||
public function get combatType() : int
|
||||
{
|
||||
return _combatType;
|
||||
}
|
||||
|
||||
public function get modifierType() : int
|
||||
{
|
||||
return _modifierType;
|
||||
}
|
||||
|
||||
public function get modifierValue() : int
|
||||
{
|
||||
return _modifierValue;
|
||||
}
|
||||
|
||||
public function get fierceAttack() : int
|
||||
{
|
||||
return _fierce;
|
||||
}
|
||||
|
||||
public function get extraTooltipInfo() : String
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getInUse(param1:int) : Boolean
|
||||
{
|
||||
var _loc4_:* = 0;
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc2_:Number = NaN;
|
||||
if(_inUseFlagLand != -1 && _inUseFlagOcean != -1)
|
||||
{
|
||||
if(AvatarXtCommManager.avSlotInfo[param1])
|
||||
{
|
||||
_loc4_ = uint(AvatarXtCommManager.avSlotInfo[param1].avInvId);
|
||||
_loc3_ = Utility.leftShiftNumbers(_loc4_);
|
||||
if(enviroType == 0)
|
||||
{
|
||||
_loc2_ = _inUseFlagLand;
|
||||
if(Utility.bitwiseAnd(_loc2_,_loc3_) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = _inUseFlagOcean;
|
||||
if(Utility.bitwiseAnd(_loc2_,_loc3_) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setInUse(param1:int, param2:Boolean) : void
|
||||
{
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc3_:Number = NaN;
|
||||
if(AvatarXtCommManager.avSlotInfo[param1])
|
||||
{
|
||||
_loc5_ = Number(AvatarXtCommManager.avSlotInfo[param1].avInvId);
|
||||
_loc4_ = Utility.leftShiftNumbers(_loc5_);
|
||||
if(param2)
|
||||
{
|
||||
if(enviroType == 0)
|
||||
{
|
||||
_loc3_ = _inUseFlagLand;
|
||||
_loc3_ = Utility.bitwiseOr(_loc3_,_loc4_);
|
||||
_inUseFlagLand = _loc3_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _inUseFlagOcean;
|
||||
_loc3_ = Utility.bitwiseOr(_loc3_,_loc4_);
|
||||
_inUseFlagOcean = _loc3_;
|
||||
}
|
||||
}
|
||||
else if(enviroType == 0)
|
||||
{
|
||||
_loc3_ = _inUseFlagLand;
|
||||
_loc3_ = Utility.bitwiseAnd(_loc3_,Utility.bitwiseNot(_loc4_));
|
||||
_inUseFlagLand = _loc3_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _inUseFlagOcean;
|
||||
_loc3_ = Utility.bitwiseAnd(_loc3_,Utility.bitwiseNot(_loc4_));
|
||||
_inUseFlagOcean = _loc3_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get combinedCurrencyItem() : CombinedCurrencyItem
|
||||
{
|
||||
return _combinedCurrencyItem;
|
||||
}
|
||||
|
||||
public function set value(param1:int) : void
|
||||
{
|
||||
_value = param1;
|
||||
}
|
||||
|
||||
public function get sincleCurrencyCost() : int
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
public function get value() : *
|
||||
{
|
||||
if(currencyType == 100)
|
||||
{
|
||||
return _combinedCurrencyItem;
|
||||
}
|
||||
return _value;
|
||||
}
|
||||
|
||||
public function get sortIdString() : String
|
||||
{
|
||||
switch(layerId - 4)
|
||||
{
|
||||
case 0:
|
||||
return LocalizationManager.translateIdOnly(11209).toLowerCase();
|
||||
case 1:
|
||||
return LocalizationManager.translateIdOnly(11208).toLowerCase();
|
||||
case 2:
|
||||
return LocalizationManager.translateIdOnly(11207).toLowerCase();
|
||||
case 3:
|
||||
return LocalizationManager.translateIdOnly(11206).toLowerCase();
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
return LocalizationManager.translateIdOnly(11205).toLowerCase();
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,108 @@
|
||||
package item
|
||||
{
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import com.sbi.graphics.ImageArrayHelper;
|
||||
import com.sbi.graphics.LayerBitmap;
|
||||
import com.sbi.loader.ImageServerEvent;
|
||||
import com.sbi.loader.ImageServerURL;
|
||||
|
||||
public class SimpleIcon
|
||||
{
|
||||
|
||||
public static const GLOBAL_ANIM_FPS:int = 24;
|
||||
|
||||
public static const THROTTLE_FRAME_UPDATES:int = 4;
|
||||
|
||||
public static const ANIM_ICON:int = 18;
|
||||
|
||||
public static const AN_ICON_L:int = 25;
|
||||
|
||||
public static const AN_ICON_S:int = 26;
|
||||
|
||||
private var _bitmap:LayerBitmap;
|
||||
|
||||
private var _color:uint;
|
||||
|
||||
private var _accId:int;
|
||||
|
||||
private var _state:int;
|
||||
|
||||
private var _avatarType:int;
|
||||
|
||||
private var _currImageData:Object;
|
||||
|
||||
private var _hflip:Boolean;
|
||||
|
||||
private var _wasNull:Boolean;
|
||||
|
||||
private var _holdDraw:Boolean;
|
||||
|
||||
private var _callBack:Function;
|
||||
|
||||
private var _expectingNewData:uint;
|
||||
|
||||
private var _anIconId:int;
|
||||
|
||||
public function SimpleIcon()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:LayerBitmap, param2:uint, param3:int, param4:int, param5:Boolean = false, param6:Boolean = false, param7:Function = null) : void
|
||||
{
|
||||
_bitmap = param1;
|
||||
_color = param2;
|
||||
_accId = param3;
|
||||
_hflip = param6;
|
||||
_callBack = param7;
|
||||
_avatarType = param4;
|
||||
_anIconId = param5 ? 25 : 26;
|
||||
_expectingNewData = 4294967295;
|
||||
_currImageData = null;
|
||||
ImageServerURL.instance.addEventListener("OnNewData",handleIconData,false,0,true);
|
||||
paint();
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
ImageServerURL.instance.removeEventListener("OnNewData",handleIconData);
|
||||
}
|
||||
|
||||
public function paint() : void
|
||||
{
|
||||
_expectingNewData = ImageArrayHelper.packId(_avatarType,_anIconId,_accId);
|
||||
ImageServerURL.instance.requestImage(_expectingNewData);
|
||||
}
|
||||
|
||||
private function handleIconData(param1:ImageServerEvent) : void
|
||||
{
|
||||
if(param1.id != _expectingNewData)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param1.success)
|
||||
{
|
||||
_currImageData = param1.imageData;
|
||||
_bitmap.setLayer(param1.layer,_currImageData,_color);
|
||||
_expectingNewData = 4294967295;
|
||||
drawFrame();
|
||||
}
|
||||
}
|
||||
|
||||
private function drawFrame() : void
|
||||
{
|
||||
if(!_currImageData || _currImageData.length == 0)
|
||||
{
|
||||
DebugUtility.debugTrace("Icon skipping drawFrame due to invalid _currImageData:" + _currImageData + " _currImageData.length:" + _currImageData.length);
|
||||
return;
|
||||
}
|
||||
_bitmap.paint(0,_hflip);
|
||||
if(_callBack != null)
|
||||
{
|
||||
_callBack();
|
||||
_callBack = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user