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,184 @@
package gui.itemWindows
{
import avatar.AvatarInfo;
import avatar.AvatarManager;
import avatar.UserCommXtCommManager;
import com.sbi.popup.SBOkPopup;
import flash.display.MovieClip;
import gui.AdventureExpertPopup;
import gui.GuiManager;
import gui.UpsellManager;
import localization.LocalizationManager;
import pet.PetManager;
import quest.QuestManager;
import quest.QuestXtCommManager;
import room.RoomXtCommManager;
public class ItemWindowAdventure extends ItemWindowBase
{
private var _scriptDef:Object;
public function ItemWindowAdventure(param1:Function, param2:MovieClip, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_scriptDef = QuestXtCommManager.getScriptDef(param9.scriptIds[param4]);
super(_scriptDef.bannerMediaRefId,param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
}
}
override protected function setChildrenAndInitialConditions() : void
{
var _loc1_:AvatarInfo = null;
_window.txt.mouseEnabled = false;
_window.txt.mouseChildren = false;
LocalizationManager.translateId(_window.txt.titleTxt,_scriptDef.titleStrId);
if(_window["memLock"])
{
_window["memLock"].visible = _scriptDef.membersOnly;
_window["memLock"].mouseEnabled = false;
_window["memLock"].mouseChildren = false;
_loc1_ = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
if(_loc1_)
{
if(_loc1_.questLevel < _scriptDef.levelMin)
{
_window.tag.visible = false;
}
}
}
if(_scriptDef.defId == 21)
{
_window.tag.visible = false;
}
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener("rollOver",_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener("rollOut",_mouseOut,false,0,true);
}
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
{
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
}
}
}
public function performContinueChecks() : Object
{
var _loc1_:AvatarInfo = null;
var _loc2_:Object = null;
if(QuestManager.isInPrivateAdventureState)
{
QuestManager.showLeaveQuestLobbyPopup(performContinueChecks);
return null;
}
if(AvatarManager.isMyUserInCustomPVPState())
{
UserCommXtCommManager.sendCustomPVPMessage(false,0);
}
if(!RoomXtCommManager.isSwitching)
{
if(_scriptDef.membersOnly && !gMainFrame.userInfo.isMember)
{
UpsellManager.displayPopup("adventures","adventure/" + _scriptDef.defId);
return null;
}
_loc1_ = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
if(_loc1_)
{
if(_scriptDef.playAsPet)
{
_loc2_ = PetManager.myActivePet;
if(!_loc2_)
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19656));
return null;
}
if(!PetManager.canPetGoInEnviroType(_loc2_.currPetDef,_loc2_.createdTs,_scriptDef.avatarType))
{
switch(_scriptDef.avatarType)
{
case 1:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19648));
break;
case 2:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19649));
break;
case 4:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19650));
break;
case 5:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19655));
}
return null;
}
}
else
{
if(AvatarManager.playerAvatar && !AvatarManager.isValidEnviro(_scriptDef.avatarType))
{
switch(_scriptDef.avatarType)
{
case 1:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(15706));
break;
case 2:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(18476));
break;
case 4:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(18475));
break;
case 5:
}
return null;
}
if(_loc1_.questLevel < _scriptDef.levelMin)
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdAndInsertOnly(14697,_scriptDef.levelMin));
return null;
}
if(_scriptDef.avatarLimit == 1 && _window.tag.visible)
{
return {
"func":QuestXtCommManager.sendQuestCreateJoinPublic,
"defId":_scriptDef.defId
};
}
}
if(_window.tag.visible)
{
return {
"func":AdventureExpertPopup.init,
"defId":_scriptDef.defId
};
}
return null;
}
return null;
}
return null;
}
}
}
@@ -0,0 +1,542 @@
package gui.itemWindows
{
import avatar.Avatar;
import avatar.AvatarInfo;
import avatar.AvatarManager;
import avatar.AvatarSwitch;
import avatar.AvatarUtility;
import avatar.AvatarView;
import com.sbi.graphics.LayerAnim;
import den.DenRoomItem;
import flash.display.MovieClip;
import flash.geom.Point;
import gui.DenSwitch;
import gui.LoadingSpiral;
import localization.LocalizationManager;
public class ItemWindowAnimal extends ItemWindowBase
{
private const COST_OF_NEW_ANIMAL:int = 1000;
private const SLOTS_PER_NONMEMBER:int = 2;
private var _isChoosing:Boolean;
private var _isAnimal:Boolean;
private var _recyclingOnly:Boolean;
private var _addGrayChild:Boolean;
private var _isChoosingOcean:Boolean;
private var _ai:AvatarInfo;
private var _nameBarData:int;
private var _hasAddedEventListeners:Boolean;
private var _avtView:AvatarView;
private var _loadingSpiral:LoadingSpiral;
private var _numNonMemberOceanOnlyAvatars:int;
private var _numNonMemberAvatars:int;
private var _isRecycling:Function;
private var _fromDeletion:Boolean;
private var _ignoreEnviroType:Boolean;
public function ItemWindowAnimal(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_isChoosing = param9.isChoosing;
_isAnimal = param9.isAnimal;
_recyclingOnly = param9.recylingOnly;
_isChoosingOcean = param9.isChoosingOcean;
_nameBarData = param9.nameBarData;
if(_isAnimal)
{
_numNonMemberAvatars = param9.numNonMemberAvatars;
_numNonMemberOceanOnlyAvatars = param9.numNonMemberOceanOnlyAvatars;
_isRecycling = param9.isRecycling;
_ignoreEnviroType = param9.ignoreEnviroType;
}
super("amlCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get aml() : MovieClip
{
return _window.aml;
}
public function get makeNew() : MovieClip
{
return _window.makeNew;
}
public function get recycle() : MovieClip
{
return _window.recycle;
}
public function get denWindow() : MovieClip
{
return _window.den;
}
public function get lock() : MovieClip
{
return _window.lock;
}
public function get gray() : MovieClip
{
return _window.gray;
}
public function get checkbox() : MovieClip
{
return _window.checkbox;
}
public function get buyDen() : MovieClip
{
return _window.buyDen;
}
public function set currItem(param1:DenRoomItem) : void
{
_currItem = param1;
}
public function get level() : int
{
return _ai ? _ai.questLevel : 0;
}
public function isUsable() : Boolean
{
if(AvatarSwitch.avatars[_index] == null)
{
return true;
}
return false;
}
public function removeLoadedItem() : void
{
_fromDeletion = true;
if(_avtView)
{
_avtView.destroy();
_avtView = null;
}
while(aml.amlMask.amlBox.numChildren > 0)
{
aml.amlMask.amlBox.removeChildAt(0);
}
while(gray.amlMask.amlBox.numChildren > 0)
{
gray.amlMask.amlBox.removeChildAt(0);
}
resetWindow(index);
_fromDeletion = false;
}
public function resetWindow(param1:int) : void
{
if(_isAnimal)
{
_window.makeNew.visible = true;
_window.priceTag.visible = false;
_window.buy.visible = false;
_window.lock.visible = false;
_window.aml.visible = false;
_window.aml.sel.visible = false;
_window.recycle.visible = false;
_window.gray.visible = false;
_window.lock.visible = false;
_window.makeNew.newAmlBtn.gray.visible = false;
_window.xpShape.visible = false;
AvatarSwitch.numOpenNonMemberSlots--;
_isCurrItemLoaded = false;
loadCurrItem();
}
else
{
if(param1 > 0)
{
while(_window.den.itemBlock.numChildren > 0)
{
_window.den.itemBlock.removeChildAt(0);
}
}
_window.buyDen.visible = true;
_window.den.visible = false;
_window.priceTag.visible = false;
_window.buy.visible = false;
_window.lock.visible = false;
_window.aml.visible = false;
_window.aml.sel.visible = false;
_window.recycle.visible = false;
_window.gray.visible = false;
}
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
if(!_hasAddedEventListeners && (_isChoosing || _isChoosingOcean))
{
addEventListeners();
}
super.onWindowLoadCallback();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
var _loc4_:int = 0;
var _loc3_:Avatar = null;
_itemYLocation = param1;
_itemXLocation = param2;
if(!_hasAddedEventListeners)
{
addEventListeners();
}
if(_isAnimal)
{
if(!_isCurrItemLoaded)
{
_loc4_ = 1000;
_window.gray.grayDen.visible = false;
_window.aml.bg.visible = true;
_window.aml.gray.visible = false;
_window.aml.nameTxt.visible = true;
_window.priceTag.txt.text = 1000;
_window.aml.visible = true;
if(AvatarSwitch.avatars[_index] != null && !_fromDeletion)
{
_loc3_ = AvatarSwitch.avatars[_index];
_loc3_ = AvatarUtility.generateNew(_loc3_.perUserAvId,_loc3_,_loc3_.userName,_loc3_.sfsUserId,AvatarManager.roomEnviroType,null,false,_ignoreEnviroType);
_avtView = new AvatarView();
_avtView.init(_loc3_,null,null,false,_ignoreEnviroType);
_avtView.visible = false;
_avtView.playAnim(13,false,1,onViewLoaded);
if(AvatarSwitch.isSlotAvailable(_index) || _isChoosing)
{
_loadingSpiral = new LoadingSpiral(_window.aml.amlMask.amlBox.addChild(_avtView));
_window.priceTag.visible = false;
_window.buy.visible = false;
_window.makeNew.visible = false;
_window.lock.visible = false;
_window.aml.visible = true;
_window.aml.sel.visible = false;
_window.aml.nameTxt.text = _loc3_.avName;
if(_isChoosing)
{
_window.checkbox.visible = true;
_window.checkbox.check.visible = false;
_window.aml.bg.visible = false;
_window.aml.gray.visible = true;
if(_numNonMemberAvatars > 0 && _numNonMemberAvatars < 3)
{
if(!AvatarSwitch.isMemberOnlyAvatar(_index))
{
_window.checkbox.check.visible = false;
}
}
if(_numNonMemberAvatars - _numNonMemberOceanOnlyAvatars < 1 || _numNonMemberAvatars <= _loc4_ && AvatarSwitch.isMemberOnlyAvatar(_index))
{
_window.aml.visible = false;
_window.gray.visible = true;
_window.lock.visible = true;
_window.checkbox.visible = false;
_window.gray.nameTxt.text = _loc3_.avName;
_addGrayChild = true;
}
}
if(_index == AvatarSwitch.activeAvatarIdx)
{
_window.aml.sel.visible = true;
}
while(_window.xpShape.numChildren > 0)
{
_window.xpShape.removeChildAt(0);
}
if(_isChoosing)
{
if(!gMainFrame.userInfo.isMember && !AvatarSwitch.isMemberOnlyAvatar(_index))
{
AvatarSwitch.numOpenNonMemberSlots++;
}
}
else
{
AvatarSwitch.numOpenNonMemberSlots++;
}
}
else
{
_window.aml.visible = false;
_window.gray.visible = true;
_window.gray.nameTxt.text = _loc3_.avName;
_addGrayChild = true;
_window.gray.amlMask.amlBox.addChild(_avtView);
}
if(Utility.isOcean(_avtView.avatarData.enviroTypeFlag))
{
if(Utility.isLand(_avtView.avatarData.enviroTypeFlag))
{
if(_window.aml.visible)
{
if(_window.aml.gray.visible)
{
_window.aml.gray.gotoAndStop(3);
}
else
{
_window.aml.bg.gotoAndStop(3);
}
}
else
{
_window.gray.grayAml.gotoAndStop(3);
}
}
else if(_window.aml.visible)
{
if(_window.aml.gray.visible)
{
_window.aml.gray.gotoAndStop(2);
}
else
{
_window.aml.bg.gotoAndStop(2);
}
}
else
{
_window.gray.grayAml.gotoAndStop(2);
}
}
_window.recycle.visible = _isRecycling();
}
else
{
if(!gMainFrame.userInfo.isMember)
{
if(AvatarSwitch.numOpenNonMemberSlots < 2 || _isChoosing && _numNonMemberAvatars - _numNonMemberOceanOnlyAvatars < 1)
{
AvatarSwitch.numOpenNonMemberSlots++;
_window.makeNew.visible = true;
_window.lock.visible = false;
}
else
{
_window.makeNew.visible = false;
_window.lock.visible = true;
}
}
else
{
_window.makeNew.visible = true;
_window.lock.visible = false;
}
_window.priceTag.visible = false;
_window.buy.visible = false;
_window.aml.visible = false;
_window.aml.sel.visible = false;
_window.recycle.visible = false;
if(_isChoosing && _numNonMemberAvatars > 1 && _numNonMemberAvatars - _numNonMemberOceanOnlyAvatars > 0)
{
_window.makeNew.newAmlBtn.gray.visible = true;
}
else
{
_window.makeNew.newAmlBtn.gray.visible = false;
}
_isCurrItemLoaded = true;
}
}
}
else if(_currItem != null)
{
if(!_isCurrItemLoaded)
{
_isCurrItemLoaded = true;
_window.den.sel.visible = false;
if(gMainFrame.userInfo.isMember)
{
_window.den.visible = true;
LocalizationManager.updateToFit(_window.den.txt,_currItem.name,false,false,false);
}
else if(_currItem.isMemberOnly)
{
_addGrayChild = true;
_window.den.visible = false;
_window.gray.visible = true;
LocalizationManager.updateToFit(_window.gray.nameTxt,_currItem.name,false,false,false);
}
else
{
_window.den.visible = true;
LocalizationManager.updateToFit(_window.den.txt,_currItem.name,false,false,false);
}
if(_currItem.isLand)
{
_window.den.greenBG.visible = true;
}
else
{
_window.den.greenBG.visible = false;
}
if(_index == DenSwitch.activeDenIdx)
{
_window.den.sel.visible = true;
}
_window.buyDen.visible = false;
if(_recyclingOnly)
{
_window.recycle.visible = true;
}
}
}
else
{
_window.den.visible = false;
_window.buyDen.visible = true;
}
if(_currItem && _avtView && !_isCurrItemLoaded && _isAnimal)
{
_isCurrItemLoaded = true;
if(_addGrayChild)
{
_window.gray.amlMask.amlBox.addChild(_avtView);
}
else
{
_window.aml.amlMask.amlBox.addChild(_avtView);
}
}
}
private function loadQuestShape() : void
{
var _loc1_:String = _window.xpShape.currentLabels[Utility.getColorId(_nameBarData) - 1].name;
_window.xpShape.visible = true;
if(_loc1_ == "black")
{
_window.xpShape.gotoAndStop(2);
_window.xpShape.gotoAndStop(_loc1_);
}
if(_window.xpShape.currentFrameLabel != _loc1_)
{
_window.xpShape.gotoAndStop(_loc1_);
}
Utility.createXpShape(_ai.questLevel,true,_window.xpShape[_loc1_].mouse.up.icon,null,_nameBarData);
}
override public function destroy() : void
{
AvatarSwitch.numOpenNonMemberSlots = 0;
if(_avtView)
{
_avtView.destroy();
_avtView = null;
}
if(_loadingSpiral)
{
_loadingSpiral.destroy();
_loadingSpiral = null;
}
if(_isAnimal)
{
_currItem = null;
}
super.destroy();
}
override protected function setChildrenAndInitialConditions() : void
{
_window.priceTag.visible = false;
_window.priceTag.txt.textColor = "0x386630";
_window.buy.visible = false;
_window.makeNew.visible = false;
_window.lock.visible = false;
_window.recycle.visible = false;
_window.den.visible = false;
_window.buyDen.visible = false;
_window.xpShape.visible = false;
if(_isAnimal)
{
_window.aml.visible = true;
_window.aml.bg.visible = false;
_window.aml.gray.visible = true;
_window.aml.sel.visible = false;
_window.aml.nameTxt.visible = false;
}
else
{
_window.aml.visible = false;
}
_window.gray.visible = false;
_window.buyDen.buyBtn.gray.visible = false;
_window.buy.buyAmlBtn.gray.visible = false;
_window.makeNew.newAmlBtn.gray.visible = false;
_window.checkbox.visible = false;
}
override protected function addEventListeners() : void
{
_hasAddedEventListeners = true;
if(_window)
{
if(_mouseDown != null)
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener("rollOver",_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener("rollOut",_mouseOut,false,0,true);
}
if(_memberOnlyDown != null)
{
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
}
}
}
private function onViewLoaded(param1:LayerAnim, param2:int) : void
{
var _loc3_:Point = null;
if(_window && _avtView)
{
_loc3_ = AvatarUtility.getAnimalItemWindowOffset(_avtView.avTypeId);
_avtView.x = _loc3_.x;
_avtView.y = _loc3_.y;
_window.aml.nameTxt.text = _avtView.avName;
_window.gray.nameTxt.text = _avtView.avName;
_ai = gMainFrame.userInfo.getAvatarInfoByUserNameThenPerUserAvId(_avtView.userName,_avtView.perUserAvId);
if(_ai && _ai.questLevel > 0)
{
loadQuestShape();
}
_avtView.visible = true;
}
if(_loadingSpiral)
{
_loadingSpiral.destroy();
_loadingSpiral = null;
}
}
}
}
@@ -0,0 +1,357 @@
package gui.itemWindows
{
import avatar.Avatar;
import avatar.AvatarDef;
import avatar.AvatarItem;
import avatar.AvatarUtility;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.filters.ColorMatrixFilter;
import gui.LoadingSpiral;
import inventory.Iitem;
import loader.MediaHelper;
import localization.LocalizationManager;
import pet.GuiPet;
import pet.PetItem;
import pet.PetManager;
public class ItemWindowAvatarOrPetSelect extends ItemWindowBase
{
private var _mediaHelper:MediaHelper;
private var _forCreation:Boolean;
private var _avType:int;
private var _shouldShowDiamond:Boolean;
private var _customAvId:int;
private var _creationAvatar:Avatar;
private var _isPet:Boolean;
private var _currGuiPet:GuiPet;
private var _selectedIndex:Function;
private var _loadingSpiral:LoadingSpiral;
private var _currIitem:Iitem;
private var _avatarDef:AvatarDef;
private var _currIcon:MovieClip;
private var _hasSetInitialConditions:Boolean;
public function ItemWindowAvatarOrPetSelect(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
if(param2)
{
_isPet = param9.isPet == null ? false : true;
_selectedIndex = param9.selectedIndex == null ? null : param9.selectedIndex;
if(!_isPet)
{
_currIitem = param2 as AvatarItem;
_creationAvatar = param9.creationAvatars[param4];
_avatarDef = gMainFrame.userInfo.getAvatarDefByAvatar(_creationAvatar);
_forCreation = param9.forCreation == null ? false : param9.forCreation;
_avType = param9.avTypes[param4];
_customAvId = _creationAvatar.customAvId;
_shouldShowDiamond = _currIitem.isDiamond && !AvatarUtility.getAvatarDefIsViewableWithAvId(_avType,_customAvId);
}
else
{
_currIitem = param2 as PetItem;
_shouldShowDiamond = _currIitem.isDiamond && !PetManager.isPetAvailable((_currIitem as PetItem).defId);
}
}
super("avatarOrPetWindowCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get currWindow() : MovieClip
{
return _window;
}
public function get customAvId() : int
{
return _customAvId;
}
public function selectItem() : void
{
if(_window.currentFrameLabel != (!_isPet && isDiamond) ? "diamond_down" : "down")
{
_window.gotoAndStop(!_isPet && isDiamond ? "diamond_down" : "down");
}
}
public function deselect() : void
{
if(_window.currentFrameLabel != (!_isPet && isDiamond) ? "diamond_up" : "up")
{
_window.gotoAndStop(!_isPet && isDiamond ? "diamond_up" : "up");
}
}
public function setupLayers() : void
{
_window.diamond.visible = _shouldShowDiamond;
}
public function get isDiamond() : Boolean
{
if(_currItem && _currIitem)
{
return _currIitem.isDiamond;
}
return false;
}
override public function destroy() : void
{
super.destroy();
if(_currGuiPet)
{
_currGuiPet.destroy();
_currGuiPet = null;
}
}
override protected function onWindowLoadCallback() : void
{
if(_forCreation)
{
loadCurrItem();
}
super.onWindowLoadCallback();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
if(_window && _currItem)
{
if(_isPet)
{
if(!_isCurrItemLoaded)
{
if(!_hasSetInitialConditions)
{
setChildrenAndInitialConditions();
}
_currIitem.imageLoadedCallback = onPetLoaded;
_currGuiPet = _currIitem.icon as GuiPet;
setupCommonItems();
_window.itemWindow.addChild(_currGuiPet);
_isCurrItemLoaded = true;
}
else if(_loadingSpiral)
{
_loadingSpiral.destroy();
_loadingSpiral = null;
}
}
else if(_currItem && !_isCurrItemLoaded)
{
if(!_hasSetInitialConditions)
{
setChildrenAndInitialConditions();
}
_itemYLocation = param1;
_itemXLocation = param2;
_mediaHelper = new MediaHelper();
_mediaHelper.init(_avatarDef.iconMediaId,onCurrItemLoaded);
}
else if(_currItem && _currIcon)
{
if(_loadingSpiral)
{
_loadingSpiral.destroy();
_loadingSpiral = null;
}
_isCurrItemLoaded = true;
setupCommonItems();
if(_iconLayerName != "" && _currIcon.hasOwnProperty(_iconLayerName))
{
_window.itemWindow.addChild(_currIcon[_iconLayerName]);
}
else
{
_window.itemWindow.addChild(DisplayObject(_currIcon));
}
}
else if(_loadingSpiral)
{
_loadingSpiral.destroy();
_loadingSpiral = null;
}
if(index == selectedIndex())
{
selectItem();
}
else
{
deselect();
}
}
}
override protected function setChildrenAndInitialConditions() : void
{
if(!_hasSetInitialConditions)
{
_window.memberLock.visible = false;
_window.endangered.visible = false;
_window.ocean.visible = false;
_window.diamond.visible = false;
_window.daysLeftTag.visible = false;
_window.clearanceTag.visible = false;
_window.rare.visible = false;
_loadingSpiral = new LoadingSpiral(_window.itemWindow,_window.itemWindow.width * 0.5,_window.itemWindow.height * 0.5);
_hasSetInitialConditions = true;
addEventListeners();
if(_forCreation)
{
loadCurrItem();
}
}
}
override public function setStatesForVisibility(param1:Boolean, param2:Object = null) : void
{
if(_isPet)
{
if(_currGuiPet)
{
_currGuiPet.animatePet(param1);
}
this.visible = param1;
}
else
{
super.setStatesForVisibility(param1,_currIcon);
}
}
private function selectedIndex() : int
{
if(_selectedIndex != null)
{
return _selectedIndex();
}
return 0;
}
private function onCurrItemLoaded(param1:MovieClip) : void
{
if(param1)
{
_currIcon = param1.getChildAt(0) as MovieClip;
_isCurrItemLoaded = true;
loadCurrItem();
}
}
private function onPetLoaded(param1:MovieClip, param2:GuiPet) : void
{
if(_loadingSpiral)
{
_loadingSpiral.destroy();
_loadingSpiral = null;
}
param1.scaleX = param1.scaleY = 2;
param1.x = 53;
param1.y = 85;
if(_currGuiPet)
{
_currGuiPet.animatePet(this.visible);
}
}
private function setupCommonItems() : void
{
var _loc1_:Array = null;
if(!gMainFrame.userInfo.isMember && _currIitem.isMemberOnly)
{
_window.memberLock.visible = true;
}
_window.clearanceTag.visible = _currIitem.isOnClearance;
_window.diamond.visible = _shouldShowDiamond;
setupNumDaysLeft();
if(_isPet)
{
if(_currGuiPet.canGoInOcean())
{
_window.ocean.visible = true;
}
_window.rare.visible = _currIitem.isRare;
}
else
{
if(!_forCreation && Utility.isOcean(_avatarDef.enviroTypeFlag))
{
_window.ocean.visible = true;
}
if(AvatarUtility.isEndangered(_avatarDef.availability))
{
if(_avType == 13 || _avType == 16 || _avType == 26)
{
LocalizationManager.translateId(_window.endangered.txt,11177);
}
else if(_avType == 6)
{
LocalizationManager.translateId(_window.endangered.txt,14226);
}
else
{
LocalizationManager.translateId(_window.endangered.txt,11178);
}
_window.endangered.visible = true;
}
if(AvatarUtility.isExtinct(_avatarDef.availability))
{
_loc1_ = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0];
_currIcon.filters = [new ColorMatrixFilter(_loc1_)];
}
if(_currIitem.isDiamond && _window.currentFrameLabel != "diamond_down")
{
_window.gotoAndStop("diamond_up");
}
}
}
private function setupNumDaysLeft() : void
{
var _loc1_:int = 0;
if(!_currIitem.isRare && !_currIitem.isNew && !_currIitem.isOnSale)
{
_loc1_ = Math.ceil((_currIitem.endTime - Utility.getCurrEpochTime()) / 60 / 60 / 24);
if(_loc1_ > 0 && _loc1_ <= 10)
{
if(_loc1_ == 1)
{
LocalizationManager.translateId(_window.daysLeftTag.txt,18061);
}
else
{
LocalizationManager.translateIdAndInsert(_window.daysLeftTag.txt,6260,_loc1_);
}
_window.daysLeftTag.visible = true;
MovieClip(_window.daysLeftTag.parent).clearanceTag.visible = false;
}
else
{
_window.daysLeftTag.visible = false;
}
}
else
{
_window.daysLeftTag.visible = false;
}
}
}
}
@@ -0,0 +1,174 @@
package gui.itemWindows
{
import avatar.Avatar;
import avatar.AvatarInfo;
import avatar.AvatarManager;
import avatar.AvatarUtility;
import avatar.AvatarView;
import buddy.BuddyCard;
import com.sbi.graphics.LayerAnim;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import pet.GuiPet;
public class ItemWindowAvtPetSml extends ItemWindowBase
{
private var _isPet:Boolean;
private var _ai:AvatarInfo;
private var _isMember:Boolean;
private var _nameBarData:int;
private var _currFrameName:String;
private var _avtView:AvatarView;
private var _petView:GuiPet;
private var _currPerUserAvId:int;
private var _hasSetInitialConditions:Boolean;
public function ItemWindowAvtPetSml(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_isPet = param9 != null ? param9.isPet : false;
_isMember = param9 != null ? param9.isMember : false;
_nameBarData = param9 != null ? param9.nameBarData : 0;
if(!_isPet)
{
_ai = gMainFrame.userInfo.getAvatarInfoByUserNameThenPerUserAvId(param2.userName,param2.perUserAvId);
_currPerUserAvId = param9.currPerUserAvId;
}
super("charBtnSmlCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get sel() : MovieClip
{
return _window.sel;
}
public function get isPet() : Boolean
{
return _isPet;
}
public function get charLayer() : MovieClip
{
return _window.charLayer;
}
public function get xpShape() : MovieClip
{
return _window.xpShape;
}
public function get toolTipName() : String
{
if(_isPet && _petView)
{
return _petView.petName;
}
if(_avtView)
{
return _avtView.avName;
}
return "";
}
override public function gotoAndStop(param1:Object, param2:String = null) : void
{
_window.gotoAndStop(param1,param2);
if(_currFrameName)
{
if(param1 == "over")
{
xpShape[_currFrameName].mouse.gotoAndPlay(1);
}
else
{
xpShape[_currFrameName].mouse.gotoAndStop(1);
}
}
}
override public function destroy() : void
{
if(_avtView)
{
_avtView.destroy();
_avtView = null;
}
if(_petView)
{
_petView.destroy();
_petView = null;
}
super.destroy();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(_currItem && !_isCurrItemLoaded)
{
if(!_hasSetInitialConditions)
{
setChildrenAndInitialConditions();
}
_isCurrItemLoaded = true;
_window.charLayer.addChild(DisplayObject(_isPet ? _petView : _avtView));
if(_ai && _ai.questLevel > 0)
{
_currFrameName = xpShape.currentLabels[Utility.getColorId(_nameBarData) - 1].name;
if(xpShape.currentFrameLabel != _currFrameName)
{
xpShape.gotoAndStop(_currFrameName);
}
Utility.createXpShape(_ai.questLevel,_isMember,xpShape[_currFrameName].mouse.up.icon,xpShape[_currFrameName].mouse.mouse.icon,2147483647);
}
}
}
override protected function setChildrenAndInitialConditions() : void
{
_hasSetInitialConditions = true;
_window.sel.visible = false;
if(_isPet)
{
_petView = new GuiPet(_currItem.createdTs,_currItem.idx,_currItem.lBits,_currItem.uBits,_currItem.eBits,_currItem.type,_currItem.name,_currItem.personalityDefId,_currItem.favoriteToyDefId,_currItem.favoriteFoodDefId,onPetViewLoaded);
}
else
{
_currItem = AvatarUtility.generateNew(Avatar(_currItem).perUserAvId,Avatar(_currItem),Avatar(_currItem).userName,AvatarManager.roomEnviroType);
_avtView = new AvatarView();
_avtView.init(Avatar(_currItem),null);
_avtView.playAnim(13,false,1,onAvtAnimLoaded);
if(_currPerUserAvId == Avatar(_currItem).perUserAvId)
{
sel.visible = true;
}
}
addEventListeners();
}
private function onPetViewLoaded(param1:MovieClip, param2:GuiPet) : void
{
if(_window)
{
param2.x = this.width * 0.3;
param2.y = this.height * 0.4;
param2.scaleX = param2.scaleY = 1.1;
}
}
private function onAvtAnimLoaded(param1:LayerAnim, param2:int) : void
{
BuddyCard.updateViewPosition(_avtView);
}
}
}
@@ -0,0 +1,390 @@
package gui.itemWindows
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import gui.LoadingSpiral;
import gui.WindowAndScrollbarGenerator;
import gui.WindowGenerator;
import inventory.Iitem;
import loader.MediaHelper;
public class ItemWindowBase extends MovieClip
{
protected var _window:MovieClip;
protected var _currItem:Object;
protected var _mouseDown:Function;
protected var _mouseOver:Function;
protected var _mouseOut:Function;
protected var _memberOnlyDown:Function;
protected var _index:int;
protected var _visibilityIndex:int;
protected var _spiral:LoadingSpiral;
protected var _windowLoadedCallback:Function;
protected var _iconLayerName:String;
protected var _isCurrItemLoaded:Boolean;
protected var _itemYLocation:int;
protected var _itemXLocation:int;
protected var _useToolTip:Boolean;
protected var _windowGenerator:Object;
protected var _runningMovieClips:Array;
protected var _callbackToCallWhenImageLoads:Function;
private var _windowMediaHelper:MediaHelper;
private var _memberOnlyTrackingName:String;
public function ItemWindowBase(param1:*, param2:Function, param3:Object, param4:String, param5:int, param6:Function, param7:Function, param8:Function, param9:Function, param10:Boolean = false)
{
var _loc11_:Array = null;
super();
_currItem = param3;
_iconLayerName = param4;
_mouseDown = param6;
_mouseOver = param7;
_mouseOut = param8;
_memberOnlyDown = param9;
_index = param5;
_visibilityIndex = param5;
_windowLoadedCallback = param2;
_useToolTip = param10;
if(param1 is String)
{
_loc11_ = String(param1).split("|");
_window = GETDEFINITIONBYNAME(_loc11_[0],_loc11_.length > 1 ? false : true);
addChild(_window);
onWindowLoadCallback();
}
else if(param1 is int)
{
_windowMediaHelper = new MediaHelper();
_windowMediaHelper.init(param1,onWindowLoaded);
}
else
{
if(!(param1 is MovieClip))
{
throw new Error("windowClassOrId is not of type string or int. windowClassOrIdOrMovieClip = " + param1);
}
_window = param1;
addChild(_window);
onWindowLoadCallback();
}
}
public function destroy() : void
{
removeEventListeners();
if(_spiral)
{
_spiral.destroy();
}
if(_windowMediaHelper)
{
_windowMediaHelper.destroy();
}
if(_window && _window.parent == this)
{
removeChild(_window);
}
if(_currItem && _currItem.hasOwnProperty("destroy"))
{
_currItem.destroy();
}
_windowGenerator = null;
_window = null;
_windowLoadedCallback = null;
_currItem = null;
_mouseDown = null;
_mouseOver = null;
_mouseOut = null;
}
public function get index() : int
{
return _index;
}
public function set index(param1:int) : void
{
_index = param1;
}
public function get visibilityIndex() : int
{
return _visibilityIndex;
}
public function set visibilityIndex(param1:int) : void
{
_visibilityIndex = param1;
}
override public function get width() : Number
{
if("sizeCont" in _window && _window.sizeCont)
{
return _window.sizeCont.width;
}
return super.width;
}
override public function get height() : Number
{
if("sizeCont" in _window && _window.sizeCont)
{
return _window.sizeCont.height;
}
return super.height;
}
public function setStatesForVisibility(param1:Boolean, param2:Object = null) : void
{
var _loc3_:int = 0;
if(param1)
{
if(this.visible == false)
{
if(_runningMovieClips != null)
{
_loc3_ = 0;
while(_loc3_ < _runningMovieClips.length)
{
MovieClip(_runningMovieClips[_loc3_]).play();
_loc3_++;
}
}
this.visible = true;
}
}
else if(this.visible == true)
{
if(_runningMovieClips == null)
{
if(param2 == null)
{
param2 = _currItem;
}
if(param2 is Iitem)
{
if(!Iitem(param2).isIconLoaded)
{
if(Iitem(param2).imageLoadedCallback != null && Iitem(param2).imageLoadedCallback != onImageIconLoaded)
{
_callbackToCallWhenImageLoads = Iitem(param2).imageLoadedCallback;
}
Iitem(param2).imageLoadedCallback = onImageIconLoaded;
return;
}
_runningMovieClips = [];
findAndSetAllRunningMovieClips(Iitem(param2).icon);
}
else
{
_runningMovieClips = [];
findAndSetAllRunningMovieClips(param2);
}
}
else
{
_loc3_ = 0;
while(_loc3_ < _runningMovieClips.length)
{
MovieClip(_runningMovieClips[_loc3_]).stop();
_loc3_++;
}
}
this.visible = false;
}
}
public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(_currItem && !(_currItem is int) && !_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
{
_window.addChild(_currItem[_iconLayerName]);
}
else if(_window != _currItem)
{
_window.addChild(DisplayObject(_currItem));
}
}
}
protected function findAndSetAllRunningMovieClips(param1:Object) : void
{
var _loc2_:int = 0;
if(param1)
{
if(param1 is MovieClip && MovieClip(param1).totalFrames > 1 && MovieClip(param1).currentFrame != 1)
{
MovieClip(param1).stop();
_runningMovieClips.push(param1);
}
if(param1.hasOwnProperty("numChildren"))
{
_loc2_ = 0;
while(_loc2_ < param1.numChildren)
{
findAndSetAllRunningMovieClips(param1.getChildAt(_loc2_));
_loc2_++;
}
}
}
}
protected function onWindowLoaded(param1:MovieClip) : void
{
if(param1)
{
_window = MovieClip(param1.getChildAt(0));
addChild(_window);
onWindowLoadCallback();
_windowMediaHelper.destroy();
_windowMediaHelper = null;
}
}
protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
if(_windowLoadedCallback != null)
{
_windowLoadedCallback(this);
}
}
protected function onImageIconLoaded(param1:Object = null, ... rest) : void
{
var _loc3_:Function = null;
setStatesForVisibility(false);
if(_callbackToCallWhenImageLoads != null)
{
rest.insertAt(0,param1);
_loc3_ = _callbackToCallWhenImageLoads;
_callbackToCallWhenImageLoads = null;
_loc3_.apply(null,rest);
}
}
protected function setChildrenAndInitialConditions() : void
{
}
protected function onWindowRollOver(param1:MouseEvent) : void
{
if(_useToolTip && this.parent != null)
{
if(_windowGenerator == null)
{
if(this.parent.parent is WindowGenerator)
{
_windowGenerator = WindowGenerator(this.parent.parent);
}
else
{
_windowGenerator = WindowAndScrollbarGenerator(this.parent.parent);
}
}
if(_currItem && _windowGenerator.isIndexInView(_visibilityIndex))
{
_windowGenerator.toolTip.init(_windowGenerator.parent.parent,_currItem.name,this.x + _windowGenerator.boxWidth * 0.5 - _itemXLocation + _windowGenerator.parent.x,this.y + _windowGenerator.boxHeight - _itemYLocation + _windowGenerator.parent.y - 5);
_windowGenerator.toolTip.startTimer(param1);
}
}
}
protected function onWindowRollOut(param1:MouseEvent) : void
{
if(_windowGenerator && _useToolTip && this.parent != null)
{
_windowGenerator.toolTip.resetTimerAndSetVisibility();
}
}
protected function addEventListeners() : void
{
if(_window && _currItem)
{
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
if(_useToolTip)
{
addEventListener("rollOver",onWindowRollOver,false,0,true);
}
addEventListener("rollOver",_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
if(_useToolTip)
{
addEventListener("rollOut",onWindowRollOut,false,0,true);
}
addEventListener("rollOut",_mouseOut,false,0,true);
}
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
{
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
}
}
}
protected function removeEventListeners() : void
{
if(_mouseDown != null)
{
removeEventListener("mouseDown",_mouseDown);
}
if(_mouseOver != null)
{
if(_useToolTip)
{
removeEventListener("rollOver",onWindowRollOver);
}
removeEventListener("rollOver",_mouseOver);
}
if(_mouseOut != null)
{
if(_useToolTip)
{
removeEventListener("rollOut",onWindowRollOut);
}
removeEventListener("rollOut",_mouseOut);
}
if(_memberOnlyDown != null)
{
removeEventListener("mouseDown",_memberOnlyDown);
}
}
}
}
@@ -0,0 +1,52 @@
package gui.itemWindows
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import gui.GuiManager;
import loader.MediaHelper;
public class ItemWindowBook extends ItemWindowBase
{
private var _mediaHelper:MediaHelper;
public function ItemWindowBook(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super(new (param9.currLoaderAppDomain.getDefinition("eBookLibraryCont") as Class)(),param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
}
}
override protected function setChildrenAndInitialConditions() : void
{
_mediaHelper = new MediaHelper();
_mediaHelper.init(_currItem.mediaId,onBookCoverLoaded);
}
override protected function addEventListeners() : void
{
super.addEventListeners();
_window.itemWindow.addEventListener("mouseDown",onBookCoverDown,false,0,true);
}
private function onBookCoverLoaded(param1:MovieClip) : void
{
_window.itemWindow.addChild(param1.getChildAt(0));
}
private function onBookCoverDown(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.openPageFlipBook(_currItem.listId,true,1);
}
}
}
@@ -0,0 +1,206 @@
package gui.itemWindows
{
import buddy.Buddy;
import buddy.BuddyList;
import buddy.BuddyManager;
import com.sbi.popup.SBYesNoPopup;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.utils.setTimeout;
import gui.DarkenManager;
import gui.GuiManager;
import gui.GuiRadioButtonSingle;
import localization.LocalizationManager;
public class ItemWindowBuddyList extends ItemWindowBase
{
private var _bud:Buddy = new Buddy();
private var _isForMainHud:Boolean;
private var _currWindow:MovieClip;
private var _isSelection:Boolean;
private var _currSelectedUsername:String;
public function ItemWindowBuddyList(param1:Function, param2:*, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_bud.init(param2.userName,param2.uuid,param2.moderatedUserNameFlag,param2.onlineStatus,param2.accountType,param2.timeLeftHostingCustomParty);
_isForMainHud = param9 ? param9.isForMainHud : false;
_isSelection = param9 ? param9.isSelection : false;
if(param9 && _bud.userName.toLowerCase() == param9.currSelectedUsername.toLowerCase())
{
_currSelectedUsername = param9.currSelectedUsername;
}
else
{
_currSelectedUsername = "";
}
super("buddyListWindowCont",param1,param2,param3,param4,param5,param6,param7,param8,false);
}
override public function destroy() : void
{
if(_window && _window.recycleBtn)
{
_window.recycleBtn.removeEventListener("mouseDown",onRecycleDown);
}
super.destroy();
}
public function getBuddy() : Buddy
{
return _bud;
}
public function buddyPortalUsername() : String
{
return _currSelectedUsername.toLowerCase();
}
public function turnOffBuddySelection() : void
{
_currSelectedUsername = "";
_currWindow.selectPortalBuddyBox.selected = false;
}
public function setBuddySelection() : void
{
_currSelectedUsername = _bud.userName;
}
public function showRecycleBtn(param1:Boolean) : void
{
if(_window)
{
_window.recycleBtn.visible = param1;
_window.highlight.visible = param1;
}
}
public function get sizeCont() : MovieClip
{
return _window.sizeCont;
}
public function update() : void
{
if(_bud && _bud.onlineStatus == 1)
{
_bud = BuddyManager.getBuddyByUserName(_bud.userName);
if(_bud && _window)
{
_currWindow = _window.OnlineBuddyListWindow;
if(_currWindow && _currWindow.onOffBlocked.currentFrameLabel != "blocked")
{
if(_bud.timeLeftHostingCustomParty > 0)
{
_currWindow.onOffBlocked.gotoAndStop("jammerParty");
}
else
{
_currWindow.onOffBlocked.gotoAndStop("online");
}
}
}
}
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
addEventListeners();
super.onWindowLoadCallback();
}
override public function setStatesForVisibility(param1:Boolean, param2:Object = null) : void
{
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
}
override protected function setChildrenAndInitialConditions() : void
{
if(_isSelection)
{
_window.gotoAndStop("portal");
_currWindow = _window.portal;
_currWindow.selectPortalBuddyBox = new GuiRadioButtonSingle(_currWindow.radioBtn,_currWindow.userNameTxt);
if(_bud.onlineStatus == -1)
{
_currWindow.selectPortalBuddyBox.gray = true;
}
else if(_bud.userName.toLowerCase() == _currSelectedUsername.toLowerCase())
{
_currWindow.selectPortalBuddyBox.selected = true;
BuddyList.updateSelectedInWorldBuddyIndex(_index);
}
else
{
_currWindow.selectPortalBuddyBox.selected = false;
}
}
else
{
if(_bud.onlineStatus == 1)
{
_window.gotoAndStop("online");
_currWindow = _window.OnlineBuddyListWindow;
if(BuddyManager.isBlocked(_bud.userName))
{
_currWindow.onOffBlocked.gotoAndStop("blocked");
}
else if(_bud.timeLeftHostingCustomParty > 0)
{
_currWindow.onOffBlocked.gotoAndStop("jammerParty");
}
else
{
_currWindow.onOffBlocked.gotoAndStop("online");
}
}
else
{
_window.gotoAndStop("offline");
_currWindow = _window.OfflineBuddyListWindow;
_currWindow.onOffBlocked.gotoAndStop("offline");
}
_currWindow.onlineStatus = _bud.onlineStatus;
_currWindow.accountType = _bud.accountType;
_window.recycleBtn.addEventListener("mouseDown",onRecycleDown,false,0,true);
_window.recycleBtn.visible = false;
_window.highlight.visible = false;
}
_currWindow.userName = _bud.userName;
_currWindow.moderatedUserName = _bud.userNameModerated;
LocalizationManager.updateToFit(_currWindow.userNameTxt,_bud.userNameModerated);
}
private function onRecycleDown(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_bud)
{
new SBYesNoPopup(GuiManager.guiLayer,LocalizationManager.translateIdAndInsertOnly(14705,_bud.userNameModerated),true,removeBuddyConfirmCallback,{
"currUserName":_bud.userName,
"currUserNameModerated":_bud.userNameModerated
});
}
}
private function removeBuddyConfirmCallback(param1:Object) : void
{
if(param1.status)
{
DarkenManager.showLoadingSpiral(true);
setTimeout(DarkenManager.showLoadingSpiral,1000,false);
BuddyManager.addRemoveBuddy(param1.passback.currUserName,param1.passback.currUserNameModerated,false);
}
}
}
}
@@ -0,0 +1,105 @@
package gui.itemWindows
{
import localization.LocalizationManager;
import movie.MovieNode;
public class ItemWindowChapterSelect extends ItemWindowBase
{
private var _currMovieNodeDef:MovieNode;
private var _isGray:Boolean;
private var _baseDefId:int;
public function ItemWindowChapterSelect(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super(2162,param1,param2,param3,param4,param5,param6,param7,param8);
_currMovieNodeDef = MovieNode(param2);
_baseDefId = param9.baseDefId;
}
public function getMovieNodeDef() : MovieNode
{
return _currMovieNodeDef;
}
public function activateGrayState(param1:Boolean) : void
{
_isGray = param1;
_window.activateGrayState(param1);
}
public function get isGray() : Boolean
{
return _isGray;
}
override protected function onWindowLoadCallback() : void
{
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
}
super.onWindowLoadCallback();
}
override protected function setChildrenAndInitialConditions() : void
{
var _loc1_:Boolean = false;
if(_currMovieNodeDef.defId != _baseDefId && !gMainFrame.userInfo.userVarCache.isBitSet(_currMovieNodeDef.userVarId,_currMovieNodeDef.bitIndex))
{
if(_currMovieNodeDef.bitIndex > 0 && Boolean(gMainFrame.userInfo.userVarCache.isBitSet(_currMovieNodeDef.userVarId,_currMovieNodeDef.bitIndex - 1)))
{
activateGrayState(false);
_loc1_ = true;
}
else
{
activateGrayState(true);
}
}
if(_currMovieNodeDef.thisChapterHasGift && (_loc1_ || _isGray))
{
_window.btnCont.showGift(true);
}
else
{
_window.btnCont.showGift(false);
}
var _loc2_:String = LocalizationManager.translateIdOnly(_currMovieNodeDef.streamTitleId);
if(_isGray)
{
_loc2_ = _loc2_.slice(0,_loc2_.indexOf(":"));
}
LocalizationManager.updateToFit(_window.btnCont.mouse.up.txt,_loc2_);
LocalizationManager.updateToFit(_window.btnCont.gray.txt,_loc2_);
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null)
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener("rollOver",_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener("rollOut",_mouseOut,false,0,true);
}
if(_memberOnlyDown != null)
{
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
}
}
}
}
}
@@ -0,0 +1,198 @@
package gui.itemWindows
{
import avatar.Avatar;
import avatar.AvatarInfo;
import avatar.AvatarManager;
import avatar.AvatarUtility;
import avatar.AvatarView;
import avatar.AvatarXtCommManager;
import avatar.UserInfo;
import flash.display.MovieClip;
import flash.geom.Point;
import localization.LocalizationManager;
import pet.GuiPet;
import quest.QuestXtCommManager;
public class ItemWindowCustPlayers extends ItemWindowBase
{
private var _onBxBtn:Function;
private var _currUserName:String;
private var _ai:AvatarInfo;
private var _scriptDefId:int;
public function ItemWindowCustPlayers(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_onBxBtn = param9.onBxBtn;
_scriptDefId = param9.scriptDefId;
super(2301,param1,param2,param3,param4,param5,param6,param7,param8);
}
override protected function setChildrenAndInitialConditions() : void
{
_window.bx.visible = false;
super.setChildrenAndInitialConditions();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
var _loc3_:Avatar = null;
var _loc4_:AvatarInfo = null;
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
while(_window.char.charLayer.numChildren > 0)
{
_window.char.charLayer.removeChildAt(0);
}
_window.char.gotoAndPlay("waiting");
LocalizationManager.translateId(_window.nameBar.firstName_txt,11101);
_window.nameBar.lastName_txt.text = "";
_window.char.gotoAndPlay("up");
_loc3_ = AvatarManager.getAvatarBySfsUserId(int(_currItem));
if(_loc3_)
{
_loc4_ = gMainFrame.userInfo.getAvatarInfoByUserName(_loc3_.userName);
}
if(_loc3_ == null || _loc4_ == null)
{
AvatarXtCommManager.requestAvatarGetBySfsId(int(_currItem),onAvatarGetReceived);
}
else
{
setupAvatar(_loc3_,_loc4_.currPet);
}
_isCurrItemLoaded = true;
}
}
override protected function addEventListeners() : void
{
_window.bx.addEventListener("mouseDown",_onBxBtn,false,0,true);
super.addEventListeners();
}
override protected function removeEventListeners() : void
{
_window.bx.removeEventListener("mouseDown",_onBxBtn);
super.removeEventListeners();
}
public function showXBtn(param1:Boolean) : void
{
_window.bx.visible = param1;
}
public function get userName() : String
{
return _currUserName;
}
public function get char() : MovieClip
{
return _window.char;
}
private function setupAvatar(param1:Avatar, param2:Object) : void
{
var _loc9_:GuiPet = null;
var _loc7_:AvatarView = null;
var _loc5_:Point = null;
var _loc8_:String = null;
var _loc10_:int = 0;
var _loc3_:String = null;
var _loc4_:String = null;
var _loc11_:Object = QuestXtCommManager.getScriptDef(_scriptDefId);
if(_loc11_.playAsPet)
{
_loc9_ = new GuiPet(param2.createdAt,0,param2.lBits,param2.uBits,param2.eBits,param2.type,param2.name,param2.personalityDefId,param2.favoriteToyDefId,param2.favoriteFoodDefId,onBigPetLoaded);
_window.char.charLayer.addChild(_loc9_);
_window.nameBar.firstName_txt.text = _loc9_.petName;
}
else
{
_loc7_ = new AvatarView();
_loc7_.init(param1);
_loc7_.playAnim(15,false,0,null,true);
_loc7_.scaleX = 0.7;
_loc7_.scaleY = 0.7;
_loc5_ = AvatarUtility.getAvatarMinigameLobbyOffset(_loc7_.avTypeId);
_loc7_.x = _loc5_.x;
_loc7_.y = _loc5_.y + 5;
_window.char.charLayer.addChild(_loc7_);
_loc8_ = param1.avName;
_loc10_ = _loc8_.indexOf(" ");
if(_loc10_ != -1)
{
_loc3_ = _loc8_.substr(0,_loc10_);
_loc4_ = _loc8_.substr(_loc10_ + 1,_loc8_.length);
}
else
{
_loc3_ = _loc8_;
}
_window.nameBar.firstName_txt.text = _loc3_;
if(_loc4_)
{
_window.nameBar.lastName_txt.text = _loc4_;
}
}
_currUserName = param1.userName;
_ai = gMainFrame.userInfo.getAvatarInfoByUserNameThenPerUserAvId(param1.userName,param1.perUserAvId);
var _loc6_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(param1.userName);
if(_ai && _loc6_ && _ai.questLevel > 0)
{
loadQuestShape(_loc6_.nameBarData);
}
}
private function onAvatarGetReceived(param1:String, param2:Boolean, param3:int, param4:int) : void
{
var _loc5_:AvatarInfo = null;
var _loc6_:int = 0;
var _loc7_:Avatar = null;
if(param2)
{
_loc5_ = gMainFrame.userInfo.getAvatarInfoByUserName(param1);
if(!_loc5_)
{
throw new Error("onAvatarSFSGetReceived and avInfo is null");
}
_loc6_ = _loc5_.perUserAvId;
_loc7_ = AvatarManager.getAvatarByUserName(param1);
if(_loc7_ == null)
{
_loc7_ = AvatarUtility.generateNew(_loc6_,null,param1,-1,0);
}
setupAvatar(_loc7_,_loc5_.currPet);
}
}
private function onBigPetLoaded(param1:MovieClip, param2:GuiPet) : void
{
param2.scaleX = param2.scaleY = 1.5;
param2.y += 30;
}
private function loadQuestShape(param1:int) : void
{
var _loc2_:String = _window.xpShape.currentLabels[Utility.getColorId(param1) - 1].name;
_window.xpShape.visible = true;
if(_loc2_ == "black")
{
_window.xpShape.gotoAndStop(2);
_window.xpShape.gotoAndStop(_loc2_);
}
if(_window.xpShape.currentFrameLabel != _loc2_)
{
_window.xpShape.gotoAndStop(_loc2_);
}
Utility.createXpShape(_ai.questLevel,true,_window.xpShape[_loc2_].mouse.up.icon,null,param1);
}
}
}
@@ -0,0 +1,105 @@
package gui.itemWindows
{
import ecard.ECard;
import localization.LocalizationManager;
public class ItemWindowECard extends ItemWindowBase
{
private var _currSelectedIndex:Function;
private var _readFunction:Function;
private var _specialTypeAppend:String;
public function ItemWindowECard(param1:Function, param2:ECard, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_currSelectedIndex = param9.currSelectedIndex;
_readFunction = param9.readFunction;
_specialTypeAppend = param2.specialType == 1 ? "Valentine" : "";
super("inboxMessage",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function select(param1:Boolean) : void
{
if(param1)
{
if(!_currItem.isRead && !_currItem.isReadInProcess)
{
_currItem.isReadInProcess = true;
_window.gotoAndStop("new" + _specialTypeAppend);
_window.selectedOutline.visible = true;
_window.newIcon.mouseEnabled = false;
_window.newIcon.mouseChildren = false;
LocalizationManager.findAllTextfields(_window);
_readFunction();
}
else if(_window.currentFrameLabel != "new" + _specialTypeAppend)
{
_window.gotoAndStop("selected" + _specialTypeAppend);
}
}
else if(!_currItem.isRead)
{
_window.gotoAndStop("new" + _specialTypeAppend);
_window.selectedOutline.visible = false;
_window.newIcon.mouseEnabled = false;
_window.newIcon.mouseChildren = false;
LocalizationManager.findAllTextfields(_window);
}
else if(_window.currentFrameLabel == "selected" + _specialTypeAppend || _window.currentFrameLabel == "new" + _specialTypeAppend || _window.currentFrameLabel == "norm" && _specialTypeAppend != "")
{
_window.gotoAndStop(_specialTypeAppend == "" ? "norm" : _specialTypeAppend.toLowerCase());
}
}
public function get currItem() : Object
{
return _currItem;
}
public function updateWithInput(param1:ECard) : void
{
_currItem = param1;
update();
}
public function update() : void
{
if(_isCurrItemLoaded)
{
select(index == _currSelectedIndex());
if(_window.messageTxt)
{
LocalizationManager.updateToFit(_window.messageTxt,_currItem.modifiedMsg,false,false,true,true);
}
_window.gift.visible = _currItem.isGift;
}
}
override protected function setChildrenAndInitialConditions() : void
{
_window.messageTxt.mouseEnabled = false;
_window.nameTxt.mouseEnabled = false;
_window.gift.visible = false;
_window.gift.mouseEnabled = false;
_window.gift.mouseChildren = false;
_window.AJIcon.visible = false;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded)
{
addEventListeners();
_isCurrItemLoaded = true;
setChildrenAndInitialConditions();
update();
LocalizationManager.updateToFit(_window.nameTxt,_currItem.senderModeratedUserName);
}
}
}
}
@@ -0,0 +1,89 @@
package gui.itemWindows
{
import ecard.ECardImageBase;
import flash.filters.ColorMatrixFilter;
import gui.LoadingSpiral;
public class ItemWindowECardPreview extends ItemWindowBase
{
private var _currentECardImageBase:ECardImageBase;
private var _loadingSpiral:LoadingSpiral;
private var _currIndexFunction:Function;
private var _shouldGrayOutPreviewFunction:Function;
public function ItemWindowECardPreview(param1:Function, param2:int, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_currIndexFunction = param9.currIndexFunction;
_shouldGrayOutPreviewFunction = param9.shouldGrayOutPreview;
super(4474,param1,param2,param3,param4,param5,param6,param7,param8);
}
override protected function setChildrenAndInitialConditions() : void
{
_loadingSpiral = new LoadingSpiral(_window.itemWindow,_window.itemWindow.width * 0.5,_window.itemWindow.height * 0.5);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(_window && !_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
_currentECardImageBase = new ECardImageBase();
_currentECardImageBase.init(int(_currItem),onECardImageLoaded);
}
}
public function update() : void
{
if(_currentECardImageBase && _currentECardImageBase.img)
{
if(_shouldGrayOutPreviewFunction())
{
if(_currIndexFunction() == index)
{
_window.gotoAndStop("selected");
}
else
{
_window.gotoAndStop("norm");
}
_currentECardImageBase.img.filters = null;
if(_window.normCont)
{
_window.normCont.activateGrayState(false);
}
}
else
{
_window.gotoAndStop("norm");
if(_window.normCont)
{
_window.normCont.activateGrayState(true);
}
_currentECardImageBase.img.filters = [new ColorMatrixFilter([0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0,0,0,1,0])];
}
}
}
private function onECardImageLoaded() : void
{
_currentECardImageBase.img.scaleX = _currentECardImageBase.img.scaleY = 0.255;
if(_window)
{
_window.itemWindow.addChild(_currentECardImageBase.img);
update();
}
_loadingSpiral.destroy();
_loadingSpiral = null;
}
}
}
@@ -0,0 +1,66 @@
package gui.itemWindows
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
public class ItemWindowGame extends ItemWindowBase
{
public function ItemWindowGame(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("gameBtnCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get itemLayer() : MovieClip
{
return _window.itemLayer;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
if(_currItem)
{
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
{
_window.itemLayer.addChild(_currItem[_iconLayerName]);
}
else
{
_window.itemLayer.addChild(DisplayObject(_currItem));
}
}
}
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null)
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener("rollOver",_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener("rollOut",_mouseOut,false,0,true);
}
if(_memberOnlyDown != null)
{
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
}
}
}
}
}
@@ -0,0 +1,147 @@
package gui.itemWindows
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import game.MinigameInfo;
import game.MinigameManager;
import loader.MediaHelper;
import localization.LocalizationManager;
public class ItemWindowGameIcon extends ItemWindowBase
{
private var _mediaHelper:MediaHelper;
private var _currGameDefId:int;
private var _mgf:MinigameInfo;
private var _toolTipName:String = "";
public function ItemWindowGameIcon(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_currGameDefId = int(param2);
super(4314,param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get itemYLocation() : Number
{
return _itemYLocation;
}
public function get itemXLocation() : Number
{
return _itemXLocation;
}
public function get toolTipName() : String
{
return _toolTipName;
}
public function get currGamDefId() : int
{
return _currGameDefId;
}
public function get currWindow() : MovieClip
{
return _window;
}
public function get currItem() : MovieClip
{
if(!(_currItem is int))
{
return _currItem as MovieClip;
}
return null;
}
public function extraGems() : MovieClip
{
if(_window.mouse.mouse.tripleGems.visible)
{
return _window.mouse.mouse.tripleGems;
}
return _window.mouse.mouse.doubleGems;
}
public function get gameLaunchObject() : Object
{
return {"typeDefId":_mgf.gameDefId};
}
public function get readyForPVP() : Boolean
{
if(_mgf)
{
return _mgf.readyForPVP;
}
return false;
}
public function get minigameInfo() : MinigameInfo
{
return _mgf;
}
public function get isCancelVisible() : Boolean
{
return _window.cancelBtn.visible;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(_currItem is int && !_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_mgf = MinigameManager.minigameInfoCache.getMinigameInfo(_currGameDefId);
_toolTipName = LocalizationManager.translateIdOnly(_mgf.titleStrId);
if(_mgf)
{
if(_mgf.gemMultiplier > 1)
{
if(_mgf.gemMultiplier > 2)
{
_window.mouse.mouse.tripleGems.visible = true;
}
else
{
_window.mouse.mouse.doubleGems.visible = true;
}
}
if(MinigameManager.joinGameObj != null && MinigameManager.joinGameObj.mi.gameDefId == minigameInfo.gameDefId)
{
_window.cancelBtn.visible = true;
}
_mediaHelper = new MediaHelper();
_mediaHelper.init(_mgf.gameLibraryIconMediaId,onCurrItemLoaded);
}
}
}
override protected function setChildrenAndInitialConditions() : void
{
_window.mouse.mouse.doubleGems.visible = false;
_window.mouse.mouse.tripleGems.visible = false;
_window.cancelBtn.visible = false;
}
private function onCurrItemLoaded(param1:MovieClip) : void
{
if(param1)
{
_currItem = param1.getChildAt(0);
_isCurrItemLoaded = true;
_currItem.x += _currItem.width * 0.5;
_currItem.y += _currItem.height * 0.5;
_window.mouse.mouse.itemWindow.addChild(DisplayObject(_currItem));
}
}
}
}
@@ -0,0 +1,55 @@
package gui.itemWindows
{
import avatar.AvatarInfo;
public class ItemWindowHeart extends ItemWindowBase
{
private var _frameName:String = "fullHeart";
private var _hpPercentage:Number;
private var _isEmptyHeart:Boolean;
private var _numTotalHearts:Number = _loc11_.healthBase * 0.5;
public function ItemWindowHeart(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_hpPercentage = param9.hpPercentage;
var _loc11_:AvatarInfo = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
var _loc12_:Number = 100 / _numTotalHearts;
var _loc10_:Number = Math.min(_numTotalHearts,_hpPercentage / _loc12_);
var _loc13_:int = Math.ceil(_loc10_);
if(param4 + 1 == _loc13_)
{
if(_loc13_ - _loc10_ >= 0.5 && _numTotalHearts == _loc10_)
{
_frameName = "halfHeart";
}
else
{
_frameName = _loc13_ - _loc10_ >= 0.5 ? "halfEmpty" : "fullHeart";
}
}
else if(param4 + 1 > _loc13_ && _loc13_ < _numTotalHearts)
{
_isEmptyHeart = true;
if(param4 + 1 == Math.ceil(_numTotalHearts) && _loc13_ - _loc10_ >= 0.5)
{
_frameName = "halfCont";
}
else
{
_frameName = "emptyHeart";
}
}
super("questHudHeart",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function updateFrame() : void
{
_window.gotoAndStop(_frameName);
}
}
}
@@ -0,0 +1,131 @@
package gui.itemWindows
{
import Enums.AdoptAPetDef;
import adoptAPet.AdoptAPetData;
import adoptAPet.AdoptAPetManager;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.filters.ColorMatrixFilter;
import gui.LoadingSpiral;
import loader.MediaHelper;
public class ItemWindowLargeIcon extends ItemWindowBase
{
private var _newIcon:MovieClip;
private var _itemWindow:MovieClip;
private var _icons:MovieClip;
private var _currAdoptAPetDef:AdoptAPetDef;
private var _currAdoptAPetData:AdoptAPetData;
private var _mediaHelper:MediaHelper;
private var _hasLoaded:Boolean;
private var _currAdoptAPetIcon:Sprite;
private var _loadingSpiral:LoadingSpiral;
private var _isForMyself:Boolean;
private var _defIdSeenUpdated:int;
public function ItemWindowLargeIcon(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
if(param2 is AdoptAPetData)
{
_currAdoptAPetData = param2 as AdoptAPetData;
_currAdoptAPetDef = AdoptAPetManager.getAdoptAPetDef(_currAdoptAPetData.defId);
param2 = _currAdoptAPetDef;
}
else if(param2 is AdoptAPetDef)
{
_currAdoptAPetDef = param2 as AdoptAPetDef;
}
_isForMyself = param9.isForMyself;
super("iconWindowJazwares",param1,param2,param3,param4,param5,param6,param7,param8,true);
}
public function get currAdoptAPetDef() : AdoptAPetDef
{
return _currAdoptAPetDef;
}
public function get defIdSeenUpdated() : int
{
return _defIdSeenUpdated;
}
override protected function setChildrenAndInitialConditions() : void
{
_newIcon = _window.newIcon;
_newIcon.visible = false;
_itemWindow = _window.itemWindow;
_icons = _window.icons;
_window.gray.visible = false;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_hasLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_loadingSpiral = new LoadingSpiral(_itemWindow,_itemWindow.width * 0.5,_itemWindow.height * 0.5);
_hasLoaded = true;
_mediaHelper = new MediaHelper();
_mediaHelper.init(_currAdoptAPetDef.mediaRefId,onCurrItemLoaded);
}
}
override protected function addEventListeners() : void
{
addEventListener("rollOver",onWindowRollOver,false,0,true);
addEventListener("rollOut",onWindowRollOut,false,0,true);
}
override protected function removeEventListeners() : void
{
removeEventListener("rollOver",onWindowRollOver);
removeEventListener("rollOut",onWindowRollOut);
}
private function onCurrItemLoaded(param1:MovieClip) : void
{
if(_window)
{
_currAdoptAPetIcon = param1.getChildAt(0) as Sprite;
_currAdoptAPetIcon.x = _itemWindow.width * 0.5;
_currAdoptAPetIcon.y = _itemWindow.height * 0.5;
_itemWindow.addChild(_currAdoptAPetIcon);
_icons.gotoAndStop(_currAdoptAPetDef.type + 1);
if(_currAdoptAPetData == null)
{
_currAdoptAPetIcon.filters = [new ColorMatrixFilter([0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0,0,0,1,0])];
_icons.filters = _currAdoptAPetIcon.filters;
_window.gray.visible = true;
}
else
{
_newIcon.visible = !_currAdoptAPetData.hasBeenSeen;
}
if(_isForMyself && _newIcon.visible)
{
AdoptAPetManager.setUsableAdoptAPetDefAsSeen(currAdoptAPetDef.defId);
_defIdSeenUpdated = currAdoptAPetDef.defId;
}
}
_loadingSpiral.destroy();
_loadingSpiral = null;
_mediaHelper.destroy();
_mediaHelper = null;
}
}
}
@@ -0,0 +1,132 @@
package gui.itemWindows
{
import den.DenItem;
import flash.display.MovieClip;
import gui.LoadingSpiral;
import masterpiece.MasterpieceDisplayItem;
public class ItemWindowMasterpiece extends ItemWindowBase
{
private var _masterpieceDisplayItem:MasterpieceDisplayItem;
protected var _selectedItems:Array;
public function ItemWindowMasterpiece(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_selectedItems = param9 as Array;
super("itemWindow",param1,param2,param3,param4,param5,param6,param7,param8,true);
}
public function get inUse() : Boolean
{
return _window.cir.currentFrameLabel == "down";
}
public function set inUse(param1:Boolean) : void
{
if(param1)
{
_window.cir.gotoAndStop("down");
}
else
{
_window.cir.gotoAndStop("up");
}
}
public function get currItem() : DenItem
{
return _currItem as DenItem;
}
public function cloneItem(param1:Function = null) : MovieClip
{
return _masterpieceDisplayItem.clone(param1);
}
public function update(param1:Boolean) : void
{
inUse = param1;
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
addEventListeners();
super.onWindowLoadCallback();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded && _currItem)
{
for each(var _loc3_:Object in _selectedItems)
{
if(_loc3_.iid == currItem.invIdx)
{
inUse = true;
}
}
_spiral = new LoadingSpiral(_window.iconLayer);
_isCurrItemLoaded = true;
_masterpieceDisplayItem = new MasterpieceDisplayItem();
_masterpieceDisplayItem.init(currItem,onMasterpieceItemLoaded);
}
}
override public function destroy() : void
{
if(_masterpieceDisplayItem)
{
_masterpieceDisplayItem.destroy();
_masterpieceDisplayItem = null;
}
super.destroy();
}
override protected function setChildrenAndInitialConditions() : void
{
resetVisibility();
_window.scaleX = _window.scaleY = 1.5;
_window.sizeCont.scaleX = _window.sizeCont.scaleY = 1.5;
}
private function onMasterpieceItemLoaded(param1:MasterpieceDisplayItem, param2:MovieClip) : void
{
var _loc3_:Number = NaN;
if(_window)
{
_loc3_ = _window.iconLayer.width / Math.max(_masterpieceDisplayItem.width,_masterpieceDisplayItem.height);
_masterpieceDisplayItem.scaleX = _masterpieceDisplayItem.scaleY = _loc3_;
_window.iconLayer.addChild(_masterpieceDisplayItem);
_spiral.destroy();
}
}
private function resetVisibility() : void
{
_window.lock.visible = false;
_window.lockOpen.visible = false;
_window.gray.visible = false;
_window.gift.visible = false;
_window.addBtn.visible = false;
_window.removeBtn.visible = false;
_window.ocean.visible = false;
_window.rare.visible = false;
_window.avtSpecific.visible = false;
_window.avtSpecificIcon.visible = false;
_window.avtSpecificHighlight.visible = false;
_window.rareDiamondTag.visible = false;
_window.diamond.visible = false;
_window.customDiamond.visible = false;
_window.previewBtn.visible = false;
_window.certBtn.visible = false;
_window.shopItem.visible = false;
super.onWindowRollOut(null);
}
}
}
@@ -0,0 +1,89 @@
package gui.itemWindows
{
import avatar.AvatarManager;
import avatar.NameBar;
import localization.LocalizationManager;
public class ItemWindowNameBar extends ItemWindowBase
{
private var _isMember:Boolean;
private var _nameBarData:Object;
private var _userName:String;
private var _avName:String;
private var _isBuddy:Boolean;
private var _isBlocked:Boolean;
private var _specificWidth:Number;
private var _moderatedUserName:String;
public function ItemWindowNameBar(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_isMember = param2.isMember;
_nameBarData = param2.nameBarData;
_userName = param2.userName;
_avName = param2.avName;
_isBuddy = param2.isBuddy;
_isBlocked = param2.isBlocked;
_specificWidth = param9 ? param9.specificWidth : -1;
_moderatedUserName = param2.moderatedUserName;
super(_isMember ? "memberNameBar" : "FreeNameBar",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get userName() : String
{
return _userName;
}
public function updateToBeCentered(param1:int) : void
{
_window.x += (param1 - _window.width) * 0.5;
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
addEventListeners();
super.onWindowLoadCallback();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
}
override protected function setChildrenAndInitialConditions() : void
{
if(_isMember)
{
_window.setNubType(_isBuddy ? NameBar.BUDDY : NameBar.NON_BUDDY);
_window.setColorAndBadge(_nameBarData);
}
else
{
_window.iconIds = AvatarManager.playerAvatarWorldView.nameBarIconIds;
}
_window.isBlocked = _isBlocked;
(_window as NameBar).setAvName(LocalizationManager.translateAvatarName(_moderatedUserName),true,null,true,_specificWidth);
_window.x += (_window as NameBar)["sizeCont"].width * 0.25;
_window.y += (_window as NameBar)["sizeCont"].height * 0.25;
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null)
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
}
}
}
}
@@ -0,0 +1,136 @@
package gui.itemWindows
{
import flash.display.MovieClip;
import loader.MediaHelper;
public class ItemWindowNameBarIcon extends ItemWindowBase
{
private var _currColorId:int;
private var _loadIcons:Boolean;
private var _icon1:MovieClip;
private var _icon2:MovieClip;
private var _iconsMediaHelper:MediaHelper;
private var _callbackFunction:Function;
private var _triedToLoadCurrItem:Boolean;
private var _isLoadingIcon:Boolean;
public function ItemWindowNameBarIcon(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_currColorId = param9.currColorId;
_loadIcons = param9.loadIcons;
_callbackFunction = param9.callbackFunction;
super("selNub",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get mouse() : MovieClip
{
return _window.nub.mouse;
}
public function update(param1:int) : void
{
_currColorId = param1;
setChildrenAndInitialConditions();
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
addEventListeners();
super.onWindowLoadCallback();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(_currItem && !_isCurrItemLoaded && !_loadIcons && _window.nub.hasOwnProperty("mouse"))
{
_isCurrItemLoaded = true;
_window.nub.mouse.gotoAndStop(1);
_window.nub.mouse.mouse.light.addChild(_currItem.iconMouse);
_window.nub.mouse.up.light.addChild(_currItem.iconUp);
}
else
{
_triedToLoadCurrItem = true;
}
}
override protected function setChildrenAndInitialConditions() : void
{
if(_currItem)
{
_window["updateColor"](_currColorId);
_window.scaleX = 1.5;
_window.scaleY = 1.5;
if(_loadIcons && !_isLoadingIcon)
{
_window.y += _window.height * 0.5;
while(_window.nub.mouse.mouse.light.numChildren > 0)
{
_window.nub.mouse.mouse.light.removeChildAt(0);
}
while(_window.nub.mouse.up.light.numChildren > 0)
{
_window.nub.mouse.up.light.removeChildAt(0);
}
_window.nub.mouse.gotoAndStop(1);
loadIcon();
}
}
else
{
_window.visible = false;
}
}
private function loadIcon() : void
{
_isLoadingIcon = true;
_iconsMediaHelper = new MediaHelper();
_iconsMediaHelper.init(int(_currItem),onIconsLoaded);
}
private function onIconsLoaded(param1:MovieClip) : void
{
if(param1 && _window)
{
if(_icon1 == null)
{
_icon1 = param1;
_iconsMediaHelper = new MediaHelper();
_iconsMediaHelper.init(int(_currItem),onIconsLoaded);
}
else
{
_loadIcons = false;
_icon2 = param1;
_currItem = {
"iconMouse":_icon1,
"iconUp":_icon2
};
_callbackFunction(_icon1,_icon2,_index);
_icon1 = null;
_icon2 = null;
_callbackFunction = null;
_iconsMediaHelper.destroy();
_iconsMediaHelper = null;
if(_triedToLoadCurrItem)
{
loadCurrItem();
}
}
}
}
}
}
@@ -0,0 +1,205 @@
package gui.itemWindows
{
import avatar.Avatar;
import avatar.AvatarDef;
import avatar.AvatarUtility;
import avatar.AvatarView;
import collection.AccItemCollection;
import com.sbi.corelib.input.SBTextField;
import com.sbi.graphics.LayerAnim;
import flash.events.MouseEvent;
import flash.geom.Point;
import gui.LoadingSpiral;
import item.EquippedAvatars;
import item.Item;
import localization.LocalizationManager;
import playerWall.PostMessage;
public class ItemWindowNotification extends ItemWindowBase
{
private var _hasSetInitialConditions:Boolean;
private var _smileyText:SBTextField;
private var _dispAvtView:AvatarView;
private var _isNew:Boolean;
public function ItemWindowNotification(param1:Function, param2:Object, param3:String, param4:int, param5:Function, param6:Function, param7:Function, param8:Function, param9:Boolean = false)
{
super(6322,param1,param2,param3,param4,param5,onNotificationOver,onNotificationOut,param8,param9);
}
public function get senderUserName() : String
{
return PostMessage(_currItem).senderUserName;
}
public function get senderUUID() : String
{
return PostMessage(_currItem).senderUUID;
}
public function get messageId() : String
{
return PostMessage(_currItem).msgId;
}
public function get moderatedUsername() : String
{
return PostMessage(_currItem).senderModeratedUserName;
}
public function get parentOrCurrMessageId() : String
{
if(PostMessage(_currItem).parentMessageId != null && PostMessage(_currItem).parentMessageId.length > 0)
{
return PostMessage(_currItem).parentMessageId;
}
return PostMessage(_currItem).msgId;
}
public function get isRead() : Boolean
{
return PostMessage(_currItem).isRead;
}
public function update() : void
{
var _loc1_:Number = new Date().valueOf();
_loc1_ += Utility.getTimeOffset();
var _loc2_:Object = Utility.calculateTime((_loc1_ - _currItem.postTime) / 1000);
if(_loc2_.mins < 0)
{
_loc2_.mins = 0;
}
if(_loc2_.mins == 0 && _loc2_.hours < 1 && _loc2_.days < 1)
{
_window.timeTxt.text = Utility.calculatePrintTimeToNearest(_loc2_.mins,_loc2_.hours,true,_loc2_.days);
}
else
{
LocalizationManager.translateIdAndInsert(_window.timeTxt,11360,Utility.calculatePrintTimeToNearest(_loc2_.mins,_loc2_.hours,true,_loc2_.days));
}
}
public function updateWithInput(param1:PostMessage) : void
{
if(_smileyText && param1)
{
_smileyText.text = param1.message;
}
}
override public function setStatesForVisibility(param1:Boolean, param2:Object = null) : void
{
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(_currItem && !_isCurrItemLoaded)
{
_isCurrItemLoaded = true;
setChildrenAndInitialConditions();
addEventListeners();
setupCurrAvtImage();
}
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
super.onWindowLoadCallback();
}
override protected function setChildrenAndInitialConditions() : void
{
if(_window)
{
if(!_hasSetInitialConditions)
{
_hasSetInitialConditions = true;
_window.timeTxt.autoSize = "right";
LocalizationManager.updateToFit(_window.nameTxt,_currItem.senderModeratedUserName);
if(!_currItem.isRead)
{
_window.gotoAndStop("new");
LocalizationManager.translateId(_window.newIcon.txt,24420);
_isNew = true;
}
if(_window.newIcon != null)
{
_window.newIcon.visible = !_currItem.isRead;
}
if(!_spiral)
{
_spiral = new LoadingSpiral(_window.iconLayer);
}
else
{
_spiral.setNewParent(_window.iconLayer);
}
_smileyText = new SBTextField(null,_window.messageTxt,_window.textItemHolder,true);
_smileyText.text = _currItem.message;
_smileyText.mouseEnabled = false;
_smileyText.selectable = false;
update();
}
}
}
private function onNotificationOver(param1:MouseEvent) : void
{
param1.stopPropagation();
_window.gotoAndStop("selected");
}
private function onNotificationOut(param1:MouseEvent) : void
{
param1.stopPropagation();
_window.gotoAndStop(_isNew ? "new" : "norm");
}
private function setupCurrAvtImage() : void
{
var _loc3_:Avatar = new Avatar();
_loc3_.init(-1,-1,"",_currItem.avtDefId,_currItem.avtColors,_currItem.avtCustomId,null,_currItem.senderUserName);
var _loc2_:AccItemCollection = new AccItemCollection();
var _loc1_:Item = new Item();
_loc2_.setAccItem(0,_loc1_);
_loc1_.init(1,1,0,EquippedAvatars.forced());
_loc1_ = new Item();
_loc2_.setAccItem(1,_loc1_);
_loc1_.init(_currItem.avtEyeDefId > 0 ? _currItem.avtEyeDefId : 2,2,0,EquippedAvatars.forced());
var _loc4_:AvatarDef = gMainFrame.userInfo.getAvatarDefByAvatar(_loc3_);
if(_currItem.avtCustomId != -1 && _loc4_ && _currItem.avtPatternDefId < 1)
{
_currItem.avtPatternDefId = _loc4_.patternRefIds[0];
}
if(_currItem.avtPatternDefId > 0)
{
_loc1_ = new Item();
_loc2_.setAccItem(2,_loc1_);
_loc1_.init(_currItem.avtPatternDefId,3,0,EquippedAvatars.forced());
}
_loc3_.itemResponseIntegrate(_loc2_);
_dispAvtView = new AvatarView();
_dispAvtView.init(_loc3_,null);
_dispAvtView.playAnim(15,false,1,onDisplayAvatarLoaded,true);
}
private function onDisplayAvatarLoaded(param1:LayerAnim, param2:int) : void
{
var _loc3_:Point = AvatarUtility.getAvatarHudPosition(_dispAvtView.avTypeId);
_dispAvtView.scaleX = _window.charCont.width / _dispAvtView.width;
_dispAvtView.scaleY = _window.charCont.height / _dispAvtView.height;
_dispAvtView.x = _dispAvtView.scaleX * (_loc3_.x + _window.charCont.width * 0.5) + 10;
_dispAvtView.y = _dispAvtView.scaleY * (_loc3_.y + _window.charCont.height * 0.5) + 10;
_window.charCont.charLayer.addChild(_dispAvtView);
}
}
}
@@ -0,0 +1,667 @@
package gui.itemWindows
{
import avatar.AvatarManager;
import den.DenItem;
import den.DenMannequinInventory;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import gui.LoadingSpiral;
import inventory.Iitem;
import item.Item;
import pet.GuiPet;
import pet.PetItem;
import pet.PetManager;
import shop.ShopManager;
public class ItemWindowOriginal extends ItemWindowBase
{
private var _isAvatarEditor:Boolean;
private var _isTradeList:Boolean;
private var _isChoosingForTradeList:Boolean;
private var _generatorIndex:int;
private var _giftItemIdx:int;
private var _isDownGift:Boolean;
private var _isPetItem:Boolean;
private var _isActivePet:Boolean;
private var _isAudio:Boolean;
private var _isLastPlacedAudio:Boolean;
private var _isTradeManager:Boolean;
private var _isECard:Boolean;
private var _isViewingATradeList:Boolean;
private var _isRecycling:Boolean;
private var _loadImmediately:Boolean;
private var _showAddRemoveBtns:Boolean;
private var _hasBeenHidden:Boolean;
private var _inUse:Boolean;
private var _hasSetInitialConditions:Boolean;
private var _avInvId:int;
private var _mannequinInvIdx:int;
private var _hasSetState:Boolean;
private var _isSellShop:Boolean;
public function ItemWindowOriginal(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
var _loc11_:int = 0;
var _loc10_:int = param4;
_generatorIndex = param4;
if(param9 != null)
{
_loadImmediately = param9.loadImmediately;
_isRecycling = param9.isRecycling;
_isViewingATradeList = param9.isViewingATradeList;
_isECard = param9.isECard;
_isAvatarEditor = param9.isAvatarEditor;
_isTradeManager = param9.isTradeManager;
_isAudio = param9.isAudio;
_isPetItem = param9.isPetItem;
_giftItemIdx = param9.giftItemIdx;
_isTradeList = param9.isTradeList;
_isChoosingForTradeList = param9.isChoosingForTradeList;
_isSellShop = param9.isSellShop;
_showAddRemoveBtns = param9.showAddRemoveBtns;
_avInvId = param9.avInvId ? param9.avInvId : gMainFrame.userInfo.playerAvatarInfo.avInvId;
_mannequinInvIdx = _isAvatarEditor ? param9.mannequinInvIdx : -1;
if(param9.indexArray != null)
{
_loc11_ = int(param9.indexArray.length);
_loc10_ = int(_loc11_ - 1 >= param4 ? param9.indexArray[param4] : param4);
}
}
super("itemWindow",param1,param2,param3,_loc10_,param5,param6,param7,param8,true);
}
public function get removeBtn() : MovieClip
{
return _window.removeBtn;
}
public function get addBtn() : MovieClip
{
return _window.addBtn;
}
public function get cir() : MovieClip
{
return _window.cir;
}
public function get sizeCont() : MovieClip
{
return _window.sizeCont;
}
public function get gift() : MovieClip
{
return _window.gift;
}
public function get isDownGift() : Boolean
{
return _isDownGift;
}
public function get isActivePet() : Boolean
{
return _isActivePet;
}
public function get isLastPlacedAudio() : Boolean
{
return _isLastPlacedAudio;
}
public function get isAudio() : Boolean
{
return _isAudio;
}
public function get isUsable() : Boolean
{
return _currItem == null;
}
public function get currItem() : Object
{
return _currItem;
}
public function get itemName() : String
{
if(_currItem)
{
return _currItem.name;
}
return "";
}
public function get isInUse() : Boolean
{
return _inUse;
}
public function get mannequinInvIdx() : int
{
return _mannequinInvIdx;
}
override public function get numChildren() : int
{
return _window.numChildren;
}
override public function getChildAt(param1:int) : DisplayObject
{
return _window.getChildAt(param1);
}
public function resetDownGift() : void
{
if(_window)
{
_window.gift.visible = false;
}
_isDownGift = false;
}
public function set currDownGift(param1:Object) : void
{
_isDownGift = true;
_window.gift.visible = true;
}
public function resetAudioDown() : void
{
_isLastPlacedAudio = false;
_window.cir.gotoAndStop("up");
}
public function setAudioDown() : void
{
_isLastPlacedAudio = true;
_window.cir.gotoAndStop("down");
}
public function get defId() : int
{
if(_currItem)
{
return _currItem.defId;
}
return -1;
}
public function get avtSpecific() : MovieClip
{
return _window.avtSpecific;
}
public function get hasBeenHidden() : Boolean
{
return _hasBeenHidden;
}
public function removeLoadedItem() : void
{
_hasBeenHidden = true;
if(_currItem)
{
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
{
if(_currItem[_iconLayerName].parent == _window.iconLayer)
{
_window.iconLayer.removeChild(_currItem[_iconLayerName]);
}
}
else if(_currItem.parent == _window.iconLayer)
{
_window.iconLayer.removeChild(_currItem);
}
}
resetDownGift();
resetAudioDown();
resetVisibility();
super.removeEventListeners();
}
public function update() : void
{
if(_currItem)
{
if(_isCurrItemLoaded && !_hasBeenHidden)
{
if(_mannequinInvIdx != -1 && _currItem as DenItem)
{
(_currItem as DenItem).rebuildMannequin();
}
_hasSetState = false;
setStates();
}
}
}
public function updateWithInput(param1:*) : void
{
_hasBeenHidden = false;
_currItem = param1;
_isCurrItemLoaded = false;
_hasSetState = false;
removeEventListeners();
loadCurrItem();
addEventListeners();
}
public function resetWindowToOriginalState() : void
{
_hasSetInitialConditions = false;
_hasBeenHidden = false;
_isCurrItemLoaded = false;
_hasSetState = false;
removeEventListeners();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_hasSetInitialConditions)
{
setChildrenAndInitialConditions();
}
if(_currItem && !_isCurrItemLoaded && !_hasBeenHidden)
{
_isCurrItemLoaded = true;
if(_currItem is PetItem)
{
(_currItem as PetItem).imageLoadedCallback = onPetItemLoaded;
}
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
{
_window.iconLayer.addChild(_currItem[_iconLayerName]);
}
else
{
_window.iconLayer.addChild(DisplayObject(_currItem));
}
setStates();
}
else if(_currItem == null)
{
_isCurrItemLoaded = false;
resetVisibility();
resetDownGift();
resetAudioDown();
if(_showAddRemoveBtns && (_isTradeList || _isTradeManager))
{
_window.addBtn.visible = true;
}
while(_window.iconLayer.numChildren > 1)
{
_window.iconLayer.removeChildAt(_window.iconLayer.numChildren - 1);
}
}
}
override public function setStatesForVisibility(param1:Boolean, param2:Object = null) : void
{
if(!param1)
{
_isCurrItemLoaded = false;
if(_currItem != null && currItem.hasOwnProperty("destroy"))
{
_currItem.destroy();
}
while(_window.iconLayer.numChildren > 1)
{
_window.iconLayer.removeChildAt(_window.iconLayer.numChildren - 1);
}
setChildrenAndInitialConditions();
}
this.visible = param1;
if(param1 && _currItem != null && _currItem is DenItem)
{
if(DenItem(_currItem).petItem)
{
DenItem(_currItem).setVersion(DenItem(_currItem).petItem.petBits[0],DenItem(_currItem).petItem.petBits[1],DenItem(_currItem).petItem.petBits[2]);
}
else
{
DenItem(_currItem).setVersion(DenItem(_currItem).version);
}
if(DenItem(_currItem).mannequinData != null)
{
DenItem(_currItem).mannequinData.setToAvatarBoxFrame();
}
}
}
private function setStates() : void
{
var _loc1_:Iitem = null;
if(!_hasSetState)
{
_hasSetState = true;
if(_isTradeManager)
{
if(_currItem is Item)
{
_loc1_ = _currItem as Item;
_currItem = _loc1_.clone();
}
else if(_currItem is PetItem)
{
_loc1_ = _currItem as PetItem;
_currItem = _loc1_.clone();
}
else
{
_loc1_ = _currItem as DenItem;
_currItem = _loc1_.clone();
}
}
if(_currItem.isMemberOnly)
{
if(!gMainFrame.userInfo.isMember)
{
_window.lock.visible = true;
if(!isSpecialList())
{
_window.gray.visible = true;
}
}
else
{
_window.lockOpen.visible = true;
}
}
if(_currItem.isOcean)
{
_window.ocean.visible = true;
}
if(_currItem.isRareDiamond)
{
_window.rareDiamondTag.visible = true;
}
else if(_currItem.isCustom)
{
_window.customDiamond.visible = true;
_window.previewBtn.visible = _mouseDown != null ? true : false;
}
else
{
if(_currItem.isRare)
{
_window.rare.visible = true;
}
_window.diamond.visible = _currItem.isDiamond;
}
if(_showAddRemoveBtns && (_isTradeList || _isTradeManager || _isSellShop))
{
_window.removeBtn.visible = true;
_window.addBtn.visible = false;
}
if(_currItem is Item)
{
if(_currItem.getInUse(_avInvId))
{
_window.cir.gotoAndStop("down");
_inUse = true;
}
else
{
_window.cir.gotoAndStop("up");
_inUse = false;
}
if(_isAvatarEditor && !_isTradeList && !_isSellShop)
{
if((_currItem as Item).enviroType != AvatarManager.roomEnviroType || _mannequinInvIdx != -1 && !DenMannequinInventory.canUseItem((_currItem as Item).invIdx,_mannequinInvIdx))
{
_window.cir.gotoAndStop("gray");
}
}
}
else if(_currItem is DenItem)
{
if(_currItem.categoryId != 0 && !_isActivePet)
{
_isLastPlacedAudio = true;
_window.cir.gotoAndStop("down");
_inUse = true;
}
else
{
_window.cir.gotoAndStop("up");
_inUse = false;
}
if(_currItem.refId == 1)
{
if(_currItem.invIdx == PetManager.myActivePetInvId)
{
_window.cir.gotoAndStop("green");
_isActivePet = true;
}
if(_mouseDown != null && (!DenItem(_currItem).petItem.isEgg || Boolean(DenItem(_currItem).petItem.isHatched)))
{
_window.certBtn.visible = true;
}
else
{
_window.certBtn.visible = false;
}
}
if(_currItem.specialType == 7 || _currItem.specialType == 6)
{
_window.consumerItemBtn.visible = true;
_window.consumerItemBtn.activateGrayState(_currItem.specialType == 6);
}
}
else if(_currItem is PetItem || _isPetItem)
{
if(_currItem.invIdx == PetManager.myActivePetInvId)
{
_window.cir.gotoAndStop("green");
_isActivePet = true;
}
if(_mouseDown != null && (!PetItem(_currItem).isEgg || Boolean(PetItem(_currItem).isHatched)))
{
_window.certBtn.visible = true;
}
else
{
_window.certBtn.visible = false;
}
if(_currItem.isRare)
{
_window.rare.visible = true;
}
}
if(_currItem is Iitem && (_currItem as Iitem).isInDenShop)
{
if(ShopManager.currentOpenShopId != (_currItem as Iitem).denStoreInvId)
{
_window.shopItem.visible = true;
}
}
if(_isECard)
{
if(_giftItemIdx == _currItem.invIdx)
{
this.gift.visible = true;
_isDownGift = true;
}
}
}
}
override protected function setChildrenAndInitialConditions() : void
{
if(!_hasSetInitialConditions)
{
_hasSetInitialConditions = true;
if(_currItem)
{
if(!_spiral)
{
_spiral = new LoadingSpiral(_window.iconLayer);
}
else
{
_spiral.setNewParent(_window.iconLayer);
}
if(!_currItem.isIconLoaded)
{
_currItem.imageLoadedCallback = _spiral.destroy();
}
else
{
_spiral.destroy();
}
if(_loadImmediately)
{
loadCurrItem();
}
}
else if(_showAddRemoveBtns && (_isTradeList || _isTradeManager))
{
_window.addBtn.visible = true;
}
addEventListeners();
}
}
override protected function onWindowLoadCallback() : void
{
if(_windowLoadedCallback != null)
{
resetVisibility();
if(_loadImmediately)
{
setChildrenAndInitialConditions();
}
_windowLoadedCallback(this,_generatorIndex);
}
}
override protected function addEventListeners() : void
{
if(_window && _currItem)
{
if(_mouseDown != null && !(_currItem.isMemberOnly && _memberOnlyDown != null && !gMainFrame.userInfo.isMember && !isSpecialList()))
{
addEventListener("mouseDown",_mouseDown,false,0,true);
_window.previewBtn.addEventListener("mouseDown",_mouseDown,false,0,true);
_window.certBtn.addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener("rollOver",_mouseOver,false,0,true);
if(_useToolTip)
{
addEventListener("rollOver",onWindowRollOver,false,0,true);
}
}
if(_mouseOut != null)
{
addEventListener("rollOut",_mouseOut,false,0,true);
if(_useToolTip)
{
addEventListener("rollOut",onWindowRollOut,false,0,true);
}
}
if(_memberOnlyDown != null && _currItem.isMemberOnly && !gMainFrame.userInfo.isMember && !isSpecialList())
{
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
}
}
else if(_showAddRemoveBtns && (_isTradeList || _isTradeManager))
{
if(_mouseDown != null)
{
addEventListener("mouseDown",_mouseDown,false,0,true);
_window.previewBtn.addEventListener("mouseDown",_mouseDown,false,0,true);
_window.certBtn.addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener("rollOver",_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener("rollOut",_mouseOut,false,0,true);
}
}
}
override protected function removeEventListeners() : void
{
super.removeEventListeners();
if(Boolean(_mouseDown))
{
_window.previewBtn.removeEventListener("mouseDown",_mouseDown);
_window.certBtn.removeEventListener("mouseDown",_mouseDown);
}
}
private function isSpecialList() : Boolean
{
return _isTradeList || _isTradeManager || _isChoosingForTradeList || _isViewingATradeList || _isECard || _isRecycling;
}
private function resetVisibility() : void
{
_window.lock.visible = false;
_window.lockOpen.visible = false;
_window.gray.visible = false;
_window.gift.visible = false;
_window.addBtn.visible = false;
_window.removeBtn.visible = false;
_window.ocean.visible = false;
_window.rare.visible = false;
_window.avtSpecific.visible = false;
_window.avtSpecificIcon.visible = false;
_window.avtSpecificHighlight.visible = false;
_window.rareDiamondTag.visible = false;
_window.diamond.visible = false;
_window.customDiamond.visible = false;
_window.previewBtn.visible = false;
_window.certBtn.visible = false;
_window.shopItem.visible = false;
_window.consumerItemBtn.visible = false;
super.onWindowRollOut(null);
}
private function onPetItemLoaded(param1:MovieClip, param2:GuiPet) : void
{
var _loc3_:Number = NaN;
if(_window)
{
_loc3_ = _window.iconLayer.width / Math.max(param1.width,param1.height);
param1.scaleX = param1.scaleY = _loc3_;
param1.y = _window.iconLayer.height * 0.5 - 20;
}
}
}
}
@@ -0,0 +1,139 @@
package gui.itemWindows
{
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import gui.WindowAndScrollbarGenerator;
import gui.WindowGenerator;
public class ItemWindowOriginalImages extends ItemWindowOriginal
{
private var _images:Array;
private var _giftNames:Array;
private var _eCards:Array;
public function ItemWindowOriginalImages(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_images = param9.images as Array;
_giftNames = param9.giftNames as Array;
_eCards = param9.eCards as Array;
param2 = _images[param4];
super(param1,param2,param3,param4,param5,param6,param7,param8,null);
}
override protected function setChildrenAndInitialConditions() : void
{
resetVisibility();
if(_spiral)
{
_spiral.destroy();
}
}
override public function updateWithInput(param1:*) : void
{
_images = param1.images as Array;
_giftNames = param1.giftNames as Array;
_eCards = param1.eCards as Array;
_currItem = _images[index];
_isCurrItemLoaded = false;
setChildrenAndInitialConditions();
loadCurrItem();
addEventListeners();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
var _loc4_:Number = NaN;
var _loc3_:Point = null;
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded && _currItem)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
_loc4_ = _window.iconLayer.width / Math.max(_currItem.width,_currItem.height);
_currItem.scaleX = _currItem.scaleY = _loc4_;
_loc3_ = getAnchorPoint(_currItem as DisplayObject);
_currItem.x = -_currItem.width * 0.5 + _loc3_.x;
_currItem.y = -_currItem.height * 0.5 + _loc3_.y;
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
{
_window.iconLayer.addChild(_currItem[_iconLayerName]);
}
else
{
_window.iconLayer.addChild(DisplayObject(_currItem));
}
}
}
override protected function addEventListeners() : void
{
if(_window && _currItem)
{
addEventListener("rollOver",onWindowRollOver,false,0,true);
addEventListener("rollOut",onWindowRollOut,false,0,true);
}
}
override protected function onWindowRollOver(param1:MouseEvent) : void
{
if(_useToolTip && this.parent != null)
{
if(_windowGenerator == null)
{
if(this.parent.parent is WindowGenerator)
{
_windowGenerator = WindowGenerator(this.parent.parent);
}
else
{
_windowGenerator = WindowAndScrollbarGenerator(this.parent.parent);
}
}
if(_currItem && _windowGenerator.isIndexInView(_visibilityIndex))
{
_windowGenerator.toolTip.init(_windowGenerator.parent.parent,_giftNames[index],this.x + _windowGenerator.boxWidth * 0.5 - _itemXLocation + _windowGenerator.parent.x,this.y + _windowGenerator.boxHeight - _itemYLocation + _windowGenerator.parent.y - 5);
_windowGenerator.toolTip.startTimer(param1);
}
}
}
private function resetVisibility() : void
{
_window.lock.visible = false;
_window.lockOpen.visible = false;
_window.gray.visible = false;
_window.gift.visible = false;
_window.addBtn.visible = false;
_window.removeBtn.visible = false;
_window.ocean.visible = false;
_window.rare.visible = false;
_window.avtSpecific.visible = false;
_window.avtSpecificIcon.visible = false;
_window.avtSpecificHighlight.visible = false;
_window.rareDiamondTag.visible = false;
_window.diamond.visible = false;
_window.customDiamond.visible = false;
_window.previewBtn.visible = false;
_window.certBtn.visible = false;
super.onWindowRollOut(null);
}
private function getAnchorPoint(param1:DisplayObject) : Point
{
var _loc2_:Point = new Point();
var _loc3_:Rectangle = param1.getRect(param1);
_loc2_.x = -1 * _loc3_.x;
_loc2_.y = -1 * _loc3_.y;
return _loc2_;
}
}
}
@@ -0,0 +1,229 @@
package gui.itemWindows
{
import Party.PartyManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import gui.WindowAndScrollbarGenerator;
import gui.WindowGenerator;
import localization.LocalizationManager;
public class ItemWindowParty extends ItemWindowBase
{
private var _defId:int;
private var _isGame:Boolean;
private var _additionalIndex:int;
private var _partyDef:Object;
private var _printTimeFunc:Function;
private var _creatorName:String;
private var _customPartyName:String = "";
private var _customPartyTimeLeft:Number = 0;
private var _isCustom:Boolean;
public function ItemWindowParty(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
var _loc10_:int = 0;
_additionalIndex = param9.additionalIndex;
_printTimeFunc = param9.printTimeFunc;
if(param2 != null && !(param2 is int))
{
_creatorName = param2.creator;
_customPartyName = param2.name;
_customPartyTimeLeft = param2.timeLeft;
_partyDef = PartyManager.getPartyDef(param2.defId);
_loc10_ = int(_partyDef.mediaRefId);
param2 = param2.defId;
_useToolTip = true;
}
else
{
_loc10_ = int(param9.mediaRefId[param4]);
}
super(_loc10_,param1,param2,param3,param4,param5,param6,param7,param8,_useToolTip);
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
addEventListeners();
super.onWindowLoadCallback();
}
override protected function setChildrenAndInitialConditions() : void
{
_window.anims.mouseEnabled = false;
_window.anims.mouseChildren = false;
_window.txt.mouseEnabled = false;
_window.txt.mouseChildren = false;
if(_currItem || _partyDef != null)
{
if(_partyDef == null)
{
_partyDef = PartyManager.getPartyDef(_currItem as int);
}
_defId = int(_partyDef.id);
_isGame = _partyDef.isGame == "1";
_isCustom = _partyDef.isCustom == "1";
setupTextAndAnims(_printTimeFunc != null ? _printTimeFunc(_isCustom ? _customPartyTimeLeft : index) : "");
if(_customPartyName != "")
{
titleTextWithString = _customPartyName;
}
else if(int(_partyDef.titleStrId) != 0)
{
titleText = _partyDef.titleStrId;
}
}
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_useToolTip)
{
addEventListener("rollOver",onWindowRollOver,false,0,true);
addEventListener("rollOut",onWindowRollOut,false,0,true);
}
if(_mouseOver != null)
{
addEventListener("rollOver",_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener("rollOut",_mouseOut,false,0,true);
}
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
{
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
}
}
}
override protected function onWindowRollOver(param1:MouseEvent) : void
{
if(_windowGenerator == null)
{
if(this.parent.parent is WindowGenerator)
{
_windowGenerator = WindowGenerator(this.parent.parent);
}
else
{
_windowGenerator = WindowAndScrollbarGenerator(this.parent.parent);
}
}
if(_windowGenerator.isIndexInView(_visibilityIndex))
{
_windowGenerator.toolTip.init(_windowGenerator.parent.parent,_printTimeFunc != null ? _printTimeFunc(_isCustom ? _customPartyTimeLeft : index) : "",this.x + _windowGenerator.boxWidth * 0.5 - _itemXLocation + _windowGenerator.parent.x,this.y + _windowGenerator.boxHeight - _itemYLocation + _windowGenerator.parent.y);
_windowGenerator.toolTip.startTimer(param1);
}
}
override protected function onWindowRollOut(param1:MouseEvent) : void
{
_windowGenerator.toolTip.resetTimerAndSetVisibility();
}
override public function setStatesForVisibility(param1:Boolean, param2:Object = null) : void
{
}
public function setupTextAndAnims(param1:String) : void
{
if(_window)
{
if(_customPartyName != "")
{
_window.goBtn.visible = true;
}
else if(param1 != "")
{
_window.goBtn.visible = false;
if(_window.txt.timeTxt)
{
LocalizationManager.updateToFit(_window.txt.timeTxt,param1);
}
}
else
{
_window.goBtn.visible = true;
if(_window.txt.timeTxt)
{
_window.txt.timeTxt.visible = false;
}
_window.anims.animate();
}
}
}
public function get additionalIndex() : int
{
return _additionalIndex;
}
public function get txt() : MovieClip
{
return _window.txt;
}
public function set titleText(param1:int) : void
{
if(_window.txt.titleTxtCont && _window.txt.titleTxtCont.hasOwnProperty("titleTxt"))
{
LocalizationManager.translateId(_window.txt.titleTxtCont.titleTxt,param1);
}
}
public function set titleTextWithString(param1:String) : void
{
if(_window.txt.titleTxtCont && _window.txt.titleTxtCont.hasOwnProperty("titleTxt"))
{
LocalizationManager.updateToFit(_window.txt.titleTxtCont.titleTxt,param1);
}
}
public function set defId(param1:int) : void
{
_defId = param1;
}
public function get defId() : int
{
return _defId;
}
public function set isGame(param1:Boolean) : void
{
_isGame = param1;
}
public function get isGame() : Boolean
{
return _isGame;
}
public function get timeLeft() : int
{
return _customPartyTimeLeft;
}
public function get sizeCont() : MovieClip
{
return _window.sizeCont;
}
}
}
@@ -0,0 +1,70 @@
package gui.itemWindows
{
public class ItemWindowPattern extends ItemWindowBase
{
public static const TYPE_SWATCH:String = "swatch";
public static const TYPE_MESSAGE:String = "message";
public static const TYPE_POST:String = "post";
public static const TYPE_REPLY:String = "reply";
private var _type:String;
private var _patternIndexOrName:Object;
private var _colorIndexOrName:Object;
public function ItemWindowPattern(param1:Function, param2:Object, param3:String, param4:int, param5:Function, param6:Function, param7:Function, param8:Function, param9:Object)
{
_type = param9.type;
_patternIndexOrName = param9.patternIndex != null ? param9.patternIndex : param4 + 1;
_colorIndexOrName = param9.colorIndex != null ? param9.colorIndex : 1;
super(param2,param1,param2,param3,param4,param5,param6,param7,param8,false);
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
addEventListeners();
super.onWindowLoadCallback();
}
override protected function setChildrenAndInitialConditions() : void
{
if(_window)
{
_window.gotoAndStop(_type);
_window[_type + "Btn"].pattern.gotoAndStop(_patternIndexOrName);
_window[_type + "Btn"].updateColor(_colorIndexOrName);
}
}
public function getCurrentPatternIndex() : int
{
return _window[_type + "Btn"].pattern.currentFrame;
}
public function setPatternAndColor(param1:Object, param2:Object) : void
{
_colorIndexOrName = param2;
_patternIndexOrName = param1;
setChildrenAndInitialConditions();
}
public function setColor(param1:Object) : void
{
_colorIndexOrName = param1;
setChildrenAndInitialConditions();
}
public function setPattern(param1:Object) : void
{
_patternIndexOrName = param1;
setChildrenAndInitialConditions();
}
}
}
@@ -0,0 +1,271 @@
package gui.itemWindows
{
import avatar.AvatarManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import gui.LoadingSpiral;
import gui.WindowAndScrollbarGenerator;
import pet.GuiPet;
import pet.PetDef;
import pet.PetManager;
public class ItemWindowPets extends ItemWindowBase
{
private var _isRecycling:Boolean;
private var _currGuiPet:GuiPet;
public function ItemWindowPets(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_isRecycling = param9.isRecycling;
super("itemWindowPets",param1,param2,param3,param4,param5,param6,param7,param8,true);
}
public function get cir() : MovieClip
{
return _window.cir;
}
public function get gray() : MovieClip
{
return _window.gray;
}
public function get cageIcon() : MovieClip
{
return _window.cageIcon;
}
public function get newPetIcon() : MovieClip
{
return _window.newPet;
}
public function get hasPet() : Boolean
{
return _currItem;
}
public function get sizeCont() : MovieClip
{
return _window.sizeCont;
}
public function get shopItem() : MovieClip
{
return _window.shopItem;
}
public function update(param1:Object) : void
{
if("petObject" in param1)
{
if(_currGuiPet)
{
_currGuiPet.updateAllBits(param1.petObject.lBits,param1.petObject.uBits,param1.petObject.eBits);
}
}
else if("isRecycling" in param1)
{
_isRecycling = param1.isRecycling;
if(_currItem)
{
_window.cageIcon.visible = _isRecycling;
}
}
}
public function removeLoadedItem() : void
{
if(_currGuiPet)
{
_window.iconLayer.removeChild(_currGuiPet);
_currGuiPet.destroy();
_currGuiPet = null;
}
_currItem = null;
setChildrenAndInitialConditions();
_spiral.visible = false;
_window.newPet.visible = true;
}
override public function destroy() : void
{
if(_currGuiPet)
{
_currGuiPet.destroy();
_currGuiPet = null;
}
_spiral = null;
super.destroy();
}
override public function setStatesForVisibility(param1:Boolean, param2:Object = null) : void
{
if(_currGuiPet)
{
if(!param1)
{
_isCurrItemLoaded = false;
_window.iconLayer.removeChild(_currGuiPet);
_currGuiPet.destroy();
_currGuiPet = null;
}
}
this.visible = param1;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
var _loc3_:PetDef = null;
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
if(_currItem)
{
if(_spiral)
{
_spiral.visible = true;
}
_loc3_ = PetManager.getPetDef(_currItem.defId);
_currGuiPet = new GuiPet(_currItem.createdTs,_currItem.idx,_currItem.lBits,_currItem.uBits,_currItem.eBits,_currItem.type,_currItem.name,_currItem.personalityDefId,_currItem.favoriteToyDefId,_currItem.favoriteFoodDefId,onPetLoaded);
_window.cageIcon.visible = _isRecycling;
if(_currGuiPet.isEggAndHasNotHatched())
{
_window.ocean.visible = false;
}
else
{
_window.ocean.visible = _currGuiPet.canGoInOcean();
}
if(!gMainFrame.userInfo.isMember)
{
_window.lockOpen.visible = false;
if(_loc3_.isMember)
{
_window.gray.visible = true;
_window.lock.visible = true;
}
else
{
_window.lock.visible = false;
_window.gray.visible = false;
}
}
else
{
_window.lock.visible = false;
_window.gray.visible = false;
if(_loc3_.isMember)
{
_window.lockOpen.visible = true;
}
else
{
_window.lockOpen.visible = false;
}
}
trace(_currItem.denStoreInvId);
if(_currItem.denStoreInvId > 0)
{
_window.shopItem.visible = true;
}
_window.newPet.visible = false;
if(!PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_loc3_,_currItem.createdTs))
{
_window.gray.visible = true;
}
else if(PetManager.myActivePetInvId == _currGuiPet.idx)
{
_window.cir.gotoAndStop("down");
}
_window.rare.visible = _loc3_.status == 4;
_currGuiPet.scaleX = _currGuiPet.scaleY = 2;
_isCurrItemLoaded = true;
_window.iconLayer.addChild(_currGuiPet);
return;
}
_window.newPet.visible = true;
}
if(_spiral)
{
_spiral.destroy();
}
}
override protected function setChildrenAndInitialConditions() : void
{
if(_spiral == null)
{
_spiral = new LoadingSpiral(_window.iconLayer,0,-_window.iconLayer.height * 0.5);
}
_window.lockOpen.visible = false;
_window.lock.visible = false;
_window.gray.visible = false;
_window.ocean.visible = false;
_window.cageIcon.visible = false;
_window.newPet.gray.visible = false;
_window.newPet.visible = false;
_window.rare.visible = false;
_window.shopItem.visible = false;
_window.cir.gotoAndStop("up");
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_mouseOver != null && _currItem)
{
addEventListener("rollOver",_mouseOver,false,0,true);
if(_useToolTip)
{
addEventListener("rollOver",onWindowRollOver,false,0,true);
}
}
if(_mouseOut != null && _currItem)
{
addEventListener("rollOut",_mouseOut,false,0,true);
if(_useToolTip)
{
addEventListener("rollOut",onWindowRollOut,false,0,true);
}
}
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
{
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
}
}
}
override protected function onWindowRollOver(param1:MouseEvent) : void
{
if(_currItem && _useToolTip && this.parent != null)
{
if(_windowGenerator == null)
{
_windowGenerator = WindowAndScrollbarGenerator(this.parent.parent);
}
_windowGenerator.toolTip.init(_windowGenerator.parent.parent,_currGuiPet.petName,this.x + _windowGenerator.boxWidth * 0.5 + _windowGenerator.parent.x + _itemXLocation,this.y + _windowGenerator.boxHeight - _itemYLocation + _windowGenerator.parent.y - 5);
_windowGenerator.toolTip.startTimer(param1);
}
}
private function onPetLoaded(param1:MovieClip, param2:GuiPet) : void
{
if(_spiral)
{
_spiral.destroy();
}
}
}
}
@@ -0,0 +1,72 @@
package gui.itemWindows
{
import flash.display.MovieClip;
import gui.LoadingSpiral;
import loader.MediaHelper;
public class ItemWindowPlayerWallDecor extends ItemWindowBase
{
private var _clone:MovieClip;
private var _mediaHelper:MediaHelper;
private var _currMediaId:int;
private var _loadingSpiral:LoadingSpiral;
public function ItemWindowPlayerWallDecor(param1:Function, param2:Object, param3:String, param4:int, param5:Function, param6:Function, param7:Function, param8:Function, param9:Boolean = false)
{
_currMediaId = int(param2);
super(param2,param1,null,param3,param4,param5,param6,param7,param8,param9);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
}
}
override protected function addEventListeners() : void
{
if(_mouseDown != null)
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
}
public function downToUpState() : void
{
if(_window)
{
_window.downToUpState();
}
}
public function getClone(param1:Function) : MovieClip
{
_clone = new MovieClip();
_loadingSpiral = new LoadingSpiral(_clone);
_mediaHelper = new MediaHelper();
_mediaHelper.init(_currMediaId,onCloneLoaded,param1);
return _clone;
}
private function onCloneLoaded(param1:MovieClip) : void
{
_loadingSpiral.destroy();
_clone.addChild(param1);
if(param1.passback != null)
{
param1.passback();
}
}
}
}
@@ -0,0 +1,377 @@
package gui.itemWindows
{
import avatar.Avatar;
import avatar.AvatarDef;
import avatar.AvatarUtility;
import avatar.AvatarView;
import avatar.AvatarXtCommManager;
import buddy.Buddy;
import buddy.BuddyList;
import buddy.BuddyManager;
import collection.AccItemCollection;
import com.sbi.corelib.input.SBTextField;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Point;
import gui.LoadingSpiral;
import item.EquippedAvatars;
import item.Item;
import loader.MediaHelper;
import localization.LocalizationManager;
import playerWall.PostMessage;
public class ItemWindowPost extends ItemWindowBase
{
private var _iconMediaHelper:MediaHelper;
private var _onReportDown:Function;
private var _onDeleteDown:Function;
private var _onReplyDown:Function;
private var _smileyText:SBTextField;
private var _isMyPost:Boolean;
private var _patternWindow:ItemWindowPattern;
private var _hasSetInitialConditions:Boolean;
public function ItemWindowPost(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_onReportDown = param9.reportMsgBtnMouseDown;
_onDeleteDown = param9.deleteMsgBtnMouseDown;
_onReplyDown = param9.replyMsgBtnMouseDown;
_isMyPost = param9.isMyPost;
tabEnabled = false;
super(1501,param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get msgId() : String
{
return _currItem.msgId;
}
public function get senderUserName() : String
{
return _currItem.senderUserName;
}
public function get senderModeratedUserName() : String
{
return _currItem.senderModeratedUserName;
}
public function get parentOrMyPostMessageId() : String
{
if((_currItem as PostMessage).parentMessageId != null)
{
return (_currItem as PostMessage).parentMessageId;
}
return msgId;
}
public function get sizeCont() : MovieClip
{
return MovieClip(_window.parent).sizeCont;
}
public function darken(param1:Boolean) : void
{
if(_window)
{
_window.darkCont.visible = param1;
}
}
public function update() : void
{
var _loc1_:Number = new Date().valueOf();
_loc1_ += Utility.getTimeOffset();
var _loc2_:Object = Utility.calculateTime((_loc1_ - _currItem.postTime) / 1000);
if(_loc2_.mins < 0)
{
_loc2_.mins = 0;
}
if(_loc2_.mins == 0 && _loc2_.hours < 1 && _loc2_.days < 1)
{
_window.dark.timeTxt.text = Utility.calculatePrintTimeToNearest(_loc2_.mins,_loc2_.hours,true,_loc2_.days);
}
else
{
LocalizationManager.translateIdAndInsert(_window.dark.timeTxt,11360,Utility.calculatePrintTimeToNearest(_loc2_.mins,_loc2_.hours,true,_loc2_.days));
}
}
public function updateWithInput(param1:PostMessage) : void
{
if(_smileyText && param1)
{
_smileyText.text = param1.message;
}
}
override public function destroy() : void
{
removeEventListeners();
if(_iconMediaHelper)
{
_iconMediaHelper.destroy();
_iconMediaHelper = null;
}
_onReportDown = null;
_onDeleteDown = null;
if(_smileyText)
{
_smileyText.destroy();
_smileyText = null;
}
_window = null;
_windowLoadedCallback = null;
_currItem = null;
_mouseDown = null;
_mouseOver = null;
_mouseOut = null;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(_currItem && !_isCurrItemLoaded)
{
if(!_spiral)
{
_spiral = new LoadingSpiral(_window.iconLayer);
}
else
{
_spiral.setNewParent(_window.iconLayer);
}
_smileyText = new SBTextField(null,_window.dark.messageTxt,_window.textItemHolder,true);
_smileyText.text = _currItem.message;
_smileyText.mouseEnabled = false;
_smileyText.selectable = false;
if(!_isMyPost)
{
_window.reportMessageBtn.x += _window.reportMessageBtn.width;
}
_isCurrItemLoaded = true;
setupCurrAvtImage();
}
}
override public function setStatesForVisibility(param1:Boolean, param2:Object = null) : void
{
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
super.onWindowLoadCallback();
}
override protected function setChildrenAndInitialConditions() : void
{
if(!_hasSetInitialConditions)
{
_hasSetInitialConditions = true;
if(_currItem)
{
if(_currItem.senderUserName.toLowerCase() == gMainFrame.userInfo.myUserName.toLowerCase())
{
if(hasParent())
{
_window.gotoAndStop("playerReply");
_window = _window.playerReply;
}
else
{
_window.gotoAndStop("player");
_window = _window.player;
}
}
else if(hasParent())
{
_window.gotoAndStop("buddiesReply");
_window = _window.buddiesReply;
}
else
{
_window.gotoAndStop("buddies");
_window = _window.buddies;
}
darken(false);
loadPostPattern();
_window.reportMessageBtn.visible = false;
_window.deleteMessageBtn.visible = false;
_window.replyMessageBtn.visible = false;
_window.updateColor(_currItem.colorId);
_window.dark.messageTxt.text = "";
_window.dark.messageTxt.selectable = false;
LocalizationManager.updateToFit(_window.dark.nameTxt,_currItem.senderModeratedUserName);
_window.dark.timeTxt.autoSize = "right";
if(_window.newIcon != null)
{
_window.newIcon.visible = false;
}
if(_currItem.isBuddy && _currItem.senderUserName.toLowerCase() != gMainFrame.userInfo.myUserName.toLowerCase())
{
_window.buddyIcon.visible = true;
}
else
{
_window.buddyIcon.visible = false;
}
update();
}
addEventListeners();
}
}
override protected function addEventListeners() : void
{
if(_isMyPost)
{
_window.deleteMessageBtn.addEventListener("mouseDown",_onDeleteDown,false,0,true);
}
_window.reportMessageBtn.addEventListener("mouseDown",_onReportDown,false,0,true);
_window.replyMessageBtn.addEventListener("mouseDown",_onReplyDown,false,0,true);
_window.darkCont.addEventListener("mouseDown",onDarkCont,false,0,true);
addEventListener("rollOver",onPostRollOverOut,false,0,true);
addEventListener("rollOut",onPostRollOverOut,false,0,true);
addEventListener("mouseDown",onPostDown,false,0,true);
}
override protected function removeEventListeners() : void
{
if(_isMyPost)
{
_window.deleteMessageBtn.removeEventListener("mouseDown",_onDeleteDown);
}
_window.reportMessageBtn.removeEventListener("mouseDown",_onReportDown);
_window.replyMessageBtn.removeEventListener("mouseDown",_onReplyDown);
_window.darkCont.removeEventListener("mouseDown",onDarkCont);
removeEventListener("rollOver",onPostRollOverOut);
removeEventListener("rollOut",onPostRollOverOut);
removeEventListener("mouseDown",onPostDown);
}
private function hasParent() : Boolean
{
return (_currItem as PostMessage).parentMessageId != null && (_currItem as PostMessage).parentMessageId.length > 0;
}
private function onDarkCont(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onPostDown(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_window && _currItem.senderUserName.toLowerCase() != gMainFrame.userInfo.myUserName.toLowerCase())
{
BuddyList.requestBuddyListIfNeeded(onBuddyListRequested);
}
}
private function onBuddyListRequested() : void
{
var _loc1_:Buddy = BuddyManager.getBuddyByUserName(_currItem.senderUserName);
if(_loc1_)
{
BuddyManager.showBuddyCard({
"userName":_loc1_.userName,
"onlineStatus":_loc1_.onlineStatus
});
return;
}
AvatarXtCommManager.requestAvatarGet(_currItem.senderUserName,onUserLookUpReceived,true);
}
private function onUserLookUpReceived(param1:String, param2:Boolean, param3:int) : void
{
if(param2)
{
BuddyManager.showBuddyCard({
"userName":param1,
"onlineStatus":param3
});
}
}
private function onPostRollOverOut(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_window)
{
if(_window.messageHighlight.currentFrameLabel != "on")
{
_window.messageHighlight.gotoAndStop("on");
_window.reportMessageBtn.visible = _currItem.senderUserName != gMainFrame.userInfo.myUserName;
_window.replyMessageBtn.visible = true;
if(_isMyPost)
{
_window.deleteMessageBtn.visible = true;
}
}
else
{
_window.messageHighlight.gotoAndStop("off");
_window.reportMessageBtn.visible = false;
_window.replyMessageBtn.visible = false;
if(_isMyPost)
{
_window.deleteMessageBtn.visible = false;
}
}
}
}
private function loadPostPattern() : void
{
_patternWindow = new ItemWindowPattern(null,3983,"",0,null,null,null,null,{
"type":(hasParent() ? "reply" : "message"),
"colorIndex":_currItem.colorId,
"patternIndex":_currItem.patternId
});
_window.messageBodyHolder.addChild(_patternWindow);
}
private function setupCurrAvtImage() : void
{
var _loc5_:Avatar = new Avatar();
_loc5_.init(-1,-1,"",_currItem.avtDefId,_currItem.avtColors,_currItem.avtCustomId,null,_currItem.senderUserName);
var _loc3_:AccItemCollection = new AccItemCollection();
var _loc2_:Item = new Item();
_loc3_.setAccItem(0,_loc2_);
_loc2_.init(1,1,0,EquippedAvatars.forced());
_loc2_ = new Item();
_loc3_.setAccItem(1,_loc2_);
_loc2_.init(_currItem.avtEyeDefId > 0 ? _currItem.avtEyeDefId : 2,2,0,EquippedAvatars.forced());
var _loc6_:AvatarDef = gMainFrame.userInfo.getAvatarDefByAvatar(_loc5_);
if(_currItem.avtCustomId != -1 && _loc6_ && _currItem.avtPatternDefId < 1)
{
_currItem.avtPatternDefId = _loc6_.patternRefIds[0];
}
if(_currItem.avtPatternDefId > 0)
{
_loc2_ = new Item();
_loc3_.setAccItem(2,_loc2_);
_loc2_.init(_currItem.avtPatternDefId,3,0,EquippedAvatars.forced());
}
_loc5_.itemResponseIntegrate(_loc3_);
var _loc1_:AvatarView = new AvatarView();
_loc1_.init(_loc5_,null);
_loc1_.playAnim(15,false,1,null,true);
var _loc4_:Point = AvatarUtility.getAvatarHudPosition(_loc1_.avTypeId);
_loc1_.x = _loc4_.x + _window.charCont.width * 0.5;
_loc1_.y = _loc4_.y + _window.charCont.height * 0.5;
_window.charCont.charLayer.addChild(_loc1_);
}
}
}
@@ -0,0 +1,57 @@
package gui.itemWindows
{
import currency.UserCurrency;
public class ItemWindowSatchel extends ItemWindowBase
{
private var _count:int;
private var _scale:Number = 1;
private var _frame:String = "shop";
public function ItemWindowSatchel(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_count = UserCurrency.getCurrency(UserCurrency.usableCraftTypes[param4]);
if(param9)
{
_scale = param9.scale;
_frame = param9.frame;
}
super(param2,param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
}
}
override protected function setChildrenAndInitialConditions() : void
{
if(_window.currentFrameLabel != _frame)
{
_window.gotoAndStop(_frame);
}
if(_window.scaleX != _scale)
{
_window.scaleX = _window.scaleY = _scale;
}
_window.txt.text = Utility.convertNumberToString(_count);
}
public function update() : void
{
_count = UserCurrency.getCurrency(UserCurrency.usableCraftTypes[index]);
setChildrenAndInitialConditions();
}
}
}
@@ -0,0 +1,122 @@
package gui.itemWindows
{
import flash.display.MovieClip;
import flash.text.TextField;
public class ItemWindowServer extends ItemWindowBase
{
public function ItemWindowServer(param1:Function, param2:MovieClip, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("serverBarSml",param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
}
}
override protected function setChildrenAndInitialConditions() : void
{
_window.txt.mouseEnabled = false;
_window.buddy.mouseEnabled = false;
_window.g1.mouseEnabled = false;
_window.g2.mouseEnabled = false;
_window.g3.mouseEnabled = false;
_window.o1.mouseEnabled = false;
_window.o2.mouseEnabled = false;
_window.o3.mouseEnabled = false;
_window.full.mouseEnabled = false;
_window.full.mouseChildren = false;
}
public function get full() : Boolean
{
return _window.full.visible;
}
public function set text(param1:String) : void
{
_window.txt.text = param1;
}
public function get textField() : TextField
{
return _window.txt;
}
public function set buddy(param1:Boolean) : void
{
_window.buddy.visible = param1;
}
public function set flag(param1:int) : void
{
_window.flag.gotoAndStop(param1);
}
public function set population(param1:String) : void
{
switch(param1)
{
case "0":
_window.full.visible = false;
_window.o1.visible = false;
_window.o2.visible = false;
_window.o3.visible = false;
break;
case "1":
_window.o1.visible = true;
_window.o2.visible = false;
_window.o3.visible = false;
_window.full.visible = false;
break;
case "2":
_window.o1.visible = true;
_window.o2.visible = true;
_window.o3.visible = false;
_window.full.visible = false;
break;
case "3":
_window.o1.visible = true;
_window.o2.visible = true;
_window.o3.visible = true;
_window.full.visible = false;
break;
case "4":
_window.full.visible = true;
}
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null)
{
addEventListener("mouseDown",_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener("rollOver",_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener("rollOut",_mouseOut,false,0,true);
}
if(_memberOnlyDown != null)
{
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
}
}
}
}
}
@@ -0,0 +1,44 @@
package gui.itemWindows
{
import ecard.ECardImageBase;
public class ItemWindowStamp extends ItemWindowBase
{
private var stampImageBase:ECardImageBase;
public function ItemWindowStamp(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("StampBtn",param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(_currItem && !_isCurrItemLoaded)
{
_isCurrItemLoaded = true;
setChildrenAndInitialConditions();
addEventListeners();
stampImageBase = new ECardImageBase();
stampImageBase.init(int(_currItem),onImageLoaded);
}
}
private function onImageLoaded() : void
{
if(_iconLayerName != "" && stampImageBase.hasOwnProperty(_iconLayerName))
{
_window.imgLayer.addChild(stampImageBase[_iconLayerName]);
}
stampImageBase[_iconLayerName].scaleX = 0.6;
stampImageBase[_iconLayerName].scaleY = 0.6;
}
override protected function setChildrenAndInitialConditions() : void
{
}
}
}
@@ -0,0 +1,75 @@
package gui.itemWindows
{
import den.DenItem;
import flash.display.MovieClip;
import gui.LoadingSpiral;
import playerWall.StickerItem;
public class ItemWindowSticker extends ItemWindowMasterpiece
{
private var _stickerItem:StickerItem;
public function ItemWindowSticker(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super(param1,param2,param3,param4,param5,param6,param7,param8,param9);
}
override public function get currItem() : DenItem
{
throw new Error("This is not applicable to stickers");
}
public function get stickerMediaId() : int
{
return _currItem as int;
}
override public function cloneItem(param1:Function = null) : MovieClip
{
return _stickerItem.clone(param1);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded && _currItem != null)
{
_isCurrItemLoaded = true;
for each(var _loc3_:Object in _selectedItems)
{
if(_loc3_.id == _currItem)
{
inUse = true;
}
}
_spiral = new LoadingSpiral(_window.iconLayer);
_stickerItem = new StickerItem(int(_currItem),onStickerLoaded);
}
}
private function onStickerLoaded() : void
{
var _loc1_:Number = NaN;
if(_window)
{
_loc1_ = _window.iconLayer.width / Math.max(_stickerItem.width,_stickerItem.height);
_stickerItem.scaleX = _stickerItem.scaleY = _loc1_;
_window.iconLayer.addChild(_stickerItem);
_spiral.destroy();
}
}
override public function destroy() : void
{
if(_stickerItem != null)
{
_stickerItem.destroy();
_stickerItem = null;
}
super.destroy();
}
}
}
@@ -0,0 +1,40 @@
package gui.itemWindows
{
import flash.text.TextField;
public class ItemWindowTextBar extends ItemWindowBase
{
public function ItemWindowTextBar(param1:Function, param2:String, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("userDenBtnCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded)
{
addEventListeners();
_isCurrItemLoaded = true;
}
if(_currItem)
{
_window.txt.text = _currItem;
}
}
public function get txt() : TextField
{
return _window.txt;
}
public function setText(param1:String) : void
{
_currItem = param1;
_window.txt.text = param1;
}
}
}
@@ -0,0 +1,94 @@
package gui.itemWindows
{
import flash.events.MouseEvent;
public class ItemWindowTextNode extends ItemWindowBase
{
private var _originalText:String;
public function ItemWindowTextNode(param1:Function, param2:String, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("chatTextNode",param1,param2,param3,param4,param5,param6,param7,param8);
}
override protected function onWindowLoadCallback() : void
{
setChildrenAndInitialConditions();
addEventListeners();
super.onWindowLoadCallback();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
}
override protected function setChildrenAndInitialConditions() : void
{
if(_currItem)
{
setupText();
}
addEventListener("rollOver",onRollOver,false,0,true);
addEventListener("rollOut",onRollOut,false,0,true);
}
override protected function removeEventListeners() : void
{
removeEventListener("rollOver",onRollOver);
removeEventListener("rollOut",onRollOut);
super.removeEventListeners();
}
public function get text() : String
{
return _originalText;
}
public function updateToBeCentered(param1:int) : void
{
_window.x += (param1 - _window.width) * 0.5;
}
private function setupText() : void
{
var _loc2_:int = 0;
var _loc1_:String = null;
_window.txt.text = _currItem;
_originalText = String(_currItem);
if(_window.txt.textWidth > _window.txt.width)
{
_window.txt.text = "";
_loc2_ = 0;
_loc1_ = "";
while(_window.txt.textWidth < _window.txt.width)
{
_loc1_ += String(_currItem).charAt(_loc2_);
_window.txt.text = _loc1_ + "...";
_loc2_++;
}
_window.txt.text = _loc1_.slice(0,_loc1_.length - 1) + "...";
}
}
private function onRollOver(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_window && _window.currentFrameLabel != "on")
{
_window.gotoAndStop("on");
AJAudio.playSubMenuBtnRollover();
}
}
private function onRollOut(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_window && _window.currentFrameLabel != "off")
{
_window.gotoAndStop("off");
}
}
}
}
@@ -0,0 +1,679 @@
package gui.itemWindows
{
import achievement.AchievementXtCommManager;
import com.sbi.corelib.audio.SBAudio;
import com.sbi.debug.DebugUtility;
import den.DenXtCommManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import gamePlayFlow.GamePlay;
import gui.CursorManager;
import gui.GuiHud;
import gui.GuiManager;
import gui.MySettings;
import gui.ServerSelector;
import localization.LocalizationManager;
import room.RoomManagerWorld;
public class ItemWindowToggle extends ItemWindowBase
{
private static const SLIDER_RECT:Rectangle = new Rectangle(15,15.5,82,0);
private var _lock:MovieClip;
private var _currHeight:int;
private var _mySettingsCloseFunction:Function;
private var _musicToggle:ItemWindowToggle;
public function ItemWindowToggle(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_mySettingsCloseFunction = param9.onClose;
super("mySettingsToggle|false",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get currFrameLabel() : String
{
return _currItem.frame;
}
public function resetConditions() : void
{
setChildrenAndInitialConditions();
}
override protected function onWindowLoadCallback() : void
{
super.onWindowLoadCallback();
addEventListeners();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
}
override public function get height() : Number
{
return _currHeight;
}
override protected function setChildrenAndInitialConditions() : void
{
var _loc1_:Boolean = false;
_currHeight = _window.height;
_window.goNowBtn.visible = false;
_window.woodenCursorBtn.visible = false;
_window.defaultCursorBtn.visible = false;
_window.toggleBtn.visible = false;
_window.toggleTxt.visible = false;
_window.scrubBtn.visible = false;
switch(_currItem.type)
{
case MySettings.TOGGLE_TYPE_TOGGLE_BTN:
_window.toggleBtn.visible = true;
_window.toggleBtn.toggleBtn.toggleKnob.gotoAndStop("up");
_window.toggleBtn.toggleBtn.toggleBG.gotoAndStop("up");
_window.icon.gotoAndStop(_currItem.frame);
_window.toggleBtn.addEventListener("mouseDown",handleMouseDown,false,0,true);
_window.toggleBtn.addEventListener("rollOver",handleMouseOver,false,0,true);
_window.toggleBtn.addEventListener("rollOut",handleMouseOut,false,0,true);
break;
case MySettings.TOGGLE_TYPE_TEXT:
_window.toggleTxt.visible = true;
_window.icon.gotoAndStop(_currItem.frame);
break;
case MySettings.TOGGLE_TYPE_CURSOR:
_window.woodenCursorBtn.visible = true;
_window.defaultCursorBtn.visible = true;
_window.icon.visible = false;
if(GuiManager.sharedObj && (GuiManager.sharedObj.data.cursor == "custom" || GuiManager.sharedObj.data.cursor == null))
{
_window.woodenCursorBtn.upToDownState();
_window.woodenCursorBtn.mouseEnabled = false;
_window.woodenCursorBtn.mouseChildren = false;
}
else
{
_window.defaultCursorBtn.upToDownState();
_window.defaultCursorBtn.mouseEnabled = false;
_window.defaultCursorBtn.mouseChildren = false;
}
_window.woodenCursorBtn.addEventListener("mouseDown",handleMouseDown,false,0,true);
_window.defaultCursorBtn.addEventListener("mouseDown",handleMouseDown,false,0,true);
break;
case MySettings.TOGGLE_TYPE_JOIN:
_window.goNowBtn.visible = true;
_window.goNowBtn.addEventListener("mouseDown",handleMouseDown,false,0,true);
_window.icon.gotoAndStop(_currItem.frame);
break;
case MySettings.TOGGLE_TYPE_SCRUB:
_window.scrubBtn.visible = true;
_window.icon.gotoAndStop("music");
_window.icon.music.gotoAndStop("startingOn");
_window.scrubBtn.addEventListener("mouseDown",handleMouseDown,false,0,true);
_window.addEventListener("mouseUp",handleMouseUp,false,0,true);
_window.addEventListener("mouseMove",handleMouseMove,false,0,true);
_window.addEventListener("rollOut",handleMouseOut,false,0,true);
_window.scrubBtn.scrubKnob.gotoAndStop("up");
_window.scrubBtn.scrubBG.gotoAndStop("up");
_window.scrubBtn.addEventListener("rollOver",handleMouseOver,false,0,true);
_window.scrubBtn.addEventListener("rollOut",handleMouseOut,false,0,true);
if(GuiManager.sharedObj && GuiManager.sharedObj.data.volume != null)
{
_window.scrubBtn.scrubKnob.x = GuiManager.sharedObj.data.volume * 82 + 15;
}
}
switch(_currItem.frame)
{
case "lock":
if(gMainFrame.userInfo.denPrivacySettings != 2)
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
else
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "world":
_window.goNowBtn.down.txt.text = ServerSelector.getShardName(RoomManagerWorld.instance.shardId);
_window.goNowBtn.mouse.mouse.txt.text = ServerSelector.getShardName(RoomManagerWorld.instance.shardId);
_window.goNowBtn.mouse.up.txt.text = ServerSelector.getShardName(RoomManagerWorld.instance.shardId);
break;
case "redeemCode":
case "verifyEmail":
case "twoFactor":
LocalizationManager.translateId(_window.goNowBtn.down.txt,_currItem.btnTxt);
LocalizationManager.translateId(_window.goNowBtn.mouse.mouse.txt,_currItem.btnTxt);
LocalizationManager.translateId(_window.goNowBtn.mouse.up.txt,_currItem.btnTxt);
break;
case "music":
if(SBAudio.isMusicMuted || SBAudio.areSoundsMuted)
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
else
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "buddyRequest":
if(Utility.isSettingOn(MySettings.SETTINGS_BUDDY_REQUESTS))
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
else
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "gameInvites":
if(Utility.isSettingOn(MySettings.SETTINGS_GAME_INVITES))
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
else
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "doorBell":
if(Utility.isSettingOn(MySettings.SETTINGS_DOOR_BELL))
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
else
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "autoServer":
if(Utility.isSettingOn(MySettings.SETTINGS_AUTO_SERVER_TRAVEL))
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
else
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "nameBadge":
if(Utility.isSettingOn(MySettings.SETTINGS_USERNAME_BADGE))
{
_window.toggleBtn.gotoAndStop("double");
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
}
else
{
_window.toggleBtn.gotoAndStop("double");
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "denPlayerIcon":
if(Utility.isSettingOn(MySettings.SETTINGS_DEN_PLAYER_ICON))
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
else
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "jammerWallIcon":
if(Utility.isSettingOn(MySettings.SETTINGS_JAMMER_WALL_ICON))
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
else
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "predictTxt":
_loc1_ = Utility.isSettingOn(MySettings.SETTINGS_CHAT_PREDICTION);
if(gMainFrame.userInfo.sgChatType == 1)
{
if(!Utility.hasChatSettingBeenSet())
{
_loc1_ = false;
}
}
if(_loc1_)
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
else
{
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "intro":
}
if(_currItem.labelTxt)
{
LocalizationManager.translateId(_window.labelTxtCont.labelTxt,_currItem.labelTxt);
}
}
private function handleMouseDown(param1:MouseEvent) : void
{
var _loc2_:Number = NaN;
var _loc5_:int = 0;
var _loc3_:String = null;
var _loc4_:Array = null;
var _loc6_:int = 0;
param1.stopPropagation();
if(_currItem.type == MySettings.TOGGLE_TYPE_TOGGLE_BTN)
{
switch(_currItem.frame)
{
case "lock":
_lock = MovieClip(param1.currentTarget);
GuiManager.onToggleDenLock(onDenLockUnlock);
break;
case "music":
handleMuteUnmute();
break;
case "buddyRequest":
case "gameInvites":
case "doorBell":
case "autoServer":
case "nameBadge":
case "denPlayerIcon":
case "jammerWallIcon":
case "predictTxt":
_loc2_ = Number(gMainFrame.userInfo.userVarCache.getUserVarValueById(363));
_loc5_ = -1;
if(_currItem.frame == "buddyRequest")
{
_loc5_ = MySettings.SETTINGS_BUDDY_REQUESTS;
}
else if(_currItem.frame == "gameInvites")
{
_loc5_ = MySettings.SETTINGS_GAME_INVITES;
}
else if(_currItem.frame == "doorBell")
{
_loc5_ = MySettings.SETTINGS_DOOR_BELL;
}
else if(_currItem.frame == "autoServer")
{
_loc5_ = MySettings.SETTINGS_AUTO_SERVER_TRAVEL;
}
else if(_currItem.frame == "nameBadge")
{
_loc5_ = MySettings.SETTINGS_USERNAME_BADGE;
}
else if(_currItem.frame == "denPlayerIcon")
{
_loc5_ = MySettings.SETTINGS_DEN_PLAYER_ICON;
}
else if(_currItem.frame == "jammerWallIcon")
{
_loc5_ = MySettings.SETTINGS_JAMMER_WALL_ICON;
}
else if(_currItem.frame == "predictTxt")
{
_loc5_ = MySettings.SETTINGS_CHAT_PREDICTION;
if(gMainFrame.userInfo.sgChatType == 1)
{
if(!Utility.hasChatSettingBeenSet())
{
AchievementXtCommManager.requestSetUserVar(363,_loc5_);
_loc2_ = 0;
}
}
if(!Utility.hasChatSettingBeenSet())
{
AchievementXtCommManager.requestSetUserVar(452,1);
}
}
if(_loc5_ != -1)
{
if(_loc2_ == -1)
{
if(_loc5_ == MySettings.SETTINGS_DOOR_BELL || _loc5_ == MySettings.SETTINGS_USERNAME_BADGE)
{
param1.currentTarget.toggleBtn.gotoAndPlay("on");
if(_window.icon["" + _window.icon.currentFrameLabel].currentLabel)
{
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
}
}
else
{
param1.currentTarget.toggleBtn.gotoAndPlay("off");
if(_window.icon["" + _window.icon.currentFrameLabel].currentLabel)
{
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
}
}
AchievementXtCommManager.requestSetUserVar(363,_loc5_);
}
else if(param1.currentTarget.toggleBtn.currentFrameLabel == "on" || param1.currentTarget.toggleBtn.currentFrameLabel == "startingOn")
{
param1.currentTarget.toggleBtn.gotoAndPlay("off");
if(_window.icon["" + _window.icon.currentFrameLabel].currentLabel)
{
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
}
if(_loc5_ == MySettings.SETTINGS_DOOR_BELL || _loc5_ == MySettings.SETTINGS_USERNAME_BADGE)
{
AchievementXtCommManager.requestSetUserVar(363,_loc5_,null,false);
}
else
{
AchievementXtCommManager.requestSetUserVar(363,_loc5_);
}
}
else
{
param1.currentTarget.toggleBtn.gotoAndPlay("on");
if(_window.icon["" + _window.icon.currentFrameLabel].currentLabel)
{
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
}
if(_loc5_ == MySettings.SETTINGS_DOOR_BELL || _loc5_ == MySettings.SETTINGS_USERNAME_BADGE)
{
AchievementXtCommManager.requestSetUserVar(363,_loc5_);
}
else
{
AchievementXtCommManager.requestSetUserVar(363,_loc5_,null,false);
}
}
if(_loc5_ == MySettings.SETTINGS_JAMMER_WALL_ICON)
{
GuiManager.updateMainHudButtons(false,{
"btnName":(GuiManager.mainHud as GuiHud).playerWallBtn.name,
"show":param1.currentTarget.toggleBtn.currentLabel == "on"
});
}
}
}
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
}
else if(_currItem.type == MySettings.TOGGLE_TYPE_CURSOR)
{
if(param1.currentTarget.mouse.currentFrame == 3)
{
param1.currentTarget.mouseEnabled = false;
param1.currentTarget.mouseChildren = false;
}
if(param1.currentTarget != _window.defaultCursorBtn)
{
GuiManager.setSharedObj("cursor","custom");
CursorManager.switchToCursor("custom_cursor");
_window.defaultCursorBtn.downToUpState();
_window.defaultCursorBtn.mouseEnabled = true;
_window.defaultCursorBtn.mouseChildren = true;
}
else
{
GuiManager.setSharedObj("cursor","default");
CursorManager.switchToCursor("Default_Cursor");
_window.woodenCursorBtn.downToUpState();
_window.woodenCursorBtn.mouseEnabled = true;
_window.woodenCursorBtn.mouseChildren = true;
}
}
else if(_currItem.type == MySettings.TOGGLE_TYPE_JOIN)
{
switch(_currItem.frame)
{
case "world":
ServerSelector.init(GuiManager.guiLayer,null,GamePlay(gMainFrame.gamePlay).joinChosenShardIdNode);
break;
case "intro":
GuiManager.startFFM();
break;
case "redeemCode":
if(_mySettingsCloseFunction != null)
{
_mySettingsCloseFunction(null);
}
GuiManager.openCodeRedemptionPopup();
break;
case "verifyEmail":
GuiManager.initEmailConfirmation(null,null,false);
break;
case "twoFactor":
_loc3_ = gMainFrame.clientInfo.websiteURL + "parents";
try
{
navigateToURL(new URLRequest(_loc3_),"_blank");
}
catch(e:Error)
{
DebugUtility.debugTrace("error with loading URL: " + _loc3_);
}
}
}
else if(_currItem.type == MySettings.TOGGLE_TYPE_SCRUB)
{
param1.currentTarget.scrubKnob.dragging = true;
param1.currentTarget.scrubKnob.startDrag(true,SLIDER_RECT);
if(_musicToggle == null)
{
_loc4_ = (this.parent.parent as MovieClip).mediaWindows;
_loc6_ = 0;
while(_loc6_ < _loc4_.length)
{
if(_loc4_[_loc6_].currFrameLabel == "music")
{
_musicToggle = _loc4_[_loc6_];
}
_loc6_++;
}
}
}
}
public function handleMouseMove(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_currItem.type == MySettings.TOGGLE_TYPE_SCRUB && _window.scrubBtn.scrubKnob.dragging)
{
SBAudio.setVolumeAll((int(_window.scrubBtn.scrubKnob.x - 15)) / 82);
}
}
private function handleMouseUp(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_currItem.type == MySettings.TOGGLE_TYPE_SCRUB)
{
handleStopScrubbing();
}
}
private function handleMouseOut(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_currItem.type == MySettings.TOGGLE_TYPE_TOGGLE_BTN)
{
if(param1.currentTarget.toggleBtn.toggleBG.currentFrameLabel != "up")
{
param1.currentTarget.toggleBtn.toggleBG.gotoAndStop("up");
}
if(param1.currentTarget.toggleBtn.toggleKnob.currentFrameLabel != "up")
{
param1.currentTarget.toggleBtn.toggleKnob.gotoAndStop("up");
}
}
else if(_currItem.type == MySettings.TOGGLE_TYPE_SCRUB)
{
if(param1.currentTarget == _window.scrubBtn)
{
if(_window.scrubBtn.scrubBG.currentFrameLabel != "up")
{
_window.scrubBtn.scrubBG.gotoAndStop("up");
}
if(_window.scrubBtn.scrubKnob.currentFrameLabel != "up")
{
_window.scrubBtn.scrubKnob.gotoAndStop("up");
}
}
else
{
handleStopScrubbing();
}
}
}
private function handleMouseOver(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_currItem.type == MySettings.TOGGLE_TYPE_TOGGLE_BTN)
{
if(param1.currentTarget.toggleBtn.toggleBG.currentFrameLabel != "over")
{
param1.currentTarget.toggleBtn.toggleBG.gotoAndStop("over");
}
if(param1.currentTarget.toggleBtn.toggleKnob.currentFrameLabel != "over")
{
param1.currentTarget.toggleBtn.toggleKnob.gotoAndStop("over");
}
}
else if(_currItem.type == MySettings.TOGGLE_TYPE_SCRUB)
{
if(param1.currentTarget.scrubBG.currentFrameLabel != "over")
{
param1.currentTarget.scrubBG.gotoAndStop("over");
}
if(param1.currentTarget.scrubKnob.currentFrameLabel != "over")
{
param1.currentTarget.scrubKnob.gotoAndStop("over");
}
}
}
private function handleStopScrubbing() : void
{
if(_window.scrubBtn.scrubKnob.dragging)
{
_window.scrubBtn.scrubKnob.dragging = false;
_window.scrubBtn.scrubKnob.stopDrag();
GuiManager.setSharedObj("volume",SBAudio.getVolumeMusic());
if(SBAudio.currentVolume == 0 && !SBAudio.isMusicMuted)
{
if(_musicToggle)
{
_musicToggle.handleMuteUnmute();
}
else
{
handleMuteUnmute();
}
}
else if(SBAudio.currentVolume != 0 && SBAudio.isMusicMuted)
{
if(_musicToggle)
{
_musicToggle.handleMuteUnmute();
}
else
{
handleMuteUnmute();
}
}
}
}
private function handleMuteUnmute() : void
{
SBAudio.toggleMuteAll();
GuiManager.toggleMuteVideo();
if(SBAudio.isMusicMuted || SBAudio.areSoundsMuted)
{
_window.toggleBtn.toggleBtn.gotoAndPlay("off");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
GuiManager.depressSoundButton(true);
}
else
{
_window.toggleBtn.toggleBtn.gotoAndPlay("on");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
GuiManager.depressSoundButton(false);
}
}
private function onDenLockUnlock(param1:Boolean = true) : void
{
if(param1)
{
if(gMainFrame.userInfo.denPrivacySettings == 0)
{
gMainFrame.userInfo.denPrivacySettings = 2;
}
else
{
gMainFrame.userInfo.denPrivacySettings = 0;
}
DenXtCommManager.requestSetDenPrivacy(gMainFrame.userInfo.denPrivacySettings);
GuiManager.refreshDenLockSettings();
}
if(gMainFrame.userInfo.denPrivacySettings != 2)
{
_lock.toggleBtn.gotoAndPlay("off");
if(_window)
{
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
}
}
else
{
_lock.toggleBtn.gotoAndPlay("on");
if(_window)
{
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
}
}
}
}
}
@@ -0,0 +1,160 @@
package gui.itemWindows
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
import newspaper.NewspaperData;
import newspaper.NewspaperDef;
import newspaper.NewspaperManager;
public class ItemWindowToggleImage extends ItemWindowBase
{
private const WINDOW_ID:int = 5842;
private var _newspaperDef:NewspaperDef;
private var _mediaHelper:MediaHelper;
private var _onMouseDown:Function;
public function ItemWindowToggleImage(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
_newspaperDef = NewspaperDef(param2);
_onMouseDown = param5;
super(5842,param1,param2,param3,param4,myMouseDown,myMouseOver,myMouseOut,param8,false);
}
public function get window() : MovieClip
{
return _window;
}
public function myMouseOver(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
if(!_window.itemWindowBtn.down.visible)
{
_window.itemWindowBtn.mouse.gotoAndPlay(1);
this.parent.setChildIndex(this,this.parent.numChildren - 1);
_window.itemWindowBtn.itemWindow.scaleX = 1.25;
_window.itemWindowBtn.itemWindow.scaleY = 1.25;
}
}
public function myMouseOut(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
if(!_window.itemWindowBtn.down.visible)
{
this.parent.setChildIndex(this,0);
_window.itemWindowBtn.mouse.gotoAndStop(1);
_window.itemWindowBtn.itemWindow.scaleX = 1;
_window.itemWindowBtn.itemWindow.scaleY = 1;
}
}
public function myMouseDown(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
if(_window.itemWindowBtn.down && !_window.itemWindowBtn.down.visible)
{
_window.itemWindowBtn.down.visible = true;
_window.itemWindowBtn.mouse.visible = false;
_onMouseDown(_index);
}
else
{
_window.itemWindowBtn.mouse.visible = true;
_window.itemWindowBtn.mouse.gotoAndPlay(1);
if(_window.itemWindowBtn.down)
{
_window.itemWindowBtn.down.visible = false;
}
}
}
public function downToUpdate() : void
{
_window.itemWindowBtn.down.visible = false;
_window.itemWindowBtn.mouse.visible = true;
_window.itemWindowBtn.mouse.gotoAndStop(1);
_window.itemWindowBtn.itemWindow.scaleX = 1;
_window.itemWindowBtn.itemWindow.scaleY = 1;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(!_isCurrItemLoaded)
{
setChildrenAndInitialConditions();
addEventListeners();
_isCurrItemLoaded = true;
loadIcon();
}
}
override protected function setChildrenAndInitialConditions() : void
{
var _loc1_:NewspaperData = null;
_window.giftBurst.visible = false;
_window.newBurst.visible = false;
if(_newspaperDef)
{
_loc1_ = NewspaperManager.getNewspaperData(_newspaperDef.defId);
if(_loc1_ == null || _loc1_.timeSeen < _newspaperDef.availabilityStartTime)
{
_window.newBurst.visible = true;
}
}
_window.itemWindowBtn.mouse.gotoAndStop(1);
if(_index == 0)
{
_window.itemWindowBtn.down.visible = true;
_window.itemWindowBtn.mouse.visible = false;
if(this.parent)
{
this.parent.setChildIndex(this,this.parent.numChildren - 1);
}
}
else
{
_window.itemWindowBtn.down.visible = false;
_window.itemWindowBtn.mouse.visible = true;
}
}
private function loadIcon() : void
{
if(_newspaperDef)
{
_mediaHelper = new MediaHelper();
_mediaHelper.init(_newspaperDef.iconMediaId,onIconLoaded);
}
}
private function onIconLoaded(param1:MovieClip) : void
{
if(_window)
{
_window.itemWindowBtn.itemWindow.addChild(param1);
}
param1.mouseChildren = false;
param1.mouseEnabled = false;
_mediaHelper.destroy();
_mediaHelper = null;
}
}
}
@@ -0,0 +1,75 @@
package gui.itemWindows
{
import achievement.Achievement;
import flash.filters.ColorMatrixFilter;
public class ItemWindowWithSeparators extends ItemWindowBase
{
private var _sizeCont:Object;
private var _secondaryIndex:int;
private var _myAchievementsByType:Array;
public function ItemWindowWithSeparators(param1:Function, param2:*, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
if(param2.hasOwnProperty("width"))
{
_sizeCont = {
"height":(param2.hasOwnProperty("scrollContentHeight") ? param2.scrollContentHeight : param2.height),
"width":param2.width
};
}
_secondaryIndex = param9 ? param9.secondaryIndex as int : 0;
_myAchievementsByType = param9 ? param9.myAchievementsByType : [];
super(param9 != null && param9.itemClassName != null ? param9.itemClassName : param2,param1,param2,param3,param4,param5,param6,param7,param8,false);
}
override public function setStatesForVisibility(param1:Boolean, param2:Object = null) : void
{
}
override protected function setChildrenAndInitialConditions() : void
{
var _loc1_:int = 0;
if(_currItem is Achievement)
{
if(_myAchievementsByType != null)
{
_loc1_ = 0;
while(_loc1_ < _myAchievementsByType.length)
{
if(_myAchievementsByType[_loc1_].defId == _currItem.defId)
{
_currItem.image.filters = null;
return;
}
_loc1_++;
}
}
_currItem.image.filters = [new ColorMatrixFilter([0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0,0,0,1,0])];
}
}
public function get sizeCont() : Object
{
return _sizeCont;
}
public function get secondaryIndex() : int
{
return _secondaryIndex;
}
public function get currItemType() : int
{
if(_currItem && _currItem.hasOwnProperty("type"))
{
return _currItem.type;
}
return -1;
}
}
}