Facebook
From Fiery Cheetah, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 252
  1. ########################################
  2. ##############Edited by Casawir#########
  3. ########################################
  4. import dbg, app, net, ui, ime, snd
  5. import wndMgr, musicInfo, serverInfo, systemSetting, ServerStateChecker, locale
  6. import constInfo, uiCommon, time, ServerCommandParser, ime, uiScriptLocale
  7.  
  8. RUNUP_MATRIX_AUTH = FALSE
  9. NEWCIBN_PASSPOD_AUTH = FALSE
  10.  
  11. LOGIN_DELAY_SEC = 0.0
  12. SKIP_LOGIN_PHASE = FALSE
  13. SKIP_LOGIN_PHASE_SUPPORT_CHANNEL = FALSE
  14. FULL_BACK_IMAGE = FALSE
  15.  
  16. PASSPOD_MSG_DICT = {}
  17.  
  18.  
  19. if locale.IsNEWCIBN() or locale.IsCIBN10():
  20.         LOGIN_DELAY_SEC = 20.0
  21.         FULL_BACK_IMAGE = TRUE
  22.         NEWCIBN_PASSPOD_AUTH = TRUE
  23.         PASSPOD_MSG_DICT = {
  24.                 "PASERR1"       : locale.LOGIN_FAILURE_PASERR1,
  25.                 "PASERR2"       : locale.LOGIN_FAILURE_PASERR2,
  26.                 "PASERR3"       : locale.LOGIN_FAILURE_PASERR3,
  27.                 "PASERR4"       : locale.LOGIN_FAILURE_PASERR4,
  28.                 "PASERR5"       : locale.LOGIN_FAILURE_PASERR5,
  29.         }
  30.  
  31. elif locale.IsYMIR() or locale.IsCHEONMA():
  32.         FULL_BACK_IMAGE = TRUE
  33.  
  34. elif locale.IsHONGKONG():
  35.         FULL_BACK_IMAGE = TRUE
  36.         RUNUP_MATRIX_AUTH = TRUE
  37.         PASSPOD_MSG_DICT = {
  38.                 "NOTELE"        : locale.LOGIN_FAILURE_NOTELEBLOCK,
  39.         }
  40.  
  41. elif locale.IsJAPAN():
  42.         FULL_BACK_IMAGE = TRUE
  43.  
  44. def IsFullBackImage():
  45.         global FULL_BACK_IMAGE
  46.         return FULL_BACK_IMAGE
  47.  
  48. def IsLoginDelay():
  49.         global LOGIN_DELAY_SEC
  50.         if LOGIN_DELAY_SEC > 0.0:
  51.                 return TRUE
  52.         else:
  53.                 return FALSE
  54.  
  55. def IsRunupMatrixAuth():
  56.         global RUNUP_MATRIX_AUTH
  57.         return RUNUP_MATRIX_AUTH
  58.  
  59. def IsNEWCIBNPassPodAuth():
  60.         global NEWCIBN_PASSPOD_AUTH
  61.         return NEWCIBN_PASSPOD_AUTH
  62.  
  63. def GetLoginDelay():
  64.         global LOGIN_DELAY_SEC
  65.         return LOGIN_DELAY_SEC
  66.  
  67. app.SetGuildMarkPath("test")
  68.  
  69. class ConnectingDialog(ui.ScriptWindow):
  70.  
  71.         def __init__(self):
  72.                 ui.ScriptWindow.__init__(self)
  73.                 self.__LoadDialog()
  74.                 self.eventTimeOver = lambda *arg: None
  75.                 self.eventExit = lambda *arg: None
  76.  
  77.         def __del__(self):
  78.                 ui.ScriptWindow.__del__(self)
  79.  
  80.         def __LoadDialog(self):
  81.                 try:
  82.                         PythonScriptLoader = ui.PythonScriptLoader()
  83.                         PythonScriptLoader.LoadScriptFile(self, "UIScript/ConnectingDialog.py")
  84.  
  85.                         self.board = self.GetChild("board")
  86.                         self.message = self.GetChild("message")
  87.                         self.countdownMessage = self.GetChild("countdown_message")
  88.  
  89.                 except:
  90.                         import exception
  91.                         exception.Abort("ConnectingDialog.LoadDialog.BindObject")
  92.  
  93.         def Open(self, waitTime):
  94.                 curTime = time.clock()
  95.                 self.endTime = curTime + waitTime
  96.  
  97.                 self.Lock()
  98.                 self.SetCenterPosition()
  99.                 self.SetTop()
  100.                 self.Show()
  101.  
  102.         def Close(self):
  103.                 self.Unlock()
  104.                 self.Hide()
  105.  
  106.         def Destroy(self):
  107.                 self.Hide()
  108.                 self.ClearDictionary()
  109.  
  110.         def SetText(self, text):
  111.                 self.message.SetText(text)
  112.  
  113.         def SetCountDownMessage(self, waitTime):
  114.                 self.countdownMessage.SetText("%.0f%s" % (waitTime, locale.SECOND))
  115.  
  116.         def SAFE_SetTimeOverEvent(self, event):
  117.                 self.eventTimeOver = ui.__mem_func__(event)
  118.  
  119.         def SAFE_SetExitEvent(self, event):
  120.                 self.eventExit = ui.__mem_func__(event)
  121.  
  122.         def OnUpdate(self):
  123.                 lastTime = max(0, self.endTime - time.clock())
  124.                 if 0 == lastTime:
  125.                         self.Close()
  126.                         self.eventTimeOver()
  127.                 else:
  128.                         self.SetCountDownMessage(self.endTime - time.clock())
  129.  
  130.         def OnPressExitKey(self):
  131.                 #self.eventExit()
  132.                 return TRUE
  133.  
  134. class LoginWindow(ui.ScriptWindow):
  135.  
  136.         IS_TEST = net.IsTest()
  137.  
  138.         def __init__(self, stream):
  139.                 print "NEW LOGIN WINDOW  ----------------------------------------------------------------------------"
  140.                 ui.ScriptWindow.__init__(self)
  141.                 net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
  142.                 net.SetAccountConnectorHandler(self)
  143.  
  144.                 self.matrixInputChanceCount = 0
  145.                 self.lastLoginTime = 0
  146.                 self.inputDialog = None
  147.                 self.connectingDialog = None
  148.                 self.stream=stream
  149.                 self.isNowCountDown=FALSE
  150.                 self.isStartError=FALSE
  151.  
  152.                 self.loadingImage = None
  153.  
  154.         def __del__(self):
  155.                 net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
  156.                 net.SetAccountConnectorHandler(0)
  157.                 ui.ScriptWindow.__del__(self)
  158.                 print "---------------------------------------------------------------------------- DELETE LOGIN WINDOW"
  159.  
  160.         def Open(self):
  161.                 ServerStateChecker.Create(self)
  162.  
  163.                 print "LOGIN WINDOW OPEN ----------------------------------------------------------------------------"
  164.  
  165.                 self.loginFailureMsgDict={
  166.                         #"DEFAULT" : locale.LOGIN_FAILURE_UNKNOWN,
  167.  
  168.                         "ALREADY"       : locale.LOGIN_FAILURE_ALREAY,
  169.                         "NOID"          : locale.LOGIN_FAILURE_NOT_EXIST_ID,
  170.                         "WRONGPWD"      : locale.LOGIN_FAILURE_WRONG_PASSWORD,
  171.                         "FULL"          : locale.LOGIN_FAILURE_TOO_MANY_USER,
  172.                         "SHUTDOWN"      : locale.LOGIN_FAILURE_SHUTDOWN,
  173.                         "REPAIR"        : locale.LOGIN_FAILURE_REPAIR_ID,
  174.                         "BLOCK"         : locale.LOGIN_FAILURE_BLOCK_ID,
  175.                         "WRONGMAT"      : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER,
  176.                         "QUIT"          : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE,
  177.                         "BESAMEKEY"     : locale.LOGIN_FAILURE_BE_SAME_KEY,
  178.                         "NOTAVAIL"      : locale.LOGIN_FAILURE_NOT_AVAIL,
  179.                         "NOBILL"        : locale.LOGIN_FAILURE_NOBILL,
  180.                         "BLKLOGIN"      : locale.LOGIN_FAILURE_BLOCK_LOGIN,
  181.                         "WEBBLK"        : locale.LOGIN_FAILURE_WEB_BLOCK,
  182.                 }
  183.  
  184.                 self.loginFailureFuncDict = {
  185.                         "WRONGPWD"      : self.__DisconnectAndInputPassword,
  186.                         "WRONGMAT"      : self.__DisconnectAndInputMatrix,
  187.                         "QUIT"          : app.Exit,
  188.                 }
  189.  
  190.                 self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  191.                 self.SetWindowName("LoginWindow")
  192.  
  193.                 if not self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py"):
  194.                         dbg.TraceError("LoginWindow.Open - __LoadScript Error")
  195.                         return
  196.  
  197.                 self.__LoadLoginInfo("loginInfo.py")
  198.  
  199.                 if app.loggined:
  200.                         self.loginFailureFuncDict = {
  201.                         "WRONGPWD"      : app.Exit,
  202.                         "WRONGMAT"      : app.Exit,
  203.                         "QUIT"          : app.Exit,
  204.                         }
  205.  
  206.                 if musicInfo.loginMusic != "":
  207.                         snd.SetMusicVolume(systemSetting.GetMusicVolume())
  208.                         snd.FadeInMusic("BGM/"+musicInfo.loginMusic)
  209.  
  210.                 snd.SetSoundVolume(systemSetting.GetSoundVolume())
  211.  
  212.                 # pevent key "[" "]"
  213.                 ime.AddExceptKey(91)
  214.                 ime.AddExceptKey(93)
  215.  
  216.                 self.Show()
  217.  
  218.                 global SKIP_LOGIN_PHASE
  219.                 if SKIP_LOGIN_PHASE:
  220.                         if self.isStartError:
  221.                                 self.connectBoard.Hide()
  222.                                 self.loginBoard.Hide()
  223.                                 self.PopupNotifyMessage(locale.LOGIN_CONNECT_FAILURE, self.__ExitGame)
  224.                                 return
  225.  
  226.                 else:
  227.                         connectingIP = self.stream.GetConnectAddr()
  228.                         if connectingIP:
  229.                                 self.__OpenLoginBoard()
  230.                                 if IsFullBackImage():
  231.                                         self.GetChild("bg1").Hide()
  232.                                         self.GetChild("bg2").Show()
  233.  
  234.                 app.ShowCursor()
  235.  
  236.                 self.stream.SetConnectInfo("31.133.1.58", 13000, "31.133.1.58", 11002)
  237.                 net.SetServerInfo("AvatarMT2 - Ch1")
  238.                 net.SetMarkServer("31.133.1.58", 13000)
  239.                 self.logo_ch1.Show()
  240.                
  241.         def Close(self):
  242.  
  243.                 if self.connectingDialog:
  244.                         self.connectingDialog.Close()
  245.                 self.connectingDialog = None
  246.  
  247.                 ServerStateChecker.Destroy(self)
  248.  
  249.                 print "---------------------------------------------------------------------------- CLOSE LOGIN WINDOW "
  250.                 #
  251.                 # selectMusic?? ???˘¬˘¬e BGM?? ˘­ˇŔˇľa?Cˇ¤I ĄěIˇĆ©© ˘Ą? ???¨ĎC?˘Ą?.
  252.                 #
  253.                 if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
  254.                         snd.FadeOutMusic("BGM/"+musicInfo.loginMusic)
  255.  
  256.                 ## NOTE : idEditLine?I pwdEditLine?? ?????˘çˇĆ˘§ ?ˇ©ˇ¤I ?ˇţˇĆa ĄěC?i?O?i?ˇ©
  257.                 ##        Event˘¬| ˇĆˇ©A|ˇ¤I ??ˇľa?ˇ© C?AO?i?©¬˘¬˘¬ C?˘Ą?˘Ą? - [levites]
  258.                 self.idEditLine.SetTabEvent(0)
  259.                 self.idEditLine.SetReturnEvent(0)
  260.                 self.pwdEditLine.SetReturnEvent(0)
  261.                 self.pwdEditLine.SetTabEvent(0)
  262.  
  263.                 self.connectBoard = None
  264.                 self.loginBoard = None
  265.                 self.idEditLine = None
  266.                 self.pwdEditLine = None
  267.                 self.inputDialog = None
  268.                 self.connectingDialog = None
  269.                 self.loadingImage = None
  270.  
  271.                 # RUNUP_MATRIX_AUTH
  272.                 self.matrixQuizBoard    = None
  273.                 self.matrixAnswerInput  = None
  274.                 self.matrixAnswerOK     = None
  275.                 self.matrixAnswerCancel = None
  276.                 # RUNUP_MATRIX_AUTH_END
  277.  
  278.                 # NEWCIBN_PASSPOD_AUTH
  279.                 self.passpodBoard       = None
  280.                 self.passpodAnswerInput = None
  281.                 self.passpodAnswerOK    = None
  282.                 self.passpodAnswerCancel = None
  283.                 # NEWCIBN_PASSPOD_AUTH_END
  284.  
  285.  
  286.                 self.KillFocus()
  287.                 self.Hide()
  288.  
  289.                 self.stream.popupWindow.Close()
  290.                 self.loginFailureFuncDict=None
  291.  
  292.                 ime.ClearExceptKey()
  293.  
  294.                 app.HideCursor()
  295.  
  296.         def __SaveChannelInfo(self):
  297.                 try:
  298.                         file=open("channel.inf", "w")
  299.                         file.write("%d %d %d" % (self.__GetServerID(), self.__GetChannelID(), self.__GetRegionID()))
  300.                 except:
  301.                         print "LoginWindow.__SaveChannelInfo - SaveError"
  302.  
  303.         def __LoadChannelInfo(self):
  304.                 try:
  305.                         file=open("channel.inf")
  306.                         lines=file.readlines()
  307.  
  308.                         if len(lines)>0:
  309.                                 tokens=lines[0].split()
  310.  
  311.                                 selServerID=int(tokens[0])
  312.                                 selChannelID=int(tokens[1])
  313.  
  314.                                 if len(tokens) == 3:
  315.                                         regionID = int(tokens[2])
  316.  
  317.                                 return regionID, selServerID, selChannelID
  318.  
  319.                 except:
  320.                         print "LoginWindow.__LoadChannelInfo - OpenError"
  321.                         return -1, -1, -1
  322.  
  323.         def __ExitGame(self):
  324.                 app.Exit()
  325.  
  326.         def SetIDEditLineFocus(self):
  327.                 if self.idEditLine != None:
  328.                         self.idEditLine.SetFocus()
  329.  
  330.         def SetPasswordEditLineFocus(self):
  331.                 if locale.IsEUROPE():
  332.                         if self.idEditLine != None: #0000862: [M2EU] ˇ¤Iˇľˇż?I?˘¨ ?E?ˇŔ ?˘§ˇ¤?: A?ˇ¤a˘©? ˘¬??u None ?©©A˘´Ąě?
  333.                                 self.idEditLine.SetText("")
  334.                                 self.idEditLine.SetFocus() #0000685: [M2EU] ????Ąě©˘/???©˘???¨© ???©¬ ˇĆ˘§˘ĄE ?oˇľˇż ?oA˘´: ?ˇěA˘ŇˇĆC ????Ąě©˘ˇ¤I ?ˇŔA?˘©?ˇĆ˘§ ˇĆ˘§ˇĆO ˘¬˘¬Ąěc˘Ą?
  335.  
  336.                         if self.pwdEditLine != None: #0000862: [M2EU] ˇ¤Iˇľˇż?I?˘¨ ?E?ˇŔ ?˘§ˇ¤?: A?ˇ¤a˘©? ˘¬??u None ?©©A˘´Ąě?
  337.                                 self.pwdEditLine.SetText("")
  338.                 else:
  339.                         if self.pwdEditLine != None:
  340.                                 self.pwdEditLine.SetFocus()
  341.  
  342.         def OnEndCountDown(self):
  343.                 self.isNowCountDown = FALSE
  344.                 self.OnConnectFailure()
  345.  
  346.         def OnConnectFailure(self):
  347.  
  348.                 if self.isNowCountDown:
  349.                         return
  350.  
  351.                 snd.PlaySound("sound/ui/loginfail.wav")
  352.  
  353.                 if self.connectingDialog:
  354.                         self.connectingDialog.Close()
  355.                 self.connectingDialog = None
  356.  
  357.                 if app.loggined:
  358.                         self.PopupNotifyMessage(locale.LOGIN_CONNECT_FAILURE, self.__ExitGame)
  359.                 else:
  360.                         self.PopupNotifyMessage(locale.LOGIN_CONNECT_FAILURE, self.SetPasswordEditLineFocus)
  361.  
  362.         def OnHandShake(self):
  363.                 if not IsLoginDelay():
  364.                         snd.PlaySound("sound/ui/loginok.wav")
  365.                         self.PopupDisplayMessage(locale.LOGIN_CONNECT_SUCCESS)
  366.  
  367.         def OnLoginStart(self):
  368.                 if not IsLoginDelay():
  369.                         self.PopupDisplayMessage(locale.LOGIN_PROCESSING)
  370.  
  371.         def OnLoginFailure(self, error):
  372.                 if self.connectingDialog:
  373.                         self.connectingDialog.Close()
  374.                 self.connectingDialog = None
  375.  
  376.                 try:
  377.                         loginFailureMsg = self.loginFailureMsgDict[error]
  378.                 except KeyError:
  379.                         if PASSPOD_MSG_DICT:
  380.                                 try:
  381.                                         loginFailureMsg = PASSPOD_MSG_DICT[error]
  382.                                 except KeyError:
  383.                                         loginFailureMsg = locale.LOGIN_FAILURE_UNKNOWN + error
  384.                         else:
  385.                                 loginFailureMsg = locale.LOGIN_FAILURE_UNKNOWN  + error
  386.  
  387.  
  388.                 #0000685: [M2EU] ????Ąě©˘/???©˘???¨© ???©¬ ˇĆ˘§˘ĄE ?oˇľˇż ?oA˘´: ?ˇěA˘ŇˇĆC ?©˘˘©??oĄě?ˇ¤I ?ˇŔA?˘©?ˇĆ˘§ ˇĆ˘§ˇĆO ˘¬˘¬Ąěc˘Ą?
  389.                 loginFailureFunc=self.loginFailureFuncDict.get(error, self.SetPasswordEditLineFocus)
  390.  
  391.                 if app.loggined:
  392.                         self.PopupNotifyMessage(loginFailureMsg, self.__ExitGame)
  393.                 else:
  394.                         self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc)
  395.  
  396.                 snd.PlaySound("sound/ui/loginfail.wav")
  397.  
  398.         def __DisconnectAndInputID(self):
  399.                 if self.connectingDialog:
  400.                         self.connectingDialog.Close()
  401.                 self.connectingDialog = None
  402.  
  403.                 self.SetIDEditLineFocus()
  404.                 net.Disconnect()
  405.  
  406.         def __DisconnectAndInputPassword(self):
  407.                 if self.connectingDialog:
  408.                         self.connectingDialog.Close()
  409.                 self.connectingDialog = None
  410.  
  411.                 self.SetPasswordEditLineFocus()
  412.                 net.Disconnect()
  413.  
  414.         def __DisconnectAndInputMatrix(self):
  415.                 if self.connectingDialog:
  416.                         self.connectingDialog.Close()
  417.                 self.connectingDialog = None
  418.  
  419.                 self.stream.popupWindow.Close()
  420.                 self.matrixInputChanceCount -= 1
  421.  
  422.                 if self.matrixInputChanceCount <= 0:
  423.                         self.__OnCloseInputDialog()
  424.  
  425.                 elif self.inputDialog:
  426.                         self.inputDialog.Show()
  427.  
  428.         def __LoadScript(self, fileName):
  429.                 try:
  430.                         pyScrLoader = ui.PythonScriptLoader()
  431.                         pyScrLoader.LoadScriptFile(self, fileName)
  432.                 except:
  433.                         import exception
  434.                         exception.Abort("LoginWindow.__LoadScript.LoadObject")
  435.  
  436.                 try:
  437.                         GetObject=self.GetChild
  438.                         self.connectBoard                       = GetObject("ConnectBoard")
  439.                         self.loginBoard                         = GetObject("LoginBoard")
  440.                         self.ch_buttons                         = GetObject("ch_buttons")
  441.                         self.ch1_button                         = GetObject("ch1_button")
  442.                         self.ch2_button                         = GetObject("ch2_button")
  443.                         self.ch3_button                         = GetObject("ch3_button")
  444.                         self.ch4_button                         = GetObject("ch4_button")
  445.                         self.x2_buttony                         = GetObject("2_buttony")
  446.                         self.logo_ch1                           = GetObject("logo_ch1")
  447.                         self.logo_ch2                           = GetObject("logo_ch2")
  448.                         self.logo_ch3                           = GetObject("logo_ch3")
  449.                         self.logo_ch4                           = GetObject("logo_ch4")
  450.                         self.idEditLine                         = GetObject("ID_EditLine")
  451.                         self.pwdEditLine                        = GetObject("Password_EditLine")
  452.                         self.selectConnectButton        = GetObject("SelectConnectButton")
  453.                         self.konta_button                       = GetObject("konta_button")                    
  454.                         self.loginButton                        = GetObject("LoginButton")
  455.                         self.loginExitButton            = GetObject("LoginExitButton")
  456.                         self.czcziona_button            = GetObject("czcziona_button")                 
  457.  
  458.                         self.acc1loginButton    = GetObject("Acc1Login")
  459.                         self.acc2loginButton    = GetObject("Acc2Login")
  460.                         self.acc3loginButton    = GetObject("Acc3Login")
  461.                         self.acc4loginButton    = GetObject("Acc4Login")
  462.  
  463.                         self.LoginSaveButton    = GetObject("LoginSaveButton")
  464.  
  465.                         self.ACC1_LABEL                 = GetObject("ACC1_LABEL")
  466.                         self.ACC2_LABEL                 = GetObject("ACC2_LABEL")
  467.                         self.ACC3_LABEL                 = GetObject("ACC3_LABEL")
  468.                         self.ACC4_LABEL                 = GetObject("ACC4_LABEL")
  469.  
  470.                         self.ACC1__LABEL                = GetObject("ACC1__LABEL")
  471.                         self.ACC2__LABEL                = GetObject("ACC2__LABEL")
  472.                         self.ACC3__LABEL                = GetObject("ACC3__LABEL")
  473.                         self.ACC4__LABEL                = GetObject("ACC4__LABEL")
  474.  
  475.                         self.Acc1Del                    = GetObject("Acc1Del")
  476.                         self.Acc2Del                    = GetObject("Acc2Del")
  477.                         self.Acc3Del                    = GetObject("Acc3Del")
  478.                         self.Acc4Del                    = GetObject("Acc4Del")
  479.  
  480.                         if locale.IsVIETNAM():
  481.                                 self.checkButton = GetObject("CheckButton")
  482.                                 self.checkButton.Down()
  483.  
  484.                         # RUNUP_MATRIX_AUTH
  485.                         if IsRunupMatrixAuth():
  486.                                 self.matrixQuizBoard    = GetObject("RunupMatrixQuizBoard")
  487.                                 self.matrixAnswerInput  = GetObject("RunupMatrixAnswerInput")
  488.                                 self.matrixAnswerOK             = GetObject("RunupMatrixAnswerOK")
  489.                                 self.matrixAnswerCancel = GetObject("RunupMatrixAnswerCancel")
  490.                         # RUNUP_MATRIX_AUTH_END
  491.  
  492.                         # NEWCIBN_PASSPOD_AUTH
  493.                         if IsNEWCIBNPassPodAuth():
  494.                                 self.passpodBoard               = GetObject("NEWCIBN_PASSPOD_BOARD")
  495.                                 self.passpodAnswerInput = GetObject("NEWCIBN_PASSPOD_INPUT")
  496.                                 self.passpodAnswerOK    = GetObject("NEWCIBN_PASSPOD_OK")
  497.                                 self.passpodAnswerCancel= GetObject("NEWCIBN_PASSPOD_CANCEL")
  498.                         # NEWCIBN_PASSPOD_AUTH_END
  499.  
  500.                         self.AccountBoard               = self.GetChild2("AccountBoard")
  501.  
  502.  
  503.                 except:
  504.                         import exception
  505.                         exception.Abort("LoginWindow.__LoadScript.BindObject")
  506.  
  507.  
  508.                 self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
  509.                 self.loginExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
  510.                
  511.                 self.ch1_button.SetEvent(ui.__mem_func__(self.OnClickCH_1Button))
  512.                 self.ch2_button.SetEvent(ui.__mem_func__(self.OnClickCH_2Button))
  513.                 self.ch3_button.SetEvent(ui.__mem_func__(self.OnClickCH_3Button))
  514.                 self.ch4_button.SetEvent(ui.__mem_func__(self.OnClickCH_4Button))
  515.                 self.konta_button.SetEvent(ui.__mem_func__(self.OnClickkonta_button))
  516.                 self.czcziona_button.SetEvent(ui.__mem_func__(self.OnClickCzcziona_button))
  517.  
  518.                 self.selectConnectButton.SetEvent(ui.__mem_func__(self.OnClickConnectButton))                  
  519.                
  520.  
  521.                 self.acc1loginButton.SetEvent(ui.__mem_func__(self.__OnClickACC1LoginButton))
  522.                 self.acc2loginButton.SetEvent(ui.__mem_func__(self.__OnClickACC2LoginButton))
  523.                 self.acc3loginButton.SetEvent(ui.__mem_func__(self.__OnClickACC3LoginButton))
  524.                 self.acc4loginButton.SetEvent(ui.__mem_func__(self.__OnClickACC4LoginButton))
  525.  
  526.                 self.LoginSaveButton.SetEvent(ui.__mem_func__(self.__OnClickLoginSaveButton))
  527.  
  528.                 self.Acc1Del.SetEvent(ui.__mem_func__(self.__OnClickAcc1DelButton))
  529.                 self.Acc2Del.SetEvent(ui.__mem_func__(self.__OnClickAcc2DelButton))
  530.                 self.Acc3Del.SetEvent(ui.__mem_func__(self.__OnClickAcc3DelButton))
  531.                 self.Acc4Del.SetEvent(ui.__mem_func__(self.__OnClickAcc4DelButton))
  532.  
  533.  
  534.                 self.idEditLine.SetReturnEvent(ui.__mem_func__(self.pwdEditLine.SetFocus))
  535.                 self.idEditLine.SetTabEvent(ui.__mem_func__(self.pwdEditLine.SetFocus))
  536.  
  537.                 self.pwdEditLine.SetReturnEvent(ui.__mem_func__(self.__OnClickLoginButton))
  538.                 self.pwdEditLine.SetTabEvent(ui.__mem_func__(self.idEditLine.SetFocus))
  539.  
  540.                 # RUNUP_MATRIX_AUTH
  541.                 if IsRunupMatrixAuth():
  542.                         self.matrixAnswerOK.SAFE_SetEvent(self.__OnClickMatrixAnswerOK)
  543.                         self.matrixAnswerCancel.SAFE_SetEvent(self.__OnClickMatrixAnswerCancel)
  544.                         self.matrixAnswerInput.SAFE_SetReturnEvent(self.__OnClickMatrixAnswerOK)
  545.                 # RUNUP_MATRIX_AUTH_END
  546.  
  547.                 # NEWCIBN_PASSPOD_AUTH
  548.                 if IsNEWCIBNPassPodAuth():
  549.                         self.passpodAnswerOK.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
  550.                         self.passpodAnswerCancel.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerCancel)
  551.                         self.passpodAnswerInput.SAFE_SetReturnEvent(self.__OnClickNEWCIBNPasspodAnswerOK)
  552.  
  553.                 # NEWCIBN_PASSPOD_AUTH_END
  554.  
  555.                 self.__LoadACCNames()
  556.                 self.ch_buttons.Hide()
  557.                 self.AccountBoard.Hide()
  558.                 self.isOpen_2 = 0
  559.                 self.logo_ch1.Hide()
  560.                 self.logo_ch2.Hide()
  561.                 self.logo_ch3.Hide()
  562.                 self.logo_ch4.Hide()
  563.  
  564.                 if IsFullBackImage():
  565.                         self.GetChild("bg1").Show()
  566.                 return 1
  567.                                
  568.                
  569.         def OnClickCzcziona_button(self):
  570.                 f = open('pack/font.cfg', 'r+')
  571.                 linijka = f.readline()
  572.                 if      linijka == "Georgia:13|Georgia:13|Georgia:11":
  573.                         f.seek(0)
  574.                         f.truncate()
  575.                         f.write("Tahoma:12|Tahoma:14|Tahoma:9")
  576.                         self.PopupNotifyMessage("Zmieniono na czcionkꡔahoma, zrestartuj klienta, aby zatwierdzi桺miany.")   
  577.                 else:
  578.                         f.seek(0)
  579.                         f.truncate()
  580.                         f.write("Georgia:13|Georgia:13|Georgia:11")
  581.                         self.PopupNotifyMessage("Zmieniono na czcionkꡇeorgia, zrestartuj klienta, aby zatwierdzi桺miany.")                          
  582.                 f.close()      
  583.  
  584.         def OnClickConnectButton(self):
  585.                 self.ch_buttons.Show()
  586.                 self.x2_buttony.Hide()
  587.                
  588.         def OnClickkonta_button(self):
  589.                 if self.isOpen_2 == 0:
  590.                         self.AccountBoard.Show()
  591.                         self.isOpen_2 = 1
  592.                 else:
  593.                         self.AccountBoard.Hide()
  594.                         self.isOpen_2 = 0      
  595.                
  596.         def __LoadACCInfos(self, accid):
  597.                 import linecache
  598.                 login = linecache.getline("lib/account" + str(accid) + ".cfg", 1)
  599.                 password = linecache.getline("lib/account" + str(accid) + ".cfg", 2)
  600.                 login = login.replace('\n', '')
  601.                 self.Connect(login, password)
  602.  
  603.         def __OnClickACC1LoginButton(self):
  604.                 self.__LoadACCInfos(1)
  605.  
  606.         def __OnClickACC2LoginButton(self):
  607.                 self.__LoadACCInfos(2)
  608.  
  609.         def __OnClickACC3LoginButton(self):
  610.                 self.__LoadACCInfos(3)
  611.  
  612.         def __OnClickACC4LoginButton(self):
  613.                 self.__LoadACCInfos(4)
  614.  
  615.         def __OnClickLoginSaveButton(self):
  616.                 id = self.idEditLine.GetText()
  617.                 pwd = self.pwdEditLine.GetText()
  618.  
  619.                 fd = open( "lib/account1.cfg" )
  620.                 login1 = fd.readline()
  621.                 login1.replace( "\n", "" )
  622.                 fd.close()
  623.  
  624.                 fd = open( "lib/account2.cfg" )
  625.                 login2 = fd.readline()
  626.                 login2.replace( "\n", "" )
  627.                 fd.close()
  628.  
  629.                 fd = open( "lib/account3.cfg" )
  630.                 login3 = fd.readline()
  631.                 login3.replace( "\n", "" )
  632.                 fd.close()
  633.  
  634.                 fd = open( "lib/account4.cfg" )
  635.                 login4 = fd.readline()
  636.                 login4.replace( "\n", "" )
  637.                 fd.close()
  638.  
  639.                 if login1 == "":
  640.                         slot = 1
  641.                 elif login2 == "":
  642.                         slot = 2
  643.                 elif login3 == "":
  644.                         slot = 3
  645.                 elif login4 == "":
  646.                         slot = 4
  647.                 else:
  648.                         self.PopupNotifyMessage("Nie ma wolnego miejsca na zapisanie!")
  649.                         return
  650.  
  651.  
  652.                 f = open("lib/account" + str(slot) + ".cfg", "w")
  653.                 f.write (id +"\n")
  654.                 f.write (pwd)
  655.                 f.close()
  656.  
  657.                 self.PopupNotifyMessage("Twoje dane zostaԹ zapisane!")
  658.                 self.__LoadACCNames()
  659.  
  660.         def __OnClickAcc1DelButton(self):
  661.                 f = open("lib/account1.cfg", "w")
  662.                 f.write ("")
  663.                 f.close()
  664.                 self.ACC1__LABEL.SetText("1. Puste")
  665.                 self.ACC1_LABEL.SetText("1. Puste")
  666.                 self.__LoadACCNames()
  667.  
  668.         def __OnClickAcc2DelButton(self):
  669.                 f = open("lib/account2.cfg", "w")
  670.                 f.write ("")
  671.                 f.close()
  672.                 self.ACC2__LABEL.SetText("2. Puste")
  673.                 self.ACC2_LABEL.SetText("2. Puste")
  674.                 self.__LoadACCNames()
  675.         def __OnClickAcc3DelButton(self):
  676.                 f = open("lib/account3.cfg", "w")
  677.                 f.write ("")
  678.                 f.close()
  679.                 self.ACC3__LABEL.SetText("3. Puste")
  680.                 self.ACC3_LABEL.SetText("3. Puste")
  681.                 self.__LoadACCNames()
  682.         def __OnClickAcc4DelButton(self):
  683.                 f = open("lib/account4.cfg", "w")
  684.                 f.write ("")
  685.                 f.close()
  686.                 self.ACC4__LABEL.SetText("4. Puste")
  687.                 self.ACC4_LABEL.SetText("4. Puste")
  688.                 self.__LoadACCNames()
  689.  
  690.         def __LoadACCNames(self):
  691.                 fd = open( "lib/account1.cfg" )
  692.                 login1 = fd.readline()
  693.                 login1.replace( "\n", "" )
  694.                 fd.close()
  695.  
  696.                 fd = open( "lib/account2.cfg" )
  697.                 login2 = fd.readline()
  698.                 login2.replace( "\n", "" )
  699.                 fd.close()
  700.  
  701.                 fd = open( "lib/account3.cfg" )
  702.                 login3 = fd.readline()
  703.                 login3.replace( "\n", "" )
  704.                 fd.close()
  705.  
  706.                 fd = open( "lib/account4.cfg" )
  707.                 login4 = fd.readline()
  708.                 login4.replace( "\n", "" )
  709.                 fd.close()
  710.  
  711.                 if login1 != "":
  712.                         self.ACC1__LABEL.SetText("1. "+login1)
  713.                         self.ACC1_LABEL.SetText("1. "+login1)
  714.                 if login2 != "":
  715.                         self.ACC2__LABEL.SetText("2. "+login2)
  716.                         self.ACC2_LABEL.SetText("2. "+login2)
  717.                 if login3 != "":
  718.                         self.ACC3__LABEL.SetText("3. "+login3)
  719.                         self.ACC3_LABEL.SetText("3. "+login3)
  720.                 if login4 != "":
  721.                         self.ACC4__LABEL.SetText("4. "+login4)
  722.                         self.ACC4_LABEL.SetText("4. "+login4)
  723.  
  724.  
  725.         def Connect(self, id, pwd):
  726.  
  727.                 if constInfo.SEQUENCE_PACKET_ENABLE:
  728.                         net.SetPacketSequenceMode()
  729.  
  730.                 if IsLoginDelay():
  731.                         loginDelay = GetLoginDelay()
  732.                         self.connectingDialog = ConnectingDialog()
  733.                         self.connectingDialog.Open(loginDelay)
  734.                         self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)
  735.                         self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey)
  736.                         self.isNowCountDown = TRUE
  737.  
  738.                 else:
  739.                         self.stream.popupWindow.Close()
  740.                         self.stream.popupWindow.Open(locale.LOGIN_CONNETING, self.SetPasswordEditLineFocus, locale.UI_CANCEL)
  741.  
  742.                 self.stream.SetLoginInfo(id, pwd)
  743.                 self.stream.Connect()
  744.  
  745.         def __OnClickExitButton(self):
  746.                 self.stream.SetPhaseWindow(0)
  747.  
  748.  
  749.         def __LoadLoginInfo(self, loginInfoFileName):
  750.  
  751.                 try:
  752.                         loginInfo={}
  753.                         execfile(loginInfoFileName, loginInfo)
  754.                 except IOError:
  755.                         print(\
  756.                                 "?UĄě? ˇ¤Iˇľˇż?I?ˇí C?˘©?ˇ¤A˘¬e" + loginInfoFileName + "?A???ˇí ????C?AO???a\n"\
  757.                                 "\n"\
  758.                                 "©©ˇí?e:\n"\
  759.                                 "================================================================\n"\
  760.                                 "addr=AO??\n"\
  761.                                 "port=?ˇŔ?˘ç\n"\
  762.                                 "id=????Ąě©˘\n"\
  763.                                 "pwd=???©˘???¨©\n"\
  764.                                 "slot=A©©˘¬??I ?ˇľ?? ?IĄě|˘©? (??ˇĆ?©©? -1??˘¬e ?UĄě? ?ˇľ?? ??CO)\n"\
  765.                                 "autoLogin=?UĄě? A˘¨?O ?¨Ď?I\n"
  766.                                 "autoSelect=?UĄě? A˘¨?O ?¨Ď?I\n"
  767.                                 "locale=(ymir) LC_Ymir ??ˇĆ??? ymirˇ¤I ??Ąě?. AoA˘´C?Ao ???˘¬˘¬e koreaˇ¤I ??Ąě?\n"
  768.                         );
  769.  
  770.                 id=loginInfo.get("id", "")
  771.                 pwd=loginInfo.get("pwd", "")
  772.  
  773.  
  774.                 addr=loginInfo.get("addr", "")
  775.                 port=loginInfo.get("port", 0)
  776.                 account_addr=loginInfo.get("account_addr", addr)
  777.                 account_port=loginInfo.get("account_port", port)
  778.  
  779.                 locale = loginInfo.get("locale", "")
  780.  
  781.                 if addr and port:
  782.                         net.SetMarkServer(addr, port)
  783.  
  784.                         if locale == "ymir" :
  785.                                 net.SetServerInfo("?Ąě˘¬˘Ň ?ˇ©?o")
  786.                         else:
  787.                                 net.SetServerInfo(addr+":"+str(port))
  788.  
  789.                 slot=loginInfo.get("slot", 0)
  790.                 isAutoLogin=loginInfo.get("auto", 0)
  791.                 isAutoLogin=loginInfo.get("autoLogin", 0)
  792.                 isAutoSelect=loginInfo.get("autoSelect", 0)
  793.  
  794.                 self.stream.SetCharacterSlot(slot)
  795.                 self.stream.SetConnectInfo(addr, port, account_addr, account_port)
  796.                 self.stream.isAutoLogin=isAutoLogin
  797.                 self.stream.isAutoSelect=isAutoSelect
  798.  
  799.                 self.id = None
  800.                 self.pwd = None
  801.                 self.loginnedServer = None
  802.                 self.loginnedChannel = None
  803.                 app.loggined = FALSE
  804.  
  805.                 self.loginInfo = loginInfo
  806.  
  807.                 if self.id and self.pwd:
  808.                         app.loggined = TRUE
  809.  
  810.                 if isAutoLogin:
  811.                         self.Connect(id, pwd)
  812.  
  813.                         print "=================================================================================="
  814.                         print "?UĄě? ˇ¤Iˇľˇż?I: %s - %s:%d %s" % (loginInfoFileName, addr, port, id)
  815.                         print "=================================================================================="
  816.  
  817.  
  818.         def PopupDisplayMessage(self, msg):
  819.                 self.stream.popupWindow.Close()
  820.                 self.stream.popupWindow.Open(msg)
  821.  
  822.         def PopupNotifyMessage(self, msg, func=0):
  823.                 if not func:
  824.                         func=self.EmptyFunc
  825.  
  826.                 self.stream.popupWindow.Close()
  827.                 self.stream.popupWindow.Open(msg, func, locale.UI_OK)
  828.  
  829.         # RUNUP_MATRIX_AUTH
  830.         def BINARY_OnRunupMatrixQuiz(self, quiz):
  831.                 if not IsRunupMatrixAuth():
  832.                         return
  833.  
  834.                 id              = self.GetChild("RunupMatrixID")
  835.                 id.SetText(self.idEditLine.GetText())
  836.  
  837.                 code    = self.GetChild("RunupMatrixCode")
  838.  
  839.                 code.SetText("".join(["[%c,%c]" % (quiz[i], quiz[i+1]) for i in xrange(0, len(quiz), 2)]))
  840.  
  841.                 self.stream.popupWindow.Close()
  842.                 self.connectBoard.Hide()
  843.                 self.loginBoard.Hide()
  844.                 self.matrixQuizBoard.Show()
  845.                 self.matrixAnswerInput.SetFocus()
  846.  
  847.         def __OnClickMatrixAnswerOK(self):
  848.                 answer = self.matrixAnswerInput.GetText()
  849.  
  850.                 print "matrix_quiz.ok"
  851.                 net.SendRunupMatrixCardPacket(answer)
  852.                 self.matrixQuizBoard.Hide()
  853.  
  854.                 self.stream.popupWindow.Close()
  855.                 self.stream.popupWindow.Open("WAITING FOR MATRIX AUTHENTICATION",
  856.                         self.__OnClickMatrixAnswerCancel,
  857.                         locale.UI_CANCEL)
  858.  
  859.         def __OnClickMatrixAnswerCancel(self):
  860.                 print "matrix_quiz.cancel"
  861.  
  862.                 if self.matrixQuizBoard:
  863.                         self.matrixQuizBoard.Hide()
  864.  
  865.                 if self.connectBoard:
  866.                         self.connectBoard.Show()
  867.  
  868.                 if self.loginBoard:
  869.                         self.loginBoard.Show()
  870.  
  871.         # RUNUP_MATRIX_AUTH_END
  872.  
  873.         # NEWCIBN_PASSPOD_AUTH
  874.         def BINARY_OnNEWCIBNPasspodRequest(self):
  875.                 if not IsNEWCIBNPassPodAuth():
  876.                         return
  877.  
  878.                 if self.connectingDialog:
  879.                         self.connectingDialog.Close()
  880.                 self.connectingDialog = None
  881.  
  882.                 self.stream.popupWindow.Close()
  883.                 self.connectBoard.Hide()
  884.                 self.loginBoard.Hide()
  885.                 self.passpodBoard.Show()
  886.                 self.passpodAnswerInput.SetFocus()
  887.  
  888.         def BINARY_OnNEWCIBNPasspodFailure(self):
  889.                 if not IsNEWCIBNPassPodAuth():
  890.                         return
  891.  
  892.         def __OnClickNEWCIBNPasspodAnswerOK(self):
  893.                 answer = self.passpodAnswerInput.GetText()
  894.  
  895.                 print "passpod.ok"
  896.                 net.SendNEWCIBNPasspodAnswerPacket(answer)
  897.                 self.passpodAnswerInput.SetText("")
  898.                 self.passpodBoard.Hide()
  899.  
  900.                 self.stream.popupWindow.Close()
  901.                 self.stream.popupWindow.Open(locale.WAIT_FOR_PASSPOD,
  902.                         self.__OnClickNEWCIBNPasspodAnswerCancel,
  903.                         locale.UI_CANCEL)
  904.  
  905.         def __OnClickNEWCIBNPasspodAnswerCancel(self):
  906.                 print "passpod.cancel"
  907.  
  908.                 if self.passpodBoard:
  909.                         self.passpodBoard.Hide()
  910.  
  911.                 if self.connectBoard:
  912.                         self.connectBoard.Show()
  913.  
  914.                 if self.loginBoard:
  915.                         self.loginBoard.Show()
  916.  
  917.         # NEWCIBN_PASSPOD_AUTH_END
  918.  
  919.  
  920.         def OnMatrixCard(self, row1, row2, row3, row4, col1, col2, col3, col4):
  921.  
  922.                 if self.connectingDialog:
  923.                         self.connectingDialog.Close()
  924.                 self.connectingDialog = None
  925.  
  926.                 self.matrixInputChanceCount = 3
  927.  
  928.                 self.stream.popupWindow.Close()
  929.  
  930.                 # CHINA_MATRIX_CARD_BUG_FIX
  931.                 ## A~Z ˇľiAo 26 ??©©ˇí?C ˇĆ??? Ąěe?i?O?i?©¬˘¬˘¬ C?˘Ą?.
  932.                 ## Python Exception Log ?˘§?ˇ© ˇľˇż ??ˇío?C ˇĆ??? Ąěe?i?O?i?ˇ© ?˘§ˇ¤? ??Ao
  933.                 ## C?Ąě? ?O C?ˇľ?A? ˇ¤Iˇľˇż?˘§?ˇ© ??ˇĆO ?ˇĆ?eĄěC˘ĄAAo˘ĄA ˘¬©˘˘¬¨©ˇĆU?˘©
  934.                 row1 = min(30, row1)
  935.                 row2 = min(30, row2)
  936.                 row3 = min(30, row3)
  937.                 row4 = min(30, row4)
  938.                 # END_OF_CHINA_MATRIX_CARD_BUG_FIX
  939.  
  940.                 row1 = chr(row1 + ord('A'))
  941.                 row2 = chr(row2 + ord('A'))
  942.                 row3 = chr(row3 + ord('A'))
  943.                 row4 = chr(row4 + ord('A'))
  944.                 col1 = col1 + 1
  945.                 col2 = col2 + 1
  946.                 col3 = col3 + 1
  947.                 col4 = col4 + 1
  948.  
  949.                 inputDialog = uiCommon.InputDialogWithDescription2()
  950.                 inputDialog.SetMaxLength(8)
  951.                 inputDialog.SetAcceptEvent(ui.__mem_func__(self.__OnAcceptMatrixCardData))
  952.                 inputDialog.SetCancelEvent(ui.__mem_func__(self.__OnCancelMatrixCardData))
  953.                 inputDialog.SetTitle(locale.INPUT_MATRIX_CARD_TITLE)
  954.                 inputDialog.SetDescription1(locale.INPUT_MATRIX_CARD_NUMBER)
  955.                 inputDialog.SetDescription2("%c%d %c%d %c%d %c%d" % (row1, col1,
  956.                                                                                                                         row2, col2,
  957.                                                                                                                         row3, col3,
  958.                                                                                                                         row4, col4))
  959.  
  960.                 inputDialog.Open()
  961.                 self.inputDialog = inputDialog
  962.  
  963.         def __OnAcceptMatrixCardData(self):
  964.                 text = self.inputDialog.GetText()
  965.                 net.SendChinaMatrixCardPacket(text)
  966.                 if self.inputDialog:
  967.                         self.inputDialog.Hide()
  968.                 self.PopupNotifyMessage(locale.LOGIN_PROCESSING)
  969.                 return TRUE
  970.  
  971.         def __OnCancelMatrixCardData(self):
  972.                 self.SetPasswordEditLineFocus()
  973.                 self.__OnCloseInputDialog()
  974.                 self.__DisconnectAndInputPassword()
  975.                 return TRUE
  976.  
  977.         def __OnCloseInputDialog(self):
  978.                 if self.inputDialog:
  979.                         self.inputDialog.Close()
  980.                 self.inputDialog = None
  981.                 return TRUE
  982.  
  983.         def OnPressExitKey(self):
  984.                 self.stream.popupWindow.Close()
  985.                 self.stream.SetPhaseWindow(0)
  986.                 return TRUE
  987.  
  988.         def OnExit(self):
  989.                 self.stream.popupWindow.Close()
  990.                 self.stream.popupWindow.Open(locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE, app.Exit, locale.UI_OK)
  991.  
  992.         def OnUpdate(self):
  993.                 ServerStateChecker.Update()
  994.  
  995.         def EmptyFunc(self):
  996.                 pass
  997.  
  998.         #####################################################################################
  999.  
  1000.         def __GetRegionID(self):
  1001.                 return 0
  1002.  
  1003.         # SEVER_LIST_BUG_FIX
  1004.         def __ServerIDToServerIndex(self, regionID, targetServerID):
  1005.                 try:
  1006.                         regionDict = serverInfo.REGION_DICT[regionID]
  1007.                 except KeyError:
  1008.                         return -1
  1009.  
  1010.                 retServerIndex = 0
  1011.                 for eachServerID, regionDataDict in regionDict.items():
  1012.                         if eachServerID == targetServerID:
  1013.                                 return retServerIndex
  1014.  
  1015.                         retServerIndex += 1
  1016.  
  1017.                 return -1
  1018.  
  1019.         def __ChannelIDToChannelIndex(self, channelID):
  1020.                 return channelID - 1
  1021.         # END_OF_SEVER_LIST_BUG_FIX
  1022.  
  1023.  
  1024.         def __OpenLoginBoard(self):
  1025.  
  1026.  
  1027.                 # RUNUP_MATRIX_AUTH
  1028.                 if IsRunupMatrixAuth():
  1029.                         self.matrixQuizBoard.Hide()
  1030.                 # RUNUP_MATRIX_AUTH_END
  1031.  
  1032.                 # NEWCIBN_PASSPOD_AUTH
  1033.                 if IsNEWCIBNPassPodAuth():
  1034.                         self.passpodBoard.Hide()
  1035.                 # NEWCIBN_PASSPOD_AUTH_END
  1036.  
  1037.                 if app.loggined:
  1038.                         self.Connect(self.id, self.pwd)
  1039.                         self.connectBoard.Hide()
  1040.                         self.loginBoard.Hide()
  1041.                 elif not self.stream.isAutoLogin:
  1042.                         self.connectBoard.Show()
  1043.                         self.loginBoard.Show()
  1044.  
  1045.                 ## if users have the login infomation, then don't initialize.2005.9 haho
  1046.                 if self.idEditLine == None:
  1047.                         self.idEditLine.SetText("")
  1048.                 if self.pwdEditLine == None:
  1049.                         self.pwdEditLine.SetText("")
  1050.  
  1051.                 self.idEditLine.SetFocus()
  1052.  
  1053.                 global SKIP_LOGIN_PHASE
  1054.                 if SKIP_LOGIN_PHASE:
  1055.                         if not self.loginInfo:
  1056.                                 self.connectBoard.Hide()
  1057.  
  1058.         def __OnSelectRegionGroup(self):
  1059.                 self.__RefreshServerList()
  1060.  
  1061.  
  1062.         def __RefreshServerList(self):
  1063.                 regionID = self.__GetRegionID()
  1064.  
  1065.                 if not serverInfo.REGION_DICT.has_key(regionID):
  1066.                         return
  1067.  
  1068.                 self.serverList.ClearItem()
  1069.  
  1070.                 regionDict = serverInfo.REGION_DICT[regionID]
  1071.  
  1072.                 # SEVER_LIST_BUG_FIX
  1073.                 visible_index = 1
  1074.                 for id, regionDataDict in regionDict.items():
  1075.                         name = regionDataDict.get("name", "noname")
  1076.                         if locale.IsBRAZIL() or locale.IsCANADA():
  1077.                                 self.serverList.InsertItem(id, "%s" % (name))
  1078.                         else:
  1079.                                 if locale.IsCIBN10():
  1080.                                         if name[0] == "#":
  1081.                                                 self.serverList.InsertItem(-1, "  %s" % (name[1:]))
  1082.                                         else:
  1083.                                                 self.serverList.InsertItem(id, "  %s" % (name))
  1084.                                                 visible_index += 1
  1085.                                 else:
  1086.                                         try:
  1087.                                                 server_id = serverInfo.SERVER_ID_DICT[id]
  1088.                                         except:
  1089.                                                 server_id = visible_index
  1090.  
  1091.                                         self.serverList.InsertItem(id, "  %02d. %s" % (int(server_id), name))
  1092.  
  1093.                                         visible_index += 1
  1094.  
  1095.                 # END_OF_SEVER_LIST_BUG_FIX
  1096.  
  1097.         def __RequestServerStateList(self):
  1098.                 regionID = self.__GetRegionID()
  1099.                 serverID = self.__GetServerID()
  1100.  
  1101.                 try:
  1102.                         channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
  1103.                 except:
  1104.                         print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID)
  1105.                         return
  1106.  
  1107.                 for id, channelDataDict in channelDict.items():
  1108.                         key=channelDataDict["key"]
  1109.                         ip=channelDataDict["ip"]
  1110.                         udp_port=channelDataDict["udp_port"]
  1111.                         ServerStateChecker.Request(key, ip, udp_port)
  1112.  
  1113.  
  1114.         def NotifyChannelState(self, addrKey, state):
  1115.                 try:
  1116.                         stateName=serverInfo.STATE_DICT[state]
  1117.                 except:
  1118.                         stateName=serverInfo.STATE_NONE
  1119.  
  1120.                 regionID=int(addrKey/1000)
  1121.                 serverID=int(addrKey/10) % 100
  1122.                 channelID=addrKey%10
  1123.  
  1124.                 try:
  1125.                         serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["state"] = stateName
  1126.                         self.__RefreshServerStateList()
  1127.  
  1128.                 except:
  1129.                         import exception
  1130.                         exception.Abort(locale.CHANNEL_NOT_FIND_INFO)
  1131.  
  1132.         def __OnClickExitServerButton(self):
  1133.                 print "exit server"
  1134.                 self.__OpenLoginBoard()
  1135.  
  1136.                 if IsFullBackImage():
  1137.                         self.GetChild("bg1").Hide()
  1138.                         self.GetChild("bg2").Show()
  1139.  
  1140.  
  1141.         def __OnClickLoginButton(self):
  1142.                 id = self.idEditLine.GetText()
  1143.                 pwd = self.pwdEditLine.GetText()
  1144.  
  1145.                 if len(id)==0:
  1146.                         self.PopupNotifyMessage(locale.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
  1147.                         return
  1148.  
  1149.                 if len(pwd)==0:
  1150.                         self.PopupNotifyMessage(locale.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
  1151.                         return
  1152.  
  1153.                 self.Connect(id, pwd)
  1154.                
  1155.         def     OnClickCH_1Button(self):
  1156.                 self.stream.SetConnectInfo("31.133.1.58", 13000, "31.133.1.58", 11002)
  1157.                 net.SetServerInfo("Eberrion - Ch1")
  1158.                 net.SetMarkServer("31.133.1.58", 13000)
  1159.                 self.logo_ch1.Show()
  1160.                 self.logo_ch2.Hide()
  1161.                 self.logo_ch3.Hide()
  1162.                 self.logo_ch4.Hide()
  1163.                 self.ch_buttons.Hide()
  1164.                 self.x2_buttony.Show()
  1165.                
  1166.         def OnClickCH_2Button(self):
  1167.                 self.stream.SetConnectInfo("31.133.1.58", 13002, "31.133.1.58", 22333)
  1168.                 net.SetServerInfo("Eberrion - Ch 2")
  1169.                 net.SetMarkServer("31.133.1.58", 13002)
  1170.                 self.logo_ch2.Show()
  1171.                 self.logo_ch1.Hide()
  1172.                 self.logo_ch3.Hide()
  1173.                 self.logo_ch4.Hide()           
  1174.                 self.ch_buttons.Hide()
  1175.                 self.x2_buttony.Show()         
  1176.                
  1177.         def OnClickCH_3Button(self):
  1178.                 self.stream.SetConnectInfo("31.133.1.58", 13003, "31.133.1.58", 22333)
  1179.                 net.SetServerInfo("Eberrion - Ch 3")
  1180.                 net.SetMarkServer("31.133.1.58", 13003)
  1181.                 self.logo_ch3.Show()
  1182.                 self.logo_ch2.Hide()
  1183.                 self.logo_ch1.Hide()
  1184.                 self.logo_ch4.Hide()           
  1185.                 self.ch_buttons.Hide()
  1186.                 self.x2_buttony.Show()         
  1187.                
  1188.         def OnClickCH_4Button(self):
  1189.                 self.stream.SetConnectInfo("31.133.1.58", 13004, "31.133.1.58", 22333)
  1190.                 net.SetServerInfo("Eberrion - Ch 4")
  1191.                 net.SetMarkServer("31.133.1.58", 13004)
  1192.                 self.logo_ch4.Show()
  1193.                 self.logo_ch2.Hide()
  1194.                 self.logo_ch3.Hide()
  1195.                 self.logo_ch1.Hide()           
  1196.                 self.ch_buttons.Hide()         
  1197.                 self.x2_buttony.Show()         
  1198.