######################################## ##############Edited by Casawir######### ######################################## import dbg, app, net, ui, ime, snd import wndMgr, musicInfo, serverInfo, systemSetting, ServerStateChecker, locale import constInfo, uiCommon, time, ServerCommandParser, ime, uiScriptLocale RUNUP_MATRIX_AUTH = FALSE NEWCIBN_PASSPOD_AUTH = FALSE LOGIN_DELAY_SEC = 0.0 SKIP_LOGIN_PHASE = FALSE SKIP_LOGIN_PHASE_SUPPORT_CHANNEL = FALSE FULL_BACK_IMAGE = FALSE PASSPOD_MSG_DICT = {} if locale.IsNEWCIBN() or locale.IsCIBN10(): LOGIN_DELAY_SEC = 20.0 FULL_BACK_IMAGE = TRUE NEWCIBN_PASSPOD_AUTH = TRUE PASSPOD_MSG_DICT = { "PASERR1" : locale.LOGIN_FAILURE_PASERR1, "PASERR2" : locale.LOGIN_FAILURE_PASERR2, "PASERR3" : locale.LOGIN_FAILURE_PASERR3, "PASERR4" : locale.LOGIN_FAILURE_PASERR4, "PASERR5" : locale.LOGIN_FAILURE_PASERR5, } elif locale.IsYMIR() or locale.IsCHEONMA(): FULL_BACK_IMAGE = TRUE elif locale.IsHONGKONG(): FULL_BACK_IMAGE = TRUE RUNUP_MATRIX_AUTH = TRUE PASSPOD_MSG_DICT = { "NOTELE" : locale.LOGIN_FAILURE_NOTELEBLOCK, } elif locale.IsJAPAN(): FULL_BACK_IMAGE = TRUE def IsFullBackImage(): global FULL_BACK_IMAGE return FULL_BACK_IMAGE def IsLoginDelay(): global LOGIN_DELAY_SEC if LOGIN_DELAY_SEC > 0.0: return TRUE else: return FALSE def IsRunupMatrixAuth(): global RUNUP_MATRIX_AUTH return RUNUP_MATRIX_AUTH def IsNEWCIBNPassPodAuth(): global NEWCIBN_PASSPOD_AUTH return NEWCIBN_PASSPOD_AUTH def GetLoginDelay(): global LOGIN_DELAY_SEC return LOGIN_DELAY_SEC app.SetGuildMarkPath("test") class ConnectingDialog(ui.ScriptWindow): def __init__(self): ui.ScriptWindow.__init__(self) self.__LoadDialog() self.eventTimeOver = lambda *arg: None self.eventExit = lambda *arg: None def __del__(self): ui.ScriptWindow.__del__(self) def __LoadDialog(self): try: PythonScriptLoader = ui.PythonScriptLoader() PythonScriptLoader.LoadScriptFile(self, "UIScript/ConnectingDialog.py") self.board = self.GetChild("board") self.message = self.GetChild("message") self.countdownMessage = self.GetChild("countdown_message") except: import exception exception.Abort("ConnectingDialog.LoadDialog.BindObject") def Open(self, waitTime): curTime = time.clock() self.endTime = curTime + waitTime self.Lock() self.SetCenterPosition() self.SetTop() self.Show() def Close(self): self.Unlock() self.Hide() def Destroy(self): self.Hide() self.ClearDictionary() def SetText(self, text): self.message.SetText(text) def SetCountDownMessage(self, waitTime): self.countdownMessage.SetText("%.0f%s" % (waitTime, locale.SECOND)) def SAFE_SetTimeOverEvent(self, event): self.eventTimeOver = ui.__mem_func__(event) def SAFE_SetExitEvent(self, event): self.eventExit = ui.__mem_func__(event) def OnUpdate(self): lastTime = max(0, self.endTime - time.clock()) if 0 == lastTime: self.Close() self.eventTimeOver() else: self.SetCountDownMessage(self.endTime - time.clock()) def OnPressExitKey(self): #self.eventExit() return TRUE class LoginWindow(ui.ScriptWindow): IS_TEST = net.IsTest() def __init__(self, stream): print "NEW LOGIN WINDOW ----------------------------------------------------------------------------" ui.ScriptWindow.__init__(self) net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self) net.SetAccountConnectorHandler(self) self.matrixInputChanceCount = 0 self.lastLoginTime = 0 self.inputDialog = None self.connectingDialog = None self.stream=stream self.isNowCountDown=FALSE self.isStartError=FALSE self.loadingImage = None def __del__(self): net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self) net.SetAccountConnectorHandler(0) ui.ScriptWindow.__del__(self) print "---------------------------------------------------------------------------- DELETE LOGIN WINDOW" def Open(self): ServerStateChecker.Create(self) print "LOGIN WINDOW OPEN ----------------------------------------------------------------------------" self.loginFailureMsgDict={ #"DEFAULT" : locale.LOGIN_FAILURE_UNKNOWN, "ALREADY" : locale.LOGIN_FAILURE_ALREAY, "NOID" : locale.LOGIN_FAILURE_NOT_EXIST_ID, "WRONGPWD" : locale.LOGIN_FAILURE_WRONG_PASSWORD, "FULL" : locale.LOGIN_FAILURE_TOO_MANY_USER, "SHUTDOWN" : locale.LOGIN_FAILURE_SHUTDOWN, "REPAIR" : locale.LOGIN_FAILURE_REPAIR_ID, "BLOCK" : locale.LOGIN_FAILURE_BLOCK_ID, "WRONGMAT" : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER, "QUIT" : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE, "BESAMEKEY" : locale.LOGIN_FAILURE_BE_SAME_KEY, "NOTAVAIL" : locale.LOGIN_FAILURE_NOT_AVAIL, "NOBILL" : locale.LOGIN_FAILURE_NOBILL, "BLKLOGIN" : locale.LOGIN_FAILURE_BLOCK_LOGIN, "WEBBLK" : locale.LOGIN_FAILURE_WEB_BLOCK, } self.loginFailureFuncDict = { "WRONGPWD" : self.__DisconnectAndInputPassword, "WRONGMAT" : self.__DisconnectAndInputMatrix, "QUIT" : app.Exit, } self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight()) self.SetWindowName("LoginWindow") if not self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py"): dbg.TraceError("LoginWindow.Open - __LoadScript Error") return self.__LoadLoginInfo("loginInfo.py") if app.loggined: self.loginFailureFuncDict = { "WRONGPWD" : app.Exit, "WRONGMAT" : app.Exit, "QUIT" : app.Exit, } if musicInfo.loginMusic != "": snd.SetMusicVolume(systemSetting.GetMusicVolume()) snd.FadeInMusic("BGM/"+musicInfo.loginMusic) snd.SetSoundVolume(systemSetting.GetSoundVolume()) # pevent key "[" "]" ime.AddExceptKey(91) ime.AddExceptKey(93) self.Show() global SKIP_LOGIN_PHASE if SKIP_LOGIN_PHASE: if self.isStartError: self.connectBoard.Hide() self.loginBoard.Hide() self.PopupNotifyMessage(locale.LOGIN_CONNECT_FAILURE, self.__ExitGame) return else: connectingIP = self.stream.GetConnectAddr() if connectingIP: self.__OpenLoginBoard() if IsFullBackImage(): self.GetChild("bg1").Hide() self.GetChild("bg2").Show() app.ShowCursor() self.stream.SetConnectInfo("31.133.1.58", 13000, "31.133.1.58", 11002) net.SetServerInfo("AvatarMT2 - Ch1") net.SetMarkServer("31.133.1.58", 13000) self.logo_ch1.Show() def Close(self): if self.connectingDialog: self.connectingDialog.Close() self.connectingDialog = None ServerStateChecker.Destroy(self) print "---------------------------------------------------------------------------- CLOSE LOGIN WINDOW " # # selectMusic?? ???˘¬˘¬e BGM?? ˘­ˇŔˇľa?Cˇ¤I ĄěIˇĆ©© ˘Ą? ???¨ĎC?˘Ą?. # if musicInfo.loginMusic != "" and musicInfo.selectMusic != "": snd.FadeOutMusic("BGM/"+musicInfo.loginMusic) ## NOTE : idEditLine?I pwdEditLine?? ?????˘çˇĆ˘§ ?ˇ©ˇ¤I ?ˇţˇĆa ĄěC?i?O?i?ˇ© ## Event˘¬| ˇĆˇ©A|ˇ¤I ??ˇľa?ˇ© C?AO?i?©¬˘¬˘¬ C?˘Ą?˘Ą? - [levites] self.idEditLine.SetTabEvent(0) self.idEditLine.SetReturnEvent(0) self.pwdEditLine.SetReturnEvent(0) self.pwdEditLine.SetTabEvent(0) self.connectBoard = None self.loginBoard = None self.idEditLine = None self.pwdEditLine = None self.inputDialog = None self.connectingDialog = None self.loadingImage = None # RUNUP_MATRIX_AUTH self.matrixQuizBoard = None self.matrixAnswerInput = None self.matrixAnswerOK = None self.matrixAnswerCancel = None # RUNUP_MATRIX_AUTH_END # NEWCIBN_PASSPOD_AUTH self.passpodBoard = None self.passpodAnswerInput = None self.passpodAnswerOK = None self.passpodAnswerCancel = None # NEWCIBN_PASSPOD_AUTH_END self.KillFocus() self.Hide() self.stream.popupWindow.Close() self.loginFailureFuncDict=None ime.ClearExceptKey() app.HideCursor() def __SaveChannelInfo(self): try: file=open("channel.inf", "w") file.write("%d %d %d" % (self.__GetServerID(), self.__GetChannelID(), self.__GetRegionID())) except: print "LoginWindow.__SaveChannelInfo - SaveError" def __LoadChannelInfo(self): try: file=open("channel.inf") lines=file.readlines() if len(lines)>0: tokens=lines[0].split() selServerID=int(tokens[0]) selChannelID=int(tokens[1]) if len(tokens) == 3: regionID = int(tokens[2]) return regionID, selServerID, selChannelID except: print "LoginWindow.__LoadChannelInfo - OpenError" return -1, -1, -1 def __ExitGame(self): app.Exit() def SetIDEditLineFocus(self): if self.idEditLine != None: self.idEditLine.SetFocus() def SetPasswordEditLineFocus(self): if locale.IsEUROPE(): if self.idEditLine != None: #0000862: [M2EU] ˇ¤Iˇľˇż?I?˘¨ ?E?ˇŔ ?˘§ˇ¤?: A?ˇ¤a˘©? ˘¬??u None ?©©A˘´Ąě? self.idEditLine.SetText("") self.idEditLine.SetFocus() #0000685: [M2EU] ????Ąě©˘/???©˘???¨© ???©¬ ˇĆ˘§˘ĄE ?oˇľˇż ?oA˘´: ?ˇěA˘ŇˇĆC ????Ąě©˘ˇ¤I ?ˇŔA?˘©?ˇĆ˘§ ˇĆ˘§ˇĆO ˘¬˘¬Ąěc˘Ą? if self.pwdEditLine != None: #0000862: [M2EU] ˇ¤Iˇľˇż?I?˘¨ ?E?ˇŔ ?˘§ˇ¤?: A?ˇ¤a˘©? ˘¬??u None ?©©A˘´Ąě? self.pwdEditLine.SetText("") else: if self.pwdEditLine != None: self.pwdEditLine.SetFocus() def OnEndCountDown(self): self.isNowCountDown = FALSE self.OnConnectFailure() def OnConnectFailure(self): if self.isNowCountDown: return snd.PlaySound("sound/ui/loginfail.wav") if self.connectingDialog: self.connectingDialog.Close() self.connectingDialog = None if app.loggined: self.PopupNotifyMessage(locale.LOGIN_CONNECT_FAILURE, self.__ExitGame) else: self.PopupNotifyMessage(locale.LOGIN_CONNECT_FAILURE, self.SetPasswordEditLineFocus) def OnHandShake(self): if not IsLoginDelay(): snd.PlaySound("sound/ui/loginok.wav") self.PopupDisplayMessage(locale.LOGIN_CONNECT_SUCCESS) def OnLoginStart(self): if not IsLoginDelay(): self.PopupDisplayMessage(locale.LOGIN_PROCESSING) def OnLoginFailure(self, error): if self.connectingDialog: self.connectingDialog.Close() self.connectingDialog = None try: loginFailureMsg = self.loginFailureMsgDict[error] except KeyError: if PASSPOD_MSG_DICT: try: loginFailureMsg = PASSPOD_MSG_DICT[error] except KeyError: loginFailureMsg = locale.LOGIN_FAILURE_UNKNOWN + error else: loginFailureMsg = locale.LOGIN_FAILURE_UNKNOWN + error #0000685: [M2EU] ????Ąě©˘/???©˘???¨© ???©¬ ˇĆ˘§˘ĄE ?oˇľˇż ?oA˘´: ?ˇěA˘ŇˇĆC ?©˘˘©??oĄě?ˇ¤I ?ˇŔA?˘©?ˇĆ˘§ ˇĆ˘§ˇĆO ˘¬˘¬Ąěc˘Ą? loginFailureFunc=self.loginFailureFuncDict.get(error, self.SetPasswordEditLineFocus) if app.loggined: self.PopupNotifyMessage(loginFailureMsg, self.__ExitGame) else: self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc) snd.PlaySound("sound/ui/loginfail.wav") def __DisconnectAndInputID(self): if self.connectingDialog: self.connectingDialog.Close() self.connectingDialog = None self.SetIDEditLineFocus() net.Disconnect() def __DisconnectAndInputPassword(self): if self.connectingDialog: self.connectingDialog.Close() self.connectingDialog = None self.SetPasswordEditLineFocus() net.Disconnect() def __DisconnectAndInputMatrix(self): if self.connectingDialog: self.connectingDialog.Close() self.connectingDialog = None self.stream.popupWindow.Close() self.matrixInputChanceCount -= 1 if self.matrixInputChanceCount <= 0: self.__OnCloseInputDialog() elif self.inputDialog: self.inputDialog.Show() def __LoadScript(self, fileName): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, fileName) except: import exception exception.Abort("LoginWindow.__LoadScript.LoadObject") try: GetObject=self.GetChild self.connectBoard = GetObject("ConnectBoard") self.loginBoard = GetObject("LoginBoard") self.ch_buttons = GetObject("ch_buttons") self.ch1_button = GetObject("ch1_button") self.ch2_button = GetObject("ch2_button") self.ch3_button = GetObject("ch3_button") self.ch4_button = GetObject("ch4_button") self.x2_buttony = GetObject("2_buttony") self.logo_ch1 = GetObject("logo_ch1") self.logo_ch2 = GetObject("logo_ch2") self.logo_ch3 = GetObject("logo_ch3") self.logo_ch4 = GetObject("logo_ch4") self.idEditLine = GetObject("ID_EditLine") self.pwdEditLine = GetObject("Password_EditLine") self.selectConnectButton = GetObject("SelectConnectButton") self.konta_button = GetObject("konta_button") self.loginButton = GetObject("LoginButton") self.loginExitButton = GetObject("LoginExitButton") self.czcziona_button = GetObject("czcziona_button") self.acc1loginButton = GetObject("Acc1Login") self.acc2loginButton = GetObject("Acc2Login") self.acc3loginButton = GetObject("Acc3Login") self.acc4loginButton = GetObject("Acc4Login") self.LoginSaveButton = GetObject("LoginSaveButton") self.ACC1_LABEL = GetObject("ACC1_LABEL") self.ACC2_LABEL = GetObject("ACC2_LABEL") self.ACC3_LABEL = GetObject("ACC3_LABEL") self.ACC4_LABEL = GetObject("ACC4_LABEL") self.ACC1__LABEL = GetObject("ACC1__LABEL") self.ACC2__LABEL = GetObject("ACC2__LABEL") self.ACC3__LABEL = GetObject("ACC3__LABEL") self.ACC4__LABEL = GetObject("ACC4__LABEL") self.Acc1Del = GetObject("Acc1Del") self.Acc2Del = GetObject("Acc2Del") self.Acc3Del = GetObject("Acc3Del") self.Acc4Del = GetObject("Acc4Del") if locale.IsVIETNAM(): self.checkButton = GetObject("CheckButton") self.checkButton.Down() # RUNUP_MATRIX_AUTH if IsRunupMatrixAuth(): self.matrixQuizBoard = GetObject("RunupMatrixQuizBoard") self.matrixAnswerInput = GetObject("RunupMatrixAnswerInput") self.matrixAnswerOK = GetObject("RunupMatrixAnswerOK") self.matrixAnswerCancel = GetObject("RunupMatrixAnswerCancel") # RUNUP_MATRIX_AUTH_END # NEWCIBN_PASSPOD_AUTH if IsNEWCIBNPassPodAuth(): self.passpodBoard = GetObject("NEWCIBN_PASSPOD_BOARD") self.passpodAnswerInput = GetObject("NEWCIBN_PASSPOD_INPUT") self.passpodAnswerOK = GetObject("NEWCIBN_PASSPOD_OK") self.passpodAnswerCancel= GetObject("NEWCIBN_PASSPOD_CANCEL") # NEWCIBN_PASSPOD_AUTH_END self.AccountBoard = self.GetChild2("AccountBoard") except: import exception exception.Abort("LoginWindow.__LoadScript.BindObject") self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton)) self.loginExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton)) self.ch1_button.SetEvent(ui.__mem_func__(self.OnClickCH_1Button)) self.ch2_button.SetEvent(ui.__mem_func__(self.OnClickCH_2Button)) self.ch3_button.SetEvent(ui.__mem_func__(self.OnClickCH_3Button)) self.ch4_button.SetEvent(ui.__mem_func__(self.OnClickCH_4Button)) self.konta_button.SetEvent(ui.__mem_func__(self.OnClickkonta_button)) self.czcziona_button.SetEvent(ui.__mem_func__(self.OnClickCzcziona_button)) self.selectConnectButton.SetEvent(ui.__mem_func__(self.OnClickConnectButton)) self.acc1loginButton.SetEvent(ui.__mem_func__(self.__OnClickACC1LoginButton)) self.acc2loginButton.SetEvent(ui.__mem_func__(self.__OnClickACC2LoginButton)) self.acc3loginButton.SetEvent(ui.__mem_func__(self.__OnClickACC3LoginButton)) self.acc4loginButton.SetEvent(ui.__mem_func__(self.__OnClickACC4LoginButton)) self.LoginSaveButton.SetEvent(ui.__mem_func__(self.__OnClickLoginSaveButton)) self.Acc1Del.SetEvent(ui.__mem_func__(self.__OnClickAcc1DelButton)) self.Acc2Del.SetEvent(ui.__mem_func__(self.__OnClickAcc2DelButton)) self.Acc3Del.SetEvent(ui.__mem_func__(self.__OnClickAcc3DelButton)) self.Acc4Del.SetEvent(ui.__mem_func__(self.__OnClickAcc4DelButton)) self.idEditLine.SetReturnEvent(ui.__mem_func__(self.pwdEditLine.SetFocus)) self.idEditLine.SetTabEvent(ui.__mem_func__(self.pwdEditLine.SetFocus)) self.pwdEditLine.SetReturnEvent(ui.__mem_func__(self.__OnClickLoginButton)) self.pwdEditLine.SetTabEvent(ui.__mem_func__(self.idEditLine.SetFocus)) # RUNUP_MATRIX_AUTH if IsRunupMatrixAuth(): self.matrixAnswerOK.SAFE_SetEvent(self.__OnClickMatrixAnswerOK) self.matrixAnswerCancel.SAFE_SetEvent(self.__OnClickMatrixAnswerCancel) self.matrixAnswerInput.SAFE_SetReturnEvent(self.__OnClickMatrixAnswerOK) # RUNUP_MATRIX_AUTH_END # NEWCIBN_PASSPOD_AUTH if IsNEWCIBNPassPodAuth(): self.passpodAnswerOK.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerOK) self.passpodAnswerCancel.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerCancel) self.passpodAnswerInput.SAFE_SetReturnEvent(self.__OnClickNEWCIBNPasspodAnswerOK) # NEWCIBN_PASSPOD_AUTH_END self.__LoadACCNames() self.ch_buttons.Hide() self.AccountBoard.Hide() self.isOpen_2 = 0 self.logo_ch1.Hide() self.logo_ch2.Hide() self.logo_ch3.Hide() self.logo_ch4.Hide() if IsFullBackImage(): self.GetChild("bg1").Show() return 1 def OnClickCzcziona_button(self): f = open('pack/font.cfg', 'r+') linijka = f.readline() if linijka == "Georgia:13|Georgia:13|Georgia:11": f.seek(0) f.truncate() f.write("Tahoma:12|Tahoma:14|Tahoma:9") self.PopupNotifyMessage("Zmieniono na czcionkꡔahoma, zrestartuj klienta, aby zatwierdzi桺miany.") else: f.seek(0) f.truncate() f.write("Georgia:13|Georgia:13|Georgia:11") self.PopupNotifyMessage("Zmieniono na czcionkꡇeorgia, zrestartuj klienta, aby zatwierdzi桺miany.") f.close() def OnClickConnectButton(self): self.ch_buttons.Show() self.x2_buttony.Hide() def OnClickkonta_button(self): if self.isOpen_2 == 0: self.AccountBoard.Show() self.isOpen_2 = 1 else: self.AccountBoard.Hide() self.isOpen_2 = 0 def __LoadACCInfos(self, accid): import linecache login = linecache.getline("lib/account" + str(accid) + ".cfg", 1) password = linecache.getline("lib/account" + str(accid) + ".cfg", 2) login = login.replace('\n', '') self.Connect(login, password) def __OnClickACC1LoginButton(self): self.__LoadACCInfos(1) def __OnClickACC2LoginButton(self): self.__LoadACCInfos(2) def __OnClickACC3LoginButton(self): self.__LoadACCInfos(3) def __OnClickACC4LoginButton(self): self.__LoadACCInfos(4) def __OnClickLoginSaveButton(self): id = self.idEditLine.GetText() pwd = self.pwdEditLine.GetText() fd = open( "lib/account1.cfg" ) login1 = fd.readline() login1.replace( "\n", "" ) fd.close() fd = open( "lib/account2.cfg" ) login2 = fd.readline() login2.replace( "\n", "" ) fd.close() fd = open( "lib/account3.cfg" ) login3 = fd.readline() login3.replace( "\n", "" ) fd.close() fd = open( "lib/account4.cfg" ) login4 = fd.readline() login4.replace( "\n", "" ) fd.close() if login1 == "": slot = 1 elif login2 == "": slot = 2 elif login3 == "": slot = 3 elif login4 == "": slot = 4 else: self.PopupNotifyMessage("Nie ma wolnego miejsca na zapisanie!") return f = open("lib/account" + str(slot) + ".cfg", "w") f.write (id +"\n") f.write (pwd) f.close() self.PopupNotifyMessage("Twoje dane zostaԹ zapisane!") self.__LoadACCNames() def __OnClickAcc1DelButton(self): f = open("lib/account1.cfg", "w") f.write ("") f.close() self.ACC1__LABEL.SetText("1. Puste") self.ACC1_LABEL.SetText("1. Puste") self.__LoadACCNames() def __OnClickAcc2DelButton(self): f = open("lib/account2.cfg", "w") f.write ("") f.close() self.ACC2__LABEL.SetText("2. Puste") self.ACC2_LABEL.SetText("2. Puste") self.__LoadACCNames() def __OnClickAcc3DelButton(self): f = open("lib/account3.cfg", "w") f.write ("") f.close() self.ACC3__LABEL.SetText("3. Puste") self.ACC3_LABEL.SetText("3. Puste") self.__LoadACCNames() def __OnClickAcc4DelButton(self): f = open("lib/account4.cfg", "w") f.write ("") f.close() self.ACC4__LABEL.SetText("4. Puste") self.ACC4_LABEL.SetText("4. Puste") self.__LoadACCNames() def __LoadACCNames(self): fd = open( "lib/account1.cfg" ) login1 = fd.readline() login1.replace( "\n", "" ) fd.close() fd = open( "lib/account2.cfg" ) login2 = fd.readline() login2.replace( "\n", "" ) fd.close() fd = open( "lib/account3.cfg" ) login3 = fd.readline() login3.replace( "\n", "" ) fd.close() fd = open( "lib/account4.cfg" ) login4 = fd.readline() login4.replace( "\n", "" ) fd.close() if login1 != "": self.ACC1__LABEL.SetText("1. "+login1) self.ACC1_LABEL.SetText("1. "+login1) if login2 != "": self.ACC2__LABEL.SetText("2. "+login2) self.ACC2_LABEL.SetText("2. "+login2) if login3 != "": self.ACC3__LABEL.SetText("3. "+login3) self.ACC3_LABEL.SetText("3. "+login3) if login4 != "": self.ACC4__LABEL.SetText("4. "+login4) self.ACC4_LABEL.SetText("4. "+login4) def Connect(self, id, pwd): if constInfo.SEQUENCE_PACKET_ENABLE: net.SetPacketSequenceMode() if IsLoginDelay(): loginDelay = GetLoginDelay() self.connectingDialog = ConnectingDialog() self.connectingDialog.Open(loginDelay) self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown) self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey) self.isNowCountDown = TRUE else: self.stream.popupWindow.Close() self.stream.popupWindow.Open(locale.LOGIN_CONNETING, self.SetPasswordEditLineFocus, locale.UI_CANCEL) self.stream.SetLoginInfo(id, pwd) self.stream.Connect() def __OnClickExitButton(self): self.stream.SetPhaseWindow(0) def __LoadLoginInfo(self, loginInfoFileName): try: loginInfo={} execfile(loginInfoFileName, loginInfo) except IOError: print(\ "?UĄě? ˇ¤Iˇľˇż?I?ˇí C?˘©?ˇ¤A˘¬e" + loginInfoFileName + "?A???ˇí ????C?AO???a\n"\ "\n"\ "©©ˇí?e:\n"\ "================================================================\n"\ "addr=AO??\n"\ "port=?ˇŔ?˘ç\n"\ "id=????Ąě©˘\n"\ "pwd=???©˘???¨©\n"\ "slot=A©©˘¬??I ?ˇľ?? ?IĄě|˘©? (??ˇĆ?©©? -1??˘¬e ?UĄě? ?ˇľ?? ??CO)\n"\ "autoLogin=?UĄě? A˘¨?O ?¨Ď?I\n" "autoSelect=?UĄě? A˘¨?O ?¨Ď?I\n" "locale=(ymir) LC_Ymir ??ˇĆ??? ymirˇ¤I ??Ąě?. AoA˘´C?Ao ???˘¬˘¬e koreaˇ¤I ??Ąě?\n" ); id=loginInfo.get("id", "") pwd=loginInfo.get("pwd", "") addr=loginInfo.get("addr", "") port=loginInfo.get("port", 0) account_addr=loginInfo.get("account_addr", addr) account_port=loginInfo.get("account_port", port) locale = loginInfo.get("locale", "") if addr and port: net.SetMarkServer(addr, port) if locale == "ymir" : net.SetServerInfo("?Ąě˘¬˘Ň ?ˇ©?o") else: net.SetServerInfo(addr+":"+str(port)) slot=loginInfo.get("slot", 0) isAutoLogin=loginInfo.get("auto", 0) isAutoLogin=loginInfo.get("autoLogin", 0) isAutoSelect=loginInfo.get("autoSelect", 0) self.stream.SetCharacterSlot(slot) self.stream.SetConnectInfo(addr, port, account_addr, account_port) self.stream.isAutoLogin=isAutoLogin self.stream.isAutoSelect=isAutoSelect self.id = None self.pwd = None self.loginnedServer = None self.loginnedChannel = None app.loggined = FALSE self.loginInfo = loginInfo if self.id and self.pwd: app.loggined = TRUE if isAutoLogin: self.Connect(id, pwd) print "==================================================================================" print "?UĄě? ˇ¤Iˇľˇż?I: %s - %s:%d %s" % (loginInfoFileName, addr, port, id) print "==================================================================================" def PopupDisplayMessage(self, msg): self.stream.popupWindow.Close() self.stream.popupWindow.Open(msg) def PopupNotifyMessage(self, msg, func=0): if not func: func=self.EmptyFunc self.stream.popupWindow.Close() self.stream.popupWindow.Open(msg, func, locale.UI_OK) # RUNUP_MATRIX_AUTH def BINARY_OnRunupMatrixQuiz(self, quiz): if not IsRunupMatrixAuth(): return id = self.GetChild("RunupMatrixID") id.SetText(self.idEditLine.GetText()) code = self.GetChild("RunupMatrixCode") code.SetText("".join(["[%c,%c]" % (quiz[i], quiz[i+1]) for i in xrange(0, len(quiz), 2)])) self.stream.popupWindow.Close() self.connectBoard.Hide() self.loginBoard.Hide() self.matrixQuizBoard.Show() self.matrixAnswerInput.SetFocus() def __OnClickMatrixAnswerOK(self): answer = self.matrixAnswerInput.GetText() print "matrix_quiz.ok" net.SendRunupMatrixCardPacket(answer) self.matrixQuizBoard.Hide() self.stream.popupWindow.Close() self.stream.popupWindow.Open("WAITING FOR MATRIX AUTHENTICATION", self.__OnClickMatrixAnswerCancel, locale.UI_CANCEL) def __OnClickMatrixAnswerCancel(self): print "matrix_quiz.cancel" if self.matrixQuizBoard: self.matrixQuizBoard.Hide() if self.connectBoard: self.connectBoard.Show() if self.loginBoard: self.loginBoard.Show() # RUNUP_MATRIX_AUTH_END # NEWCIBN_PASSPOD_AUTH def BINARY_OnNEWCIBNPasspodRequest(self): if not IsNEWCIBNPassPodAuth(): return if self.connectingDialog: self.connectingDialog.Close() self.connectingDialog = None self.stream.popupWindow.Close() self.connectBoard.Hide() self.loginBoard.Hide() self.passpodBoard.Show() self.passpodAnswerInput.SetFocus() def BINARY_OnNEWCIBNPasspodFailure(self): if not IsNEWCIBNPassPodAuth(): return def __OnClickNEWCIBNPasspodAnswerOK(self): answer = self.passpodAnswerInput.GetText() print "passpod.ok" net.SendNEWCIBNPasspodAnswerPacket(answer) self.passpodAnswerInput.SetText("") self.passpodBoard.Hide() self.stream.popupWindow.Close() self.stream.popupWindow.Open(locale.WAIT_FOR_PASSPOD, self.__OnClickNEWCIBNPasspodAnswerCancel, locale.UI_CANCEL) def __OnClickNEWCIBNPasspodAnswerCancel(self): print "passpod.cancel" if self.passpodBoard: self.passpodBoard.Hide() if self.connectBoard: self.connectBoard.Show() if self.loginBoard: self.loginBoard.Show() # NEWCIBN_PASSPOD_AUTH_END def OnMatrixCard(self, row1, row2, row3, row4, col1, col2, col3, col4): if self.connectingDialog: self.connectingDialog.Close() self.connectingDialog = None self.matrixInputChanceCount = 3 self.stream.popupWindow.Close() # CHINA_MATRIX_CARD_BUG_FIX ## A~Z ˇľiAo 26 ??©©ˇí?C ˇĆ??? Ąěe?i?O?i?©¬˘¬˘¬ C?˘Ą?. ## Python Exception Log ?˘§?ˇ© ˇľˇż ??ˇío?C ˇĆ??? Ąěe?i?O?i?ˇ© ?˘§ˇ¤? ??Ao ## C?Ąě? ?O C?ˇľ?A? ˇ¤Iˇľˇż?˘§?ˇ© ??ˇĆO ?ˇĆ?eĄěC˘ĄAAo˘ĄA ˘¬©˘˘¬¨©ˇĆU?˘© row1 = min(30, row1) row2 = min(30, row2) row3 = min(30, row3) row4 = min(30, row4) # END_OF_CHINA_MATRIX_CARD_BUG_FIX row1 = chr(row1 + ord('A')) row2 = chr(row2 + ord('A')) row3 = chr(row3 + ord('A')) row4 = chr(row4 + ord('A')) col1 = col1 + 1 col2 = col2 + 1 col3 = col3 + 1 col4 = col4 + 1 inputDialog = uiCommon.InputDialogWithDescription2() inputDialog.SetMaxLength(8) inputDialog.SetAcceptEvent(ui.__mem_func__(self.__OnAcceptMatrixCardData)) inputDialog.SetCancelEvent(ui.__mem_func__(self.__OnCancelMatrixCardData)) inputDialog.SetTitle(locale.INPUT_MATRIX_CARD_TITLE) inputDialog.SetDescription1(locale.INPUT_MATRIX_CARD_NUMBER) inputDialog.SetDescription2("%c%d %c%d %c%d %c%d" % (row1, col1, row2, col2, row3, col3, row4, col4)) inputDialog.Open() self.inputDialog = inputDialog def __OnAcceptMatrixCardData(self): text = self.inputDialog.GetText() net.SendChinaMatrixCardPacket(text) if self.inputDialog: self.inputDialog.Hide() self.PopupNotifyMessage(locale.LOGIN_PROCESSING) return TRUE def __OnCancelMatrixCardData(self): self.SetPasswordEditLineFocus() self.__OnCloseInputDialog() self.__DisconnectAndInputPassword() return TRUE def __OnCloseInputDialog(self): if self.inputDialog: self.inputDialog.Close() self.inputDialog = None return TRUE def OnPressExitKey(self): self.stream.popupWindow.Close() self.stream.SetPhaseWindow(0) return TRUE def OnExit(self): self.stream.popupWindow.Close() self.stream.popupWindow.Open(locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE, app.Exit, locale.UI_OK) def OnUpdate(self): ServerStateChecker.Update() def EmptyFunc(self): pass ##################################################################################### def __GetRegionID(self): return 0 # SEVER_LIST_BUG_FIX def __ServerIDToServerIndex(self, regionID, targetServerID): try: regionDict = serverInfo.REGION_DICT[regionID] except KeyError: return -1 retServerIndex = 0 for eachServerID, regionDataDict in regionDict.items(): if eachServerID == targetServerID: return retServerIndex retServerIndex += 1 return -1 def __ChannelIDToChannelIndex(self, channelID): return channelID - 1 # END_OF_SEVER_LIST_BUG_FIX def __OpenLoginBoard(self): # RUNUP_MATRIX_AUTH if IsRunupMatrixAuth(): self.matrixQuizBoard.Hide() # RUNUP_MATRIX_AUTH_END # NEWCIBN_PASSPOD_AUTH if IsNEWCIBNPassPodAuth(): self.passpodBoard.Hide() # NEWCIBN_PASSPOD_AUTH_END if app.loggined: self.Connect(self.id, self.pwd) self.connectBoard.Hide() self.loginBoard.Hide() elif not self.stream.isAutoLogin: self.connectBoard.Show() self.loginBoard.Show() ## if users have the login infomation, then don't initialize.2005.9 haho if self.idEditLine == None: self.idEditLine.SetText("") if self.pwdEditLine == None: self.pwdEditLine.SetText("") self.idEditLine.SetFocus() global SKIP_LOGIN_PHASE if SKIP_LOGIN_PHASE: if not self.loginInfo: self.connectBoard.Hide() def __OnSelectRegionGroup(self): self.__RefreshServerList() def __RefreshServerList(self): regionID = self.__GetRegionID() if not serverInfo.REGION_DICT.has_key(regionID): return self.serverList.ClearItem() regionDict = serverInfo.REGION_DICT[regionID] # SEVER_LIST_BUG_FIX visible_index = 1 for id, regionDataDict in regionDict.items(): name = regionDataDict.get("name", "noname") if locale.IsBRAZIL() or locale.IsCANADA(): self.serverList.InsertItem(id, "%s" % (name)) else: if locale.IsCIBN10(): if name[0] == "#": self.serverList.InsertItem(-1, " %s" % (name[1:])) else: self.serverList.InsertItem(id, " %s" % (name)) visible_index += 1 else: try: server_id = serverInfo.SERVER_ID_DICT[id] except: server_id = visible_index self.serverList.InsertItem(id, " %02d. %s" % (int(server_id), name)) visible_index += 1 # END_OF_SEVER_LIST_BUG_FIX def __RequestServerStateList(self): regionID = self.__GetRegionID() serverID = self.__GetServerID() try: channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"] except: print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID) return for id, channelDataDict in channelDict.items(): key=channelDataDict["key"] ip=channelDataDict["ip"] udp_port=channelDataDict["udp_port"] ServerStateChecker.Request(key, ip, udp_port) def NotifyChannelState(self, addrKey, state): try: stateName=serverInfo.STATE_DICT[state] except: stateName=serverInfo.STATE_NONE regionID=int(addrKey/1000) serverID=int(addrKey/10) % 100 channelID=addrKey%10 try: serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["state"] = stateName self.__RefreshServerStateList() except: import exception exception.Abort(locale.CHANNEL_NOT_FIND_INFO) def __OnClickExitServerButton(self): print "exit server" self.__OpenLoginBoard() if IsFullBackImage(): self.GetChild("bg1").Hide() self.GetChild("bg2").Show() def __OnClickLoginButton(self): id = self.idEditLine.GetText() pwd = self.pwdEditLine.GetText() if len(id)==0: self.PopupNotifyMessage(locale.LOGIN_INPUT_ID, self.SetIDEditLineFocus) return if len(pwd)==0: self.PopupNotifyMessage(locale.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus) return self.Connect(id, pwd) def OnClickCH_1Button(self): self.stream.SetConnectInfo("31.133.1.58", 13000, "31.133.1.58", 11002) net.SetServerInfo("Eberrion - Ch1") net.SetMarkServer("31.133.1.58", 13000) self.logo_ch1.Show() self.logo_ch2.Hide() self.logo_ch3.Hide() self.logo_ch4.Hide() self.ch_buttons.Hide() self.x2_buttony.Show() def OnClickCH_2Button(self): self.stream.SetConnectInfo("31.133.1.58", 13002, "31.133.1.58", 22333) net.SetServerInfo("Eberrion - Ch 2") net.SetMarkServer("31.133.1.58", 13002) self.logo_ch2.Show() self.logo_ch1.Hide() self.logo_ch3.Hide() self.logo_ch4.Hide() self.ch_buttons.Hide() self.x2_buttony.Show() def OnClickCH_3Button(self): self.stream.SetConnectInfo("31.133.1.58", 13003, "31.133.1.58", 22333) net.SetServerInfo("Eberrion - Ch 3") net.SetMarkServer("31.133.1.58", 13003) self.logo_ch3.Show() self.logo_ch2.Hide() self.logo_ch1.Hide() self.logo_ch4.Hide() self.ch_buttons.Hide() self.x2_buttony.Show() def OnClickCH_4Button(self): self.stream.SetConnectInfo("31.133.1.58", 13004, "31.133.1.58", 22333) net.SetServerInfo("Eberrion - Ch 4") net.SetMarkServer("31.133.1.58", 13004) self.logo_ch4.Show() self.logo_ch2.Hide() self.logo_ch3.Hide() self.logo_ch1.Hide() self.ch_buttons.Hide() self.x2_buttony.Show()