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,946 @@
package createAccountFlow
{
import avatar.Avatar;
import avatar.AvatarUtility;
import avatar.AvatarView;
import avatar.AvatarXtCommManager;
import avatar.INewAvatar;
import com.sbi.analytics.SBTracker;
import com.sbi.client.SFEvent;
import com.sbi.corelib.crypto.SBCrypto;
import com.sbi.debug.DebugUtility;
import com.sbi.graphics.LayerAnim;
import com.sbi.graphics.PaletteHelper;
import com.sbi.loader.ImageServerEvent;
import com.sbi.loader.ImageServerURL;
import com.sbi.popup.*;
import flash.display.MovieClip;
import flash.errors.IOError;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
import flash.net.navigateToURL;
import flash.system.Security;
import flash.utils.Timer;
import flash.utils.setTimeout;
import gui.DarkenManager;
import gui.Fonts;
import item.ItemXtCommManager;
import loader.MediaHelper;
public class CreateAccount extends MovieClip implements INewAvatar
{
public var existingAvatarData:Array;
public var existingAvatarDataChanged:Boolean;
public var showAvatarOrigX:Number;
public var showAvatarOrigY:Number;
public var avatarCarousel:MovieClip;
public var accountCreation:MovieClip;
public var intro:MovieClip;
private var _createAccountFlashVars:Object;
private var _loginRedemptionCode:String;
private var _nextNewAccountServerIdx:int;
private var createUserAutoconnect:Boolean;
private var createAvatarAutoconnect:Boolean;
private var loginInfoAutoconnect:Boolean;
private var loginInfoAutologin:Boolean;
private var validateUserNameAutoconnect:Boolean;
private var _validateTestName:String;
private var _validateTestPass:String;
private var validateUserNameAutologin:Boolean;
private var validateAvNameAutoconnect:Boolean;
private var _validateTestAvName:String;
private var validateAvNameAutologin:Boolean;
private var _ignoreValidation:Boolean;
private var _newUserName:String;
private var _newUserPass:String;
private var _newSaveName:Boolean;
private var _newUserEmail:String;
private var _caUserName:String;
private var _caUserPass:String;
private var _caUserEmail:String;
private var _caBirthday:String;
private var _caGender:int;
private var _avatarTypes:Array;
private var _creationAvatars:Array;
private var _showAvatar:Avatar;
private var _showAvatarView:AvatarView;
private var _caAvatarName:String;
private var _caAvatarNameIndexes:Array;
private var _caAvatarType:int;
private var _caAvatarColor:int;
private var color1s:Array;
private var color2s:Array;
private var color3s:Array;
private var _createUser:Boolean;
private var _createAvatar:Boolean;
private var _createUserLoggedIn:Boolean;
private var _createAvatarLoggedIn:Boolean;
private var _userNameValidGuiCallback:Function;
private var _avNameValidGuiCallback:Function;
private var _zone:String;
private var _alreadyCreated:Boolean;
private var _closeTimer:Timer;
private var _isWaitingForIntro:Boolean;
private var _skipMediaHelper:MediaHelper;
private var _skipBtn:MovieClip;
private var _connectEvent:Event;
private var _loginEvent:Event;
public function CreateAccount(param1:Object)
{
super();
this._createAccountFlashVars = param1;
}
public function loginCtorHelper() : void
{
this.init();
}
public function init() : void
{
DebugUtility.debugTrace("security:" + Security.sandboxType);
DebugUtility.debugTrace("redemption_code:" + this._createAccountFlashVars.redemption_code);
this._loginRedemptionCode = this._createAccountFlashVars.redemption_code;
if(this._loginRedemptionCode == null)
{
this._loginRedemptionCode = "";
}
this._nextNewAccountServerIdx = 0;
this.existingAvatarData = [];
this.existingAvatarDataChanged = false;
this._ignoreValidation = false;
this._newUserName = null;
this._newUserPass = null;
this._newSaveName = false;
this._newUserEmail = "";
this._caUserName = "";
this._caUserPass = "";
this._caUserEmail = "";
this._caBirthday = "";
this._caGender = -1;
this._caAvatarName = "";
this._caAvatarNameIndexes = [];
this._createUser = false;
this._createAvatar = false;
this._createUserLoggedIn = false;
this._createAvatarLoggedIn = false;
this._alreadyCreated = false;
this._zone = "sbiLogin";
this._avatarTypes = [];
LoadProgress.init(this);
this.initCreateAccountAssets();
}
private function initCreateAccountAssets() : void
{
this.accountCreation = MainFrame.avatarCreationLogin;
this.initGamePalette();
}
public function initGamePalette() : void
{
ImageServerURL.instance.addEventListener(ImageServerEvent.ON_GLOBAL_PALETTE,this.handleGamePalette,false,0,true);
DebugUtility.debugTrace("login - asking for game palette");
ImageServerURL.instance.requestGlobalPalette();
}
private function handleGamePalette(param1:ImageServerEvent) : void
{
ImageServerURL.instance.removeEventListener(ImageServerEvent.ON_GLOBAL_PALETTE,this.handleGamePalette);
if(Boolean(param1) && Boolean(param1.genericData))
{
PaletteHelper.setGamePalette(param1.genericData.palette,param1.genericData.avatarPalette1,param1.genericData.avatarPalette2);
}
this.initAssets();
}
public function initAssets() : void
{
LocalizationXtCommManager.init();
XtReplyDemuxer.init();
CreateAccountXtCommManager.init(this);
AvatarXtCommManager.init();
ItemXtCommManager.init();
GenericListXtCommManager.init();
XtReplyDemuxer.addModule(ItemXtCommManager.handleXtReply,"i");
XtReplyDemuxer.addModule(ItemXtCommManager.handleXtReply,"s");
XtReplyDemuxer.addModule(GenericListXtCommManager.handleXtReply,"g");
this.createUserAutoconnect = false;
this.createAvatarAutoconnect = false;
this.loginInfoAutologin = false;
this.validateUserNameAutoconnect = false;
this.validateUserNameAutologin = false;
this.validateAvNameAutoconnect = false;
this.validateAvNameAutologin = false;
gMainFrame.server.removeEventListener(SFEvent.ON_CONNECT,this.onConnect);
gMainFrame.server.removeEventListener(SFEvent.ON_LOGIN,this.onLogIn);
gMainFrame.server.removeEventListener(SFEvent.ON_CONNECTION_LOST,this.onLogOut);
gMainFrame.server.addEventListener(SFEvent.ON_CONNECT,this.onConnect,false,0,true);
gMainFrame.server.addEventListener(SFEvent.ON_LOGIN,this.onLogIn,false,0,true);
gMainFrame.server.addEventListener(SFEvent.ON_CONNECTION_LOST,this.onLogOut,false,0,true);
Fonts.init();
CreateAccountGui.init(this);
AJAudio.init();
removeEventListener(Event.ENTER_FRAME,this.heartbeat);
addEventListener(Event.ENTER_FRAME,this.heartbeat,false,0,true);
this.loginInfoAutoconnect = true;
this.connecting();
}
public function destroy() : void
{
CreateAccountGui.destroy();
ItemXtCommManager.destroy();
AvatarXtCommManager.destroy();
CreateAccountXtCommManager.destroy();
XtReplyDemuxer.destroy();
SBPopupManager.destroyAll();
ImageServerURL.instance.removeEventListener(ImageServerEvent.ON_GLOBAL_PALETTE,this.handleGamePalette);
gMainFrame.server.removeEventListener(SFEvent.ON_CONNECT,this.onConnect);
gMainFrame.server.removeEventListener(SFEvent.ON_LOGIN,this.onLogIn);
gMainFrame.server.removeEventListener(SFEvent.ON_CONNECTION_LOST,this.onLogOut);
gMainFrame.userInfo.avtDefsCached = false;
MainFrame.avatarCreationLogin = null;
removeEventListener(Event.ENTER_FRAME,this.heartbeat);
this.existingAvatarData = null;
this.avatarCarousel = null;
this.accountCreation = null;
this.intro = null;
this._showAvatar.destroy();
this._showAvatarView.destroy(true);
this._showAvatar = null;
this._showAvatarView = null;
}
public function get validatedAvatarName() : String
{
return this._caAvatarName;
}
public function get validatedUserName() : String
{
return this._caUserName;
}
public function get validatedPassWord() : String
{
return this._caUserPass;
}
public function get creationAvatars() : Array
{
return this._creationAvatars;
}
public function get showAvatar() : Avatar
{
return this._showAvatar;
}
public function get showAvatarView() : AvatarView
{
return this._showAvatarView;
}
public function setIntro(param1:MovieClip) : void
{
this.intro = param1;
this.intro.stopMovie();
this.intro.visible = false;
if(this._isWaitingForIntro)
{
this.registrationSuccess();
}
}
public function registrationSuccess() : void
{
if(this.intro)
{
addChild(this.intro);
this.intro.visible = true;
this.intro.playMovie(this.onIntroComplete);
setTimeout(this.loadSkipBtn,3000);
}
else
{
this._isWaitingForIntro = true;
}
}
private function loadSkipBtn() : void
{
this._skipMediaHelper = new MediaHelper();
this._skipMediaHelper.init(392,this.onSkipBtnLoaded);
}
private function onSkipBtnLoaded(param1:MovieClip) : void
{
this._skipBtn = MovieClip(param1.getChildAt(0));
this._skipBtn.x = 810;
this._skipBtn.y = 500;
this._skipBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onSkipBtn,false,0,true);
addChild(this._skipBtn);
this._skipMediaHelper.destroy();
this._skipMediaHelper = null;
}
private function onSkipBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
CreateAccountGui.trackUserCreateAccountPageChange("SkipIntro");
this.intro.stopMovie();
this._skipBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSkipBtn);
if(Boolean(this._skipBtn) && this._skipBtn.parent == this)
{
removeChild(this._skipBtn);
}
this._skipBtn = null;
this.onIntroComplete(true);
}
private function onIntroComplete(param1:Boolean = false) : void
{
this.intro.stopMovie();
if(!param1)
{
CreateAccountGui.trackUserCreateAccountPageChange("IntroComplete");
}
if(Boolean(this._skipBtn) && this._skipBtn.parent == this)
{
this._skipBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSkipBtn);
removeChild(this._skipBtn);
this._skipBtn = null;
}
SBTracker.completeLastTrackingBatch(this.onLastBatchPushed);
}
private function onLastBatchPushed() : void
{
var loc:String = null;
var wur:URLRequest = null;
var wurv:URLVariables = null;
try
{
loc = gMainFrame.clientInfo.websiteURL + "complete_signup";
wur = new URLRequest(loc);
wur.method = URLRequestMethod.POST;
wurv = new URLVariables();
wurv.u = this._newUserName;
wurv.p = this._newUserPass;
DebugUtility.debugTrace("wurv:" + wurv);
wur.data = wurv;
navigateToURL(wur,"_self");
}
catch(e:Error)
{
DebugUtility.debugTrace("Error while trying to redirect to autologin (and then world)! msg:" + e.message + e.getStackTrace());
}
}
private function loadComplete(param1:Event) : void
{
gMainFrame.server.disconnect();
this.destroy();
AJClient(this.parent).setupGamePlay(this._loginEvent,this._connectEvent);
}
private function ioError(param1:IOError) : void
{
DebugUtility.debugTrace("IO Error while trying to redirect to autologin (and then world)!");
}
public function heartbeat(param1:Event) : void
{
LayerAnim.heartbeat();
}
public function connecting() : void
{
CreateAccountGui.showConnectingMsg();
LoadProgress.show(false);
LoadProgress.show(true);
gMainFrame.server.connect();
}
private function onConnect(param1:SFEvent) : void
{
this._connectEvent = param1;
if(param1.status)
{
CreateAccountGui.hideNotifyPopup();
if(this.loginInfoAutoconnect)
{
this.loginInfoAutoconnect = false;
this.logInForCreateAvatarData();
return;
}
if(this.validateUserNameAutoconnect)
{
this.validateUserNameAutoconnect = false;
this.validateUserName(this._validateTestName,this._validateTestPass,this._userNameValidGuiCallback);
return;
}
if(this.validateAvNameAutoconnect)
{
this.validateAvNameAutoconnect = false;
this.validateAvatarName(this._validateTestAvName,this._avNameValidGuiCallback);
return;
}
if(this.createUserAutoconnect)
{
this.createUserAutoconnect = false;
this.createNewAccount();
return;
}
if(this.createAvatarAutoconnect)
{
this.createAvatarAutoconnect = false;
this.createNewAvatar();
return;
}
}
else if(!gMainFrame.server.autoAttemptHttp)
{
if(++this._nextNewAccountServerIdx < gMainFrame.server.serverIps.length)
{
gMainFrame.server.setNewServer(this._nextNewAccountServerIdx);
DebugUtility.debugTrace("trying next regular Server Node: " + gMainFrame.server.serverIp);
gMainFrame.server.connect();
}
else
{
gMainFrame.server.autoAttemptHttp = true;
this._nextNewAccountServerIdx = 0;
gMainFrame.server.setNewServer(this._nextNewAccountServerIdx);
DebugUtility.debugTrace("trying first bluebox Server Node: " + gMainFrame.server.serverIp);
gMainFrame.server.connect();
}
}
else
{
DebugUtility.debugTrace("bluebox connect fail serverIp:" + gMainFrame.server.serverIp + " _nextNewAccountServerIdx:" + this._nextNewAccountServerIdx);
if(++this._nextNewAccountServerIdx < gMainFrame.server.blueboxIps.length)
{
gMainFrame.server.setNewServer(this._nextNewAccountServerIdx);
DebugUtility.debugTrace("trying next bluebox Server Node: " + gMainFrame.server.serverIp);
gMainFrame.server.connect();
}
else
{
DebugUtility.debugTrace("entire new account cluster is down! _nextNewAccountServerIdx:" + this._nextNewAccountServerIdx);
CreateAccountGui.showConnectFailedPopup();
}
}
}
public function hideConnectingMsg() : void
{
CreateAccountGui.hideNotifyPopup();
}
public function logInNewAccountDone() : void
{
this.registrationSuccess();
}
public function newAvatarData(param1:int, param2:String, param3:Array, param4:Function, param5:Boolean = false) : void
{
var _loc6_:int = AvatarUtility.findAvatarIndexByType(param1);
this._caAvatarType = this._avatarTypes[_loc6_];
this._showAvatar = this._creationAvatars[_loc6_];
this._caAvatarNameIndexes = param3;
this.validateAvatarName(param2,param4);
}
public function logInForCreateAvatarData() : void
{
if(!gMainFrame.server.isConnected)
{
this.loginInfoAutoconnect = true;
CreateAccountGui.showConnectingMsg();
gMainFrame.server.connect();
return;
}
if(!gMainFrame.server.isLoggedIn)
{
this.loginInfoAutologin = true;
gMainFrame.server.logIn("sbiAccountZone","","");
}
else
{
GenericListXtCommManager.requestGenericList(GenericListXtCommManager.AVATAR_LIST_ID,this.handleCreateAvatarData,null,false);
}
}
public function handleCreateAvatarData(param1:Array) : void
{
if(gMainFrame.server.isLoggedIn)
{
this.loginInfoAutologin = false;
DebugUtility.debugTrace("dealing with create avatar data now:" + param1);
AvatarUtility.buildCreationAvatarViews(param1,true);
this._avatarTypes = AvatarUtility.avatarTypes;
this._creationAvatars = AvatarUtility.creationAvatars;
CreateAccountGui.showTypeSelectAvatars();
CreateAccountGui.chooseAnimalScreen.init();
}
else
{
this.logInForCreateAvatarData();
}
}
public function invalidateUserName() : void
{
this._caUserName = null;
}
public function invalidatePassWord() : void
{
this._caUserPass = null;
}
public function invalidatePending() : void
{
this._ignoreValidation = true;
}
public function validateUserName(param1:String, param2:String, param3:Function) : void
{
this._userNameValidGuiCallback = param3;
if(Boolean(param1 && param1 != "") && Boolean(RegExp(/\W/)["exec"](param1) == null) && !RegExp(/^[a-zA-Z0-9].*[A-Z]+.*/).test(param1))
{
if(param2 == null || param2.toLowerCase().indexOf(param1.toLowerCase()) < 0)
{
if(!gMainFrame.server.isConnected)
{
this.validateUserNameAutoconnect = true;
this._validateTestName = param1;
this._validateTestPass = param2;
CreateAccountGui.showConnectingMsg();
gMainFrame.server.connect();
return;
}
if(gMainFrame.server.isLoggedIn)
{
this._validateTestName = param1;
this._validateTestPass = param2;
CreateAccountXtCommManager.sendLoginAvailableRequest(CreateAccountXtCommManager.LOGINAVAILABLE_TYPE_USERNAME,param1);
}
else
{
this.validateUserNameAutologin = true;
this._validateTestName = param1;
this._validateTestPass = param2;
gMainFrame.server.logIn("sbiAccountZone","","");
}
}
else
{
CreateAccountGui.showNewPasswordBadMsg(CreateAccountGui.MSG_ID_PASSWORD_SAME_AS_UN);
if(this._userNameValidGuiCallback != null)
{
this._userNameValidGuiCallback(false,[]);
}
}
}
else
{
CreateAccountGui.showUsernameExistsMsg();
if(this._userNameValidGuiCallback != null)
{
this._userNameValidGuiCallback(false,[]);
}
}
}
public function validatePassWord(param1:String, param2:String, param3:Function) : void
{
if(Boolean(param1) && Boolean(param1 != "") && param1.length >= CreateAccountGui.MIN_PASSWORD_LENGTH)
{
if(param1.toLowerCase().indexOf(param2.toLowerCase()) >= 0)
{
CreateAccountGui.showNewPasswordBadMsg(CreateAccountGui.MSG_ID_PASSWORD_SAME_AS_UN);
param3(false);
}
else
{
this._caUserPass = param1;
CreateAccountGui.hideNotifyPopup();
param3(true);
}
}
else
{
CreateAccountGui.showNewPasswordBadMsg();
param3(false);
}
}
public function validateAvatarName(param1:String, param2:Function) : void
{
this._avNameValidGuiCallback = param2;
if(Boolean(param1) && Boolean(param1 != "") && RegExp(/a-zA-Z0-9 /)["exec"](param1) == null)
{
this._validateTestAvName = param1;
if(!gMainFrame.server.isConnected)
{
this.validateAvNameAutoconnect = true;
CreateAccountGui.showConnectingMsg();
gMainFrame.server.connect();
return;
}
if(gMainFrame.server.isLoggedIn)
{
CreateAccountXtCommManager.sendLoginAvailableRequest(CreateAccountXtCommManager.LOGINAVAILABLE_TYPE_AVATARNAME,param1);
}
else
{
this.validateAvNameAutologin = true;
gMainFrame.server.logIn("sbiAccountZone","","");
}
}
else
{
CreateAccountGui.showAvNameExistsMsg();
}
}
public function setBirthday(param1:String, param2:String, param3:String) : void
{
var nowDate:Date = null;
var bdayYear:int = 0;
var bdayMonthText:String = param1;
var bdayDayText:String = param2;
var bdayAgeText:String = param3;
try
{
nowDate = new Date();
bdayYear = nowDate.fullYear - int(bdayAgeText);
if(bdayMonthText == "")
{
bdayMonthText = "1";
}
if(bdayDayText == "")
{
bdayDayText = "1";
}
if(int(bdayMonthText) > nowDate.month + 1 || int(bdayMonthText) == nowDate.month + 1 && int(bdayDayText) >= nowDate.date + 1)
{
bdayYear--;
}
if(bdayYear < 0)
{
bdayYear = 0;
}
this._caBirthday = bdayMonthText + "/" + bdayDayText + "/" + bdayYear;
}
catch(e:Error)
{
DebugUtility.debugTrace("ERROR: Bad birthday provided! Using default 1/1/1 for now.");
_caBirthday = "1/1/1";
}
}
public function setGender(param1:int) : void
{
this._caGender = param1;
}
public function screenInitCallback(param1:MovieClip) : void
{
}
public function get playSound() : Boolean
{
return true;
}
private function createNewAccount() : void
{
var _loc1_:Array = null;
var _loc2_:Array = null;
if(!gMainFrame.server.isConnected)
{
this.createUserAutoconnect = true;
CreateAccountGui.showConnectingMsg();
gMainFrame.server.connect();
return;
}
if(Boolean(gMainFrame.server.isLoggedIn) && this._createUser)
{
this._createUserLoggedIn = true;
}
if(this._createUserLoggedIn)
{
_loc1_ = [this._caUserName,this._caUserEmail,SBCrypto.encrypt(this._caUserPass,gMainFrame.server.hashKey),this._caBirthday,this._caGender,this._loginRedemptionCode,gMainFrame.clientInfo.sgParams];
_loc2_ = [0,this._caUserName,this._caAvatarNameIndexes[0],this._caAvatarNameIndexes[1],this._caAvatarNameIndexes[2],this._caAvatarType,this._showAvatar.colors[0],this._showAvatar.colors[1],this._showAvatar.colors[2],this._showAvatar.accShownItems];
CreateAccountXtCommManager.sendLoginCreateRequest(_loc1_,_loc2_);
}
else
{
gMainFrame.server.logIn("sbiAccountZone","","");
}
}
public function createNewAccountSetup(param1:String, param2:Function = null) : void
{
if(this._alreadyCreated && this._caUserEmail == param1)
{
CreateAccountGui.loginCreateSuccess();
return;
}
CreateAccountGui.loginCreateGuiCallback = param2;
this._caUserEmail = param1;
if(Boolean(this._caUserName && this._caUserName != "" && RegExp(/\W/)["exec"](this._caUserName) == null && this._caUserPass && this._caUserPass != "") && Boolean(this._caUserEmail) && this._caUserEmail != "")
{
this._newUserName = this._caUserName;
this._newUserPass = this._caUserPass;
this._newUserEmail = this._caUserEmail;
this._createUser = true;
this._createAvatar = true;
this.createNewAccount();
}
else
{
CreateAccountGui.showUsernameExistsMsg(CreateAccountGui.MSG_ID_LOGIN_INVALID,false);
}
}
private function createNewAvatar() : void
{
var _loc1_:Array = null;
if(!gMainFrame.server.isConnected)
{
this.createAvatarAutoconnect = true;
CreateAccountGui.showConnectingMsg();
gMainFrame.server.connect();
return;
}
if(Boolean(gMainFrame.server.isLoggedIn) && this._createAvatar)
{
this._createAvatarLoggedIn = true;
}
if(this._createAvatarLoggedIn)
{
_loc1_ = [this._caUserName,this._caAvatarNameIndexes[0],this._caAvatarNameIndexes[1],this._caAvatarNameIndexes[2],this._caAvatarType,this._showAvatar.colors[0],this._showAvatar.colors[1],this._showAvatar.colors[2],this._showAvatar.accShownItems];
CreateAccountXtCommManager.sendLoginNewRequest(_loc1_);
}
else
{
gMainFrame.server.logIn("sbiAccountZone","","");
}
}
public function createNewAvatarPrep(param1:int = 0) : void
{
}
public function nameTypeScreenDone() : void
{
}
public function handleNewAvatarData(param1:Array) : void
{
if(int(param1[2]) == 1)
{
gMainFrame.server.logOut();
this._alreadyCreated = true;
CreateAccountGui.loginCreateSuccess();
}
else
{
CreateAccountGui.showLoginCreateResultMsg(int(param1[2]));
}
}
public function handleLoginAvailable(param1:Array, param2:int) : void
{
if(this._ignoreValidation)
{
this._ignoreValidation = false;
return;
}
var _loc3_:int = int(param1[2]);
if(param2 == CreateAccountXtCommManager.LOGINAVAILABLE_TYPE_USERNAME)
{
if(_loc3_ != 1)
{
this._caUserName = null;
if(this._userNameValidGuiCallback != null)
{
this._userNameValidGuiCallback(_loc3_,param1);
}
CreateAccountGui.showUsernameExistsMsg(_loc3_);
}
else
{
this._caUserName = this._validateTestName;
if(this._userNameValidGuiCallback != null)
{
this._userNameValidGuiCallback(_loc3_,param1);
}
CreateAccountGui.hideUsernameExistsMsg();
}
}
else if(param2 == CreateAccountXtCommManager.LOGINAVAILABLE_TYPE_AVATARNAME)
{
if(_loc3_ == 1)
{
this._caAvatarName = this._validateTestAvName;
if(this._avNameValidGuiCallback != null)
{
this._avNameValidGuiCallback(true);
}
}
else if(this._avNameValidGuiCallback != null)
{
this._avNameValidGuiCallback(false);
}
CreateAccountGui.avatarNameValidateCallback(_loc3_);
}
}
public function handleLoginCreate(param1:Array) : void
{
var _loc2_:int = int(param1[2]);
if(_loc2_ <= 0)
{
DarkenManager.showLoadingSpiral(false);
CreateAccountGui.showLoginCreateResultMsg(_loc2_);
}
else
{
gMainFrame.server.logOut();
this._alreadyCreated = true;
CreateAccountGui.loginCreateSuccess();
}
}
public function handleLocalExternalCall(param1:Object) : void
{
}
private function onLogOut(param1:SFEvent) : void
{
this._createUserLoggedIn = false;
this._createAvatarLoggedIn = false;
}
private function onLogIn(param1:SFEvent) : void
{
this._loginEvent = param1;
gMainFrame.server.setInitRoom();
if(this.validateUserNameAutologin || this.validateAvNameAutologin || this.loginInfoAutologin)
{
this.loginDone();
return;
}
if(this._createUser)
{
this._createUserLoggedIn = true;
}
else if(this._createAvatar)
{
this._createAvatarLoggedIn = true;
}
this.loginDone();
}
private function loginDone() : void
{
if(!gMainFrame.userInfo.avtDefsCached)
{
AvatarXtCommManager.requestAvatarInfo(this.loginDone);
return;
}
if(this.loginInfoAutologin)
{
GenericListXtCommManager.requestGenericList(GenericListXtCommManager.AVATAR_LIST_ID,this.handleCreateAvatarData,null,false);
return;
}
if(this.validateUserNameAutologin)
{
this.validateUserNameAutologin = false;
this.validateUserName(this._validateTestName,this._validateTestPass,this._userNameValidGuiCallback);
return;
}
if(this.validateAvNameAutologin)
{
this.validateAvNameAutologin = false;
this.validateAvatarName(this._validateTestAvName,this._avNameValidGuiCallback);
return;
}
if(this._createAvatarLoggedIn)
{
this.createNewAvatar();
}
if(this._createUserLoggedIn)
{
this.createNewAccount();
}
}
}
}
@@ -0,0 +1,532 @@
package createAccountFlow
{
import avatar.AvatarSwitch;
import com.sbi.analytics.SBTracker;
import com.sbi.corelib.audio.SBSound;
import com.sbi.popup.SBPopup;
import com.sbi.popup.SBWizard;
import createAccountGui.GuiAvatarCreationAssets;
import createAccountGui.GuiChooseAnimal;
import createAccountGui.GuiCreateAName;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import gui.DarkenManager;
import gui.GuiNameTypeScreen;
import loader.MediaHelper;
public class CreateAccountGui
{
public static var bgLayer:DisplayLayer;
public static var frgLayer:DisplayLayer;
public static var guiLayer:DisplayLayer;
private static var _login:CreateAccount;
private static var _loginAssets:GuiAvatarCreationAssets;
private static var _nameTypeScreen:GuiNameTypeScreen;
private static var _serverPopup:MovieClip;
private static var _charPopup:MovieClip;
private static var _spawnPopup:MovieClip;
private static var ContentLogIn:Class;
private static var CharacterContent:Class;
private static var splashScreen:MovieClip;
private static var createAccountRulesPopup:SBPopup;
private static var selectAvatarPopup:SBPopup;
private static var createAccountCharacterPopup:SBPopup;
private static var createAccountAvEditorPopup:SBPopup;
private static var createAccountPasswordPopup:SBPopup;
private static var createAccountChatPopup:SBPopup;
private static var createAccountActivatePopup:SBPopup;
private static var createAccountSuccessPopup:SBPopup;
private static var _notifyPopup:MovieClip;
private static var _mediaHelper:MediaHelper;
private static var _accountVerifyPopup:MovieClip;
public static var connectingStr:String;
public static var connectFailedStr:String;
public static var loggingInStr:String;
public static var failedLoginStr:String;
public static var usernameExistsStr:String;
public static var oopsTitleStr:String;
public static var connectingTitleStr:String;
public static var loginCreateGuiCallback:Function;
public static var vo1Sound:SBSound;
public static var vo2Sound:SBSound;
public static var vo3Sound:SBSound;
public static var vo4Sound:SBSound;
public static var vo5Sound:SBSound;
public static const MSG_ID_SERVER_ERROR:int = -1;
public static const MSG_ID_USERNAME_BADWORD:int = -2;
public static const MSG_ID_USERNAME_UNAVAILABLE:int = -3;
public static const MSG_ID_USERNAME_MISSING:int = -4;
public static const MSG_ID_PASSWORD_INVALID:int = -5;
public static const MSG_ID_PASSWORD_MISSING:int = -6;
public static const MSG_ID_EMAIL_MISSING:int = -7;
public static const MSG_ID_EMAIL_INVALID:int = -8;
public static const MSG_ID_EMAIL_FAILURE:int = -9;
public static const MSG_ID_LOGIN_INVALID:int = -10;
public static const MSG_ID_LOGIN_IN_USE:int = -11;
public static const MSG_ID_LOGIN_ZONE_FULL:int = -12;
public static const MSG_ID_LOGIN_CONNECTION:int = -13;
public static const MSG_ID_LOGIN_BANNED:int = -14;
public static const MSG_ID_LOGIN_SERVER_MAIN:int = -15;
public static const MSG_ID_PASSWORD_SAME_AS_UN:int = -16;
public static const MSG_ID_TOO_MANY_EMAILS:int = -18;
public static const MSG_ID_AGE_BLANK:int = -98;
public static const MSG_ID_SEX_BLANK:int = -99;
public static const MSG_ID_MONTH_OR_DAY_BLANK:int = -100;
public static const MIN_PASSWORD_LENGTH:int = 6;
public static var VoiceOver1Sound:Class = CreateAccountGui_VoiceOver1Sound;
public static var VoiceOver2Sound:Class = CreateAccountGui_VoiceOver2Sound;
public static var VoiceOver3Sound:Class = CreateAccountGui_VoiceOver3Sound;
public static var VoiceOver4Sound:Class = CreateAccountGui_VoiceOver4Sound;
public static var VoiceOver5Sound:Class = CreateAccountGui_VoiceOver5Sound;
public function CreateAccountGui()
{
super();
}
public static function init(param1:CreateAccount) : void
{
_login = param1;
_loginAssets = new GuiAvatarCreationAssets(param1.accountCreation);
_loginAssets.init(param1,false);
bgLayer = new DisplayLayer();
frgLayer = new DisplayLayer();
guiLayer = new DisplayLayer();
_login.addChild(bgLayer);
_login.addChild(guiLayer);
_login.addChild(frgLayer);
DarkenManager.init(frgLayer);
_loginAssets.tipsPopup.visible = false;
_loginAssets.privacyPolicyPopup.visible = false;
frgLayer.addChild(_loginAssets);
vo1Sound = new SBSound(VoiceOver1Sound,false);
vo2Sound = new SBSound(VoiceOver2Sound,false);
vo3Sound = new SBSound(VoiceOver3Sound,false);
vo4Sound = new SBSound(VoiceOver4Sound,false);
vo5Sound = new SBSound(VoiceOver5Sound,false);
connectingStr = "Connecting...";
connectFailedStr = "Connect failed. Please try again later.";
oopsTitleStr = "Oops!";
connectingTitleStr = "";
_notifyPopup = _loginAssets.notifyPopup;
loggingInStr = "Logging in...";
failedLoginStr = "Failed to sign in!\nPlease verify your username and password.\nIf you suspect someone is using your account, contact support.";
usernameExistsStr = "That username is already taken. Please choose another.";
showNewChrPopup();
}
public static function destroy() : void
{
if(_login.contains(bgLayer))
{
_login.removeChild(bgLayer);
}
bgLayer = null;
if(_login.contains(guiLayer))
{
_login.removeChild(guiLayer);
}
guiLayer = null;
if(_login.contains(frgLayer))
{
frgLayer.removeChild(_loginAssets);
_login.removeChild(frgLayer);
}
frgLayer = null;
_login = null;
createAccountRulesPopup.destroy();
createAccountRulesPopup = null;
selectAvatarPopup.destroy();
selectAvatarPopup = null;
createAccountCharacterPopup.destroy();
createAccountCharacterPopup = null;
createAccountAvEditorPopup.destroy();
createAccountAvEditorPopup = null;
createAccountChatPopup.destroy();
createAccountChatPopup = null;
createAccountActivatePopup.destroy();
createAccountActivatePopup = null;
createAccountSuccessPopup.destroy();
createAccountSuccessPopup = null;
_loginAssets.destroy();
_loginAssets = null;
vo1Sound.destroy();
vo1Sound = null;
vo2Sound.destroy();
vo2Sound = null;
vo3Sound.destroy();
vo3Sound = null;
vo4Sound.destroy();
vo4Sound = null;
vo5Sound.destroy();
vo5Sound = null;
DarkenManager.destroy();
}
public static function get nameTypeScreen() : GuiCreateAName
{
return _loginAssets.creationWiz.createANameScreen;
}
public static function get newAccountWizard() : SBWizard
{
return _loginAssets.creationWiz;
}
public static function get chooseAnimalScreen() : GuiChooseAnimal
{
return _loginAssets.creationWiz.chooseAnimalScreen;
}
public static function showConnectingMsg() : void
{
_loginAssets.notifyPopup.notifyTxt.text = connectingStr;
_loginAssets.notifyPopup.titleTxt.text = connectingTitleStr;
_loginAssets.notifyPopup.visible = true;
}
public static function hideNotifyPopup() : void
{
_loginAssets.notifyPopup.visible = false;
}
public static function showConnectFailedPopup() : void
{
_loginAssets.notifyPopup.notifyTxt.text = connectFailedStr;
_loginAssets.notifyPopup.titleTxt.text = oopsTitleStr;
_loginAssets.notifyPopup.visible = true;
}
public static function currAvatar() : MovieClip
{
return _loginAssets.currAvatar;
}
public static function currBG() : String
{
return _loginAssets.currBG;
}
public static function currType() : int
{
return _loginAssets.currType;
}
public static function currEmailAddress() : String
{
return _loginAssets.currEmailAddress;
}
public static function emailValidationCallback() : Function
{
return _loginAssets.emailValidationCallback;
}
public static function showNewChrPopup() : void
{
hideNotifyPopup();
trackUserCreateAccountPageChange("ChooseAnimal");
}
public static function newChrWizardDone() : void
{
_loginAssets.creationWiz.wizClip.visible = true;
_loginAssets.creationWiz.jumpToStep(1);
}
public static function showLoginCreateResultMsg(param1:int) : void
{
var _loc2_:String = "";
switch(param1)
{
case MSG_ID_SERVER_ERROR:
default:
_loc2_ = "There was an error with the server. Please try again later.";
break;
case MSG_ID_USERNAME_BADWORD:
_loc2_ = "That username contains bad words! Please choose a valid username.";
break;
case MSG_ID_USERNAME_UNAVAILABLE:
_loc2_ = "That username is already taken. Please choose another.";
break;
case MSG_ID_USERNAME_MISSING:
_loc2_ = "Please provide a non-empty user name.";
break;
case MSG_ID_PASSWORD_INVALID:
_loc2_ = "That password is invalid! Please choose a valid password.";
break;
case MSG_ID_PASSWORD_MISSING:
_loc2_ = "Please provide a non-empty password.";
break;
case MSG_ID_EMAIL_MISSING:
_loc2_ = "Please provide a non-empty email address.";
break;
case MSG_ID_EMAIL_INVALID:
_loc2_ = "Please provide a valid email address.";
break;
case MSG_ID_EMAIL_FAILURE:
_loc2_ = "Unable to send email notification, account not created.";
break;
case MSG_ID_LOGIN_INVALID:
_loc2_ = "Login failure: invalid username/password.";
break;
case MSG_ID_LOGIN_IN_USE:
_loc2_ = "That user is already logged in.";
break;
case MSG_ID_LOGIN_ZONE_FULL:
_loc2_ = "Sorry, this zone is full! Please try again later.";
break;
case MSG_ID_LOGIN_CONNECTION:
_loc2_ = "Too many connections coming from your ip address. Please try again later.";
break;
case MSG_ID_PASSWORD_SAME_AS_UN:
_loc2_ = "Your password cannot contain your username.";
break;
case MSG_ID_AGE_BLANK:
_loc2_ = "We need to know how old you are.";
break;
case MSG_ID_SEX_BLANK:
_loc2_ = "We need to know if you are a boy or a girl.";
break;
case MSG_ID_MONTH_OR_DAY_BLANK:
_loc2_ = "We need to know your birthday.";
break;
case MSG_ID_TOO_MANY_EMAILS:
_mediaHelper = new MediaHelper();
_mediaHelper.init(1842,onMediaLoaded);
DarkenManager.showLoadingSpiral(true);
}
if(_loc2_ != "")
{
_loginAssets.notifyPopup.notifyTxt.text = _loc2_;
_loginAssets.notifyPopup.titleTxt.text = oopsTitleStr;
_loginAssets.notifyPopup.visible = true;
}
if(loginCreateGuiCallback != null)
{
loginCreateGuiCallback(true,param1 == MSG_ID_EMAIL_MISSING || param1 == MSG_ID_EMAIL_INVALID || param1 == MSG_ID_EMAIL_FAILURE);
}
}
private static function onMediaLoaded(param1:MovieClip) : void
{
if(param1)
{
DarkenManager.showLoadingSpiral(false);
_accountVerifyPopup = MovieClip(param1.getChildAt(0));
_accountVerifyPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,onAccountVerifyClose,false,0,true);
_accountVerifyPopup.parent_btn.addEventListener(MouseEvent.MOUSE_DOWN,onActivateEmailBtn,false,0,true);
_accountVerifyPopup.x = MainFrame.VIEW_WIDTH * 0.5;
_accountVerifyPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
_loginAssets.addChild(_accountVerifyPopup);
trackUserCreateAccountPageChange("AccountVerify");
}
}
private static function onActivateEmailBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:String = gMainFrame.clientInfo.websiteURL + "parent_activation";
var _loc3_:URLRequest = new URLRequest(_loc2_);
try
{
navigateToURL(_loc3_,"_blank");
onAccountVerifyClose(param1);
}
catch(e:Error)
{
}
}
private static function onAccountVerifyClose(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.unDarken(_accountVerifyPopup);
_loginAssets.removeChild(_accountVerifyPopup);
_accountVerifyPopup = null;
}
public static function loginCreateSuccess() : void
{
trackUserCreateAccountPageChange("CreateAndLogin");
_login.logInNewAccountDone();
}
public static function showEmailDomainMisspelledWarning(param1:Array) : void
{
var _loc2_:String = "Did you mean: <FONT COLOR=\"#440400\">";
while(param1.length > 0)
{
_loc2_ += param1.pop();
if(param1.length > 0)
{
_loc2_ += " ";
}
}
_loc2_ += "</FONT><BR>(Please fix the email address or click PLAY if it is correct.)";
_loginAssets.notifyPopup.notifyTxt.htmlText = _loc2_;
_loginAssets.notifyPopup.titleTxt.text = oopsTitleStr;
_loginAssets.notifyPopup.visible = true;
}
public static function showUsernameExistsMsg(param1:int = -10, param2:Boolean = true) : void
{
if(param1 == MSG_ID_USERNAME_UNAVAILABLE)
{
_loginAssets.notifyPopup.notifyTxt.text = "That username is already taken. Please choose another.";
}
else
{
_loginAssets.notifyPopup.notifyTxt.text = param2 ? "Please type a valid username!" : "Please type a valid email!";
}
_loginAssets.notifyPopup.titleTxt.text = oopsTitleStr;
_loginAssets.notifyPopup.visible = true;
if(loginCreateGuiCallback != null)
{
loginCreateGuiCallback(true,param1 == MSG_ID_LOGIN_INVALID);
}
}
public static function showNewPasswordBadMsg(param1:int = -1) : void
{
if(param1 == MSG_ID_PASSWORD_SAME_AS_UN)
{
_notifyPopup.notifyTxt.text = "Your password cannot contain your username.";
}
else
{
_notifyPopup.notifyTxt.text = "Please type a valid password (at least 6 characters).";
}
_notifyPopup.visible = true;
}
public static function showTipsPopup(param1:Boolean) : void
{
_loginAssets.tipsPopup.visible = param1;
}
public static function showMustAgreeMsg() : void
{
_notifyPopup.notifyTxt.text = "You must click \"I Agree\"!";
_notifyPopup.visible = true;
}
public static function showMustConfirmMsg() : void
{
_notifyPopup.notifyTxt.text = "Both email addresses must match!";
_notifyPopup.visible = true;
}
public static function avatarNameValidateCallback(param1:int) : void
{
if(param1 == 1)
{
hideNotifyPopup();
}
else
{
showAvNameExistsMsg(param1);
}
}
public static function showAvNameExistsMsg(param1:int = -10) : void
{
if(param1 == MSG_ID_USERNAME_UNAVAILABLE)
{
_loginAssets.notifyPopup.notifyTxt.text = "That avatar name is already taken. Please choose another.";
}
else
{
_loginAssets.notifyPopup.notifyTxt.text = "Please type a valid avatar name!";
}
_loginAssets.notifyPopup.titleTxt.text = oopsTitleStr;
_loginAssets.notifyPopup.visible = true;
}
public static function hideUsernameExistsMsg() : void
{
_loginAssets.creationWiz.playerTagScreen.enableNext();
hideNotifyPopup();
}
public static function showTypeSelectAvatars() : void
{
LoadProgress.show(false);
}
public static function trackUserCreateAccountPageChange(param1:String) : void
{
SBTracker.trackPageview("/login/" + param1,0);
}
public static function clearAvatarSwitchAddCallback() : void
{
AvatarSwitch.addAvatarCallback = null;
}
}
}
@@ -0,0 +1,15 @@
package createAccountFlow
{
import mx.core.SoundAsset;
[Embed(source="/_assets/1_createAccountFlow.CreateAccountGui_VoiceOver1Sound_createAccountFlow.CreateAccountGui_VoiceOver1Sound.mp3")]
public class CreateAccountGui_VoiceOver1Sound extends SoundAsset
{
public function CreateAccountGui_VoiceOver1Sound()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package createAccountFlow
{
import mx.core.SoundAsset;
[Embed(source="/_assets/3_createAccountFlow.CreateAccountGui_VoiceOver2Sound_createAccountFlow.CreateAccountGui_VoiceOver2Sound.mp3")]
public class CreateAccountGui_VoiceOver2Sound extends SoundAsset
{
public function CreateAccountGui_VoiceOver2Sound()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package createAccountFlow
{
import mx.core.SoundAsset;
[Embed(source="/_assets/2_createAccountFlow.CreateAccountGui_VoiceOver3Sound_createAccountFlow.CreateAccountGui_VoiceOver3Sound.mp3")]
public class CreateAccountGui_VoiceOver3Sound extends SoundAsset
{
public function CreateAccountGui_VoiceOver3Sound()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package createAccountFlow
{
import mx.core.SoundAsset;
[Embed(source="/_assets/4_createAccountFlow.CreateAccountGui_VoiceOver4Sound_createAccountFlow.CreateAccountGui_VoiceOver4Sound.mp3")]
public class CreateAccountGui_VoiceOver4Sound extends SoundAsset
{
public function CreateAccountGui_VoiceOver4Sound()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package createAccountFlow
{
import mx.core.SoundAsset;
[Embed(source="/_assets/5_createAccountFlow.CreateAccountGui_VoiceOver5Sound_createAccountFlow.CreateAccountGui_VoiceOver5Sound.mp3")]
public class CreateAccountGui_VoiceOver5Sound extends SoundAsset
{
public function CreateAccountGui_VoiceOver5Sound()
{
super();
}
}
}
@@ -0,0 +1,103 @@
package createAccountFlow
{
import com.sbi.client.SFEvent;
import com.sbi.debug.DebugUtility;
public class CreateAccountXtCommManager
{
public static var logIn:CreateAccount;
private static var _laReturnType:int;
public static const LOGINAVAILABLE_TYPE_USERNAME:int = 0;
public static const LOGINAVAILABLE_TYPE_AVATARNAME:int = 1;
public function CreateAccountXtCommManager()
{
super();
}
public static function init(param1:CreateAccount) : void
{
logIn = param1;
_laReturnType = -1;
XtReplyDemuxer.addModule(handleXtReply,"l");
}
public static function destroy() : void
{
XtReplyDemuxer.removeModule(handleXtReply);
}
public static function sendLoginAvailableRequest(param1:int, param2:String) : void
{
_laReturnType = param1;
gMainFrame.server.setXtObject_Str("la",[param1,param2],false);
}
public static function sendLoginCreateRequest(param1:Array, param2:Array) : void
{
var _loc3_:* = 0;
var _loc4_:* = 2;
var _loc5_:Array = [param1[_loc3_++],param1[_loc3_++],param1[_loc3_++],param1[_loc3_++],param1[_loc3_++],param1[_loc3_++],param1[_loc3_++],param2[_loc4_++],param2[_loc4_++],param2[_loc4_++],param2[_loc4_++]];
_loc4_ += 4;
if(_loc3_ != param1.length)
{
throw new Error("Expected end of loginCreate data array lcdi:" + _loc3_ + " did not match length:" + param1.length + "!");
}
if(_loc4_ != param2.length)
{
throw new Error("Expected end of loginNew data array lndi:" + _loc4_ + " did not match length:" + param2.length + "!");
}
gMainFrame.server.setXtObject_Str("lc",_loc5_,gMainFrame.server.isWorldZone);
}
public static function sendLoginNewRequest(param1:Array) : void
{
var _loc2_:* = 0;
var _loc3_:Array = [param1[_loc2_++],param1[_loc2_++],param1[_loc2_++],param1[_loc2_++],param1[_loc2_++],param1[_loc2_++]];
var _loc4_:Array = param1[_loc2_++];
if(_loc2_ != param1.length)
{
throw new Error("Expected end of loginNew data array lndi:" + _loc2_ + " did not match length:" + param1.length + "!");
}
loginNewAvatarHelper(_loc4_,_loc3_);
gMainFrame.server.setXtObject_Str("ln",_loc3_,gMainFrame.server.isWorldZone);
}
private static function loginNewAvatarHelper(param1:Array, param2:Array) : void
{
var _loc3_:int = int(param1.length);
param2.push(_loc3_);
var _loc4_:int = 0;
while(_loc4_ < _loc3_)
{
param2.push(param1[_loc4_].defId);
_loc4_++;
}
}
public static function handleXtReply(param1:SFEvent) : void
{
var _loc2_:Array = param1.obj;
DebugUtility.debugTrace("data:" + _loc2_);
switch(_loc2_[0])
{
case "la":
logIn.handleLoginAvailable(_loc2_,_laReturnType);
break;
case "lc":
logIn.handleLoginCreate(_loc2_);
break;
case "ln":
logIn.handleNewAvatarData(_loc2_);
break;
default:
throw new Error("LogIn illegal data:" + _loc2_[0]);
}
}
}
}