import uvvY2sBNvVcbJz4jvDr6fSWYdmqv9NPQ as pythonApi
app = __import__(pythonApi.GetModuleName("app"))
net = __import__(pythonApi.GetModuleName("net"))
ime = __import__(pythonApi.GetModuleName("ime"))
systemSetting = __import__(pythonApi.GetModuleName("systemSetting"))
background = __import__(pythonApi.GetModuleName("background"))
import dbg
import ui
import snd
import wndMgr
import musicInfo
import serverInfo
import ServerStateChecker
import localeInfo
import constInfo
import uiCommon
import time
import ServerCommandParser
import uiScriptLocale
import base64
import os
import linecache
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
import configparser
account_parser = configparser.ConfigParser()
LOGIN_DELAY_SEC = 0.0
SKIP_LOGIN_PHASE = FALSE
SKIP_LOGIN_PHASE_SUPPORT_CHANNEL = FALSE
FULL_BACK_IMAGE = FALSE
PASSPOD_MSG_DICT = {}
VIRTUAL_KEYBOARD_NUM_KEYS = 46
VIRTUAL_KEYBOARD_RAND_KEY = FALSE
def Suffle(src):
if VIRTUAL_KEYBOARD_RAND_KEY:
items = [item for item in src]
itemCount = len(items)
for oldPos in xrange(itemCount):
newPos = app.GetRandom(0, itemCount-1)
items[newPos], items[oldPos] = items[oldPos], items[newPos]
return "".join(items)
else:
return src
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 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, localeInfo.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)
#/* Yeni Random Login Arkaplanı // LOGINRANDOMARKAPLAN // 10.10.2017 - 18:20 */
if constInfo.NEW_ENABLE_BACKGROUND:
self.backgroundImage = 0
self.lastLoginTime = 0
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
self.isDeletingAccount = False
self.inputDialog = None
self.connectingDialog = None
self.stream=stream
self.isNowCountDown=FALSE
self.isStartError=FALSE
self.xServerBoard = 0
self.yServerBoard = 0
self.loadingImage = None
self.virtualKeyboard = None
self.virtualKeyboardMode = "ALPHABET"
self.virtualKeyboardIsUpper = FALSE
# @fixme001 BEGIN (timeOutMsg and timeOutOk undefined)
self.timeOutMsg = False
self.timeOutOk = False
# @fixme001 END
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" : localeInfo.LOGIN_FAILURE_UNKNOWN,
"ALREADY" : localeInfo.LOGIN_FAILURE_ALREAY,
"NOID" : localeInfo.LOGIN_FAILURE_NOT_EXIST_ID,
"WRONGPWD" : localeInfo.LOGIN_FAILURE_WRONG_PASSWORD,
"FULL" : localeInfo.LOGIN_FAILURE_TOO_MANY_USER,
"SHUTDOWN" : localeInfo.LOGIN_FAILURE_SHUTDOWN,
"REPAIR" : localeInfo.LOGIN_FAILURE_REPAIR_ID,
"BLOCK" : localeInfo.LOGIN_FAILURE_BLOCK_ID,
"WRONGMAT" : localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER,
"QUIT" : localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE,
"BESAMEKEY" : localeInfo.LOGIN_FAILURE_BE_SAME_KEY,
"NOTAVAIL" : localeInfo.LOGIN_FAILURE_NOT_AVAIL,
"NOBILL" : localeInfo.LOGIN_FAILURE_NOBILL,
"BLKLOGIN" : localeInfo.LOGIN_FAILURE_BLOCK_LOGIN,
"WEBBLK" : localeInfo.LOGIN_FAILURE_WEB_BLOCK,
"BADSCLID" : localeInfo.LOGIN_FAILURE_WRONG_SOCIALID,
"AGELIMIT" : localeInfo.LOGIN_FAILURE_SHUTDOWN_TIME,
"HWBANNED" : localeInfo.LOGIN_FAILURE_HW_BANNED,
"SECUREPC" : localeInfo.LOGIN_FAILURE_SECUREPC,
"HDD_BAN" : localeInfo.LOGIN_FAILURE_HDD_BAN,
"PCHATAL" : localeInfo.LOGIN_FAILURE_PCSORUN,
}
self.loginFailureFuncDict = {
"WRONGPWD" : self.__DisconnectAndInputPassword,
"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
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.serverBoard.Hide()
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
self.ChannelAccountManager.Hide()
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)
return
if self.loginInfo:
self.serverBoard.Hide()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
else:
connectingIP = self.stream.GetConnectAddr()
if connectingIP:
self.__OpenLoginBoard()
else:
self.__RefreshServerList()
self.__OpenServerBoard()
app.ShowCursor()
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
self.AccountDeleteAbort.Hide()
self.RefreshAccounts()
def Close(self):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
ServerStateChecker.Initialize(self)
print "---------------------------------------------------------------------------- CLOSE LOGIN WINDOW "
#
# selectMusicÀÌ ¾øÀ¸¸é BGMÀÌ ²÷±â¹Ç·Î µÎ°³ ´Ù üũÇÑ´Ù.
#
if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
snd.FadeOutMusic("BGM/"+musicInfo.loginMusic)
## NOTE : idEditLine¿Í pwdEditLineÀº À̺¥Æ®°¡ ¼·Î ¿¬°á µÇ¾îÀÖ¾î¼
## Event¸¦ °Á¦·Î ÃʱâÈ ÇØÁÖ¾î¾ß¸¸ ÇÕ´Ï´Ù - [levites]
self.idEditLine.SetTabEvent(0)
self.idEditLine.SetReturnEvent(0)
self.pwdEditLine.SetReturnEvent(0)
self.pwdEditLine.SetTabEvent(0)
self.connectBoard = None
self.loginBoard = None
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
self.ChannelAccountManager = None
self.idEditLine = None
self.pwdEditLine = None
self.inputDialog = None
self.connectingDialog = None
self.loadingImage = None
self.serverBoard = None
self.serverList = None
self.channelList = None
self.VIRTUAL_KEY_ALPHABET_LOWERS = None
self.VIRTUAL_KEY_ALPHABET_UPPERS = None
self.VIRTUAL_KEY_SYMBOLS = None
self.VIRTUAL_KEY_NUMBERS = None
# VIRTUAL_KEYBOARD_BUG_FIX
if self.virtualKeyboard:
for keyIndex in xrange(0, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(None)
self.GetChild("key_space").SetEvent(None)
self.GetChild("key_backspace").SetEvent(None)
self.GetChild("key_enter").SetEvent(None)
self.GetChild("key_shift").SetToggleDownEvent(None)
self.GetChild("key_shift").SetToggleUpEvent(None)
self.GetChild("key_at").SetToggleDownEvent(None)
self.GetChild("key_at").SetToggleUpEvent(None)
self.virtualKeyboard = None
self.KillFocus()
self.Hide()
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
self.isDeletingAccount = False
#/* Yeni Random Login Arkaplanı // LOGINRANDOMARKAPLAN // 10.10.2017 - 18:20 */
if constInfo.NEW_ENABLE_BACKGROUND:
self.backgroundImage = 0
self.stream.popupWindow.Close()
self.loginFailureFuncDict=None
ime.ClearExceptKey()
app.HideCursor()
def __SaveChannelInfo(self):
try:
file=old_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=old_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 self.pwdEditLine != None:
self.pwdEditLine.SetFocus()
def OnEndCountDown(self):
self.isNowCountDown = FALSE
self.timeOutMsg = 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 self.timeOutMsg:
self.PopupNotifyMessage(localeInfo.LOGIN_FAILURE_TIMEOUT, self.SetPasswordEditLineFocus)
else:
self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.SetPasswordEditLineFocus)
def OnHandShake(self):
if not IsLoginDelay():
snd.PlaySound("sound/ui/loginok.wav")
self.PopupDisplayMessage(localeInfo.LOGIN_CONNECT_SUCCESS)
def OnLoginStart(self):
if not IsLoginDelay():
self.PopupDisplayMessage(localeInfo.LOGIN_PROCESSING)
def OnLoginFailure(self, error):
if self.connectingDialog:
self.connectingDialog.Close()
self.connectingDialog = None
try:
loginFailureMsg = self.loginFailureMsgDict[error]
except KeyError:
loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN + error
#0000685: [M2EU] ¾ÆÀ̵ğ/ºñ¹Ğ¹øÈ£ À¯Ãß °¡´É ¹ö±× ¼öÁ¤: ¹«Á¶°Ç Æнº¿öµå·Î Æ÷Ä¿½º°¡ °¡°Ô ¸¸µç´Ù
loginFailureFunc=self.loginFailureFuncDict.get(error, self.SetPasswordEditLineFocus)
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 __LoadScript(self, fileName):
import dbg
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, fileName)
except:
import exception
exception.Abort("LoginWindow.__LoadScript.LoadObject")
try:
GetObject = self.GetChild
#/* Yeni Random Login Arkaplanı // LOGINRANDOMARKAPLAN // 10.10.2017 - 18:20 */
if constInfo.NEW_ENABLE_BACKGROUND:
self.backgroundImage = GetObject("BackGround")
self.serverBoard = GetObject("ServerBoard")
self.serverList = GetObject("ServerList")
self.channelList = GetObject("ChannelList")
self.serverSelectButton = GetObject("ServerSelectButton")
self.serverExitButton = GetObject("ServerExitButton")
self.connectBoard = GetObject("ConnectBoard")
self.loginBoard = GetObject("LoginBoard")
self.idEditLine = GetObject("ID_EditLine")
self.pwdEditLine = GetObject("Password_EditLine")
self.serverInfo = GetObject("ConnectName")
self.selectConnectButton = GetObject("SelectConnectButton")
self.loginButton = GetObject("LoginButton")
self.loginExitButton = GetObject("LoginExitButton")
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
self.ChannelAccountManager = GetObject("ChannelAccountManager")
self.acc1loginButton = GetObject('Acc1Login')
self.acc2loginButton = GetObject('Acc2Login')
self.acc3loginButton = GetObject('Acc3Login')
self.acc4loginButton = GetObject('Acc4Login')
self.acc5loginButton = GetObject('Acc5Login')
self.acc6loginButton = GetObject('Acc6Login')
self.LoginSaveButton = GetObject('LoginSaveButton')
self.AccountDeleteButton = GetObject('AccountDeleteButton')
self.AccountDeleteAbort = GetObject('AccountDeleteAbort')
self.virtualKeyboard = self.GetChild2("VirtualKeyboard")
if self.virtualKeyboard:
self.VIRTUAL_KEY_ALPHABET_UPPERS = Suffle(localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS)
self.VIRTUAL_KEY_ALPHABET_LOWERS = "".join([localeInfo.VIRTUAL_KEY_ALPHABET_LOWERS[localeInfo.VIRTUAL_KEY_ALPHABET_UPPERS.index(e)] for e in self.VIRTUAL_KEY_ALPHABET_UPPERS])
if localeInfo.IsBRAZIL():
self.VIRTUAL_KEY_SYMBOLS_BR = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.VIRTUAL_KEY_SYMBOLS = Suffle(localeInfo.VIRTUAL_KEY_SYMBOLS)
self.VIRTUAL_KEY_NUMBERS = Suffle(localeInfo.VIRTUAL_KEY_NUMBERS)
self.__VirtualKeyboard_SetAlphabetMode()
self.GetChild("key_space").SetEvent(lambda : self.__VirtualKeyboard_PressKey(' '))
self.GetChild("key_backspace").SetEvent(lambda : self.__VirtualKeyboard_PressBackspace())
self.GetChild("key_enter").SetEvent(lambda : self.__VirtualKeyboard_PressReturn())
self.GetChild("key_shift").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetUpperMode())
self.GetChild("key_shift").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetLowerMode())
self.GetChild("key_at").SetToggleDownEvent(lambda : self.__VirtualKeyboard_SetSymbolMode())
self.GetChild("key_at").SetToggleUpEvent(lambda : self.__VirtualKeyboard_SetAlphabetMode())
except:
import exception
exception.Abort("LoginWindow.__LoadScript.BindObject")
#/* Yeni Random Login Arkaplanı // LOGINRANDOMARKAPLAN // 10.10.2017 - 18:20 */
if constInfo.NEW_ENABLE_BACKGROUND:
imgFileNameDict={
0 : "locale/tr/ui/login/1.sub",
}
try:
imgFileName = imgFileNameDict[app.GetRandom(0, len(imgFileNameDict) - 1)]
self.backgroundImage.LoadImage(imgFileName)
except:
print 'LoadingWindow.Open.LoadImage - %s File Load Error' % imgFileName
self.backgroundImage.Hide()
width = float(wndMgr.GetScreenWidth()) / float(self.backgroundImage.GetWidth())
height = float(wndMgr.GetScreenHeight()) / float(self.backgroundImage.GetHeight())
self.backgroundImage.SetScale(width, height)
if self.IS_TEST:
self.selectConnectButton.Hide()
else:
self.selectConnectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectConnectButton))
self.serverBoard.OnKeyUp = ui.__mem_func__(self.__ServerBoard_OnKeyUp)
self.xServerBoard, self.yServerBoard = self.serverBoard.GetLocalPosition()
self.serverSelectButton.SetEvent(ui.__mem_func__(self.__OnClickSelectServerButton))
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
self.loginExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
self.serverList.SetEvent(ui.__mem_func__(self.__OnSelectServer))
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))
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
self.acc1loginButton.SAFE_SetEvent(self.__LoadAccountAndConnect, 1)
self.acc2loginButton.SAFE_SetEvent(self.__LoadAccountAndConnect, 2)
self.acc3loginButton.SAFE_SetEvent(self.__LoadAccountAndConnect, 3)
self.acc4loginButton.SAFE_SetEvent(self.__LoadAccountAndConnect, 4)
self.acc5loginButton.SAFE_SetEvent(self.__LoadAccountAndConnect, 5)
self.acc6loginButton.SAFE_SetEvent(self.__LoadAccountAndConnect, 6)
self.LoginSaveButton.SetEvent(ui.__mem_func__(self.__OnClickLoginSaveButton))
self.AccountDeleteButton.SetEvent(ui.__mem_func__(self.__OnClickAccountDeleteButton))
self.AccountDeleteAbort.SetEvent(ui.__mem_func__(self.__OnClickAccountDeleteAbort))
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
return 1
def __VirtualKeyboard_SetKeys(self, keyCodes):
uiDefFontBackup = localeInfo.UI_DEF_FONT
localeInfo.UI_DEF_FONT = localeInfo.UI_DEF_FONT_LARGE
keyIndex = 1
for keyCode in keyCodes:
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=keyCode: self.__VirtualKeyboard_PressKey(x))
key.SetText(keyCode)
key.ButtonText.SetFontColor(0, 0, 0)
keyIndex += 1
for keyIndex in xrange(keyIndex, VIRTUAL_KEYBOARD_NUM_KEYS+1):
key = self.GetChild2("key_%d" % keyIndex)
if key:
key.SetEvent(lambda x=' ': self.__VirtualKeyboard_PressKey(x))
key.SetText(' ')
localeInfo.UI_DEF_FONT = uiDefFontBackup
def __VirtualKeyboard_PressKey(self, code):
ime.PasteString(code)
#if self.virtualKeyboardMode == "ALPHABET" and self.virtualKeyboardIsUpper:
# self.__VirtualKeyboard_SetLowerMode()
def __VirtualKeyboard_PressBackspace(self):
ime.PasteBackspace()
def __VirtualKeyboard_PressReturn(self):
ime.PasteReturn()
def __VirtualKeyboard_SetUpperMode(self):
self.virtualKeyboardIsUpper = TRUE
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_UPPERS)
elif self.virtualKeyboardMode == "NUMBER":
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
def __VirtualKeyboard_SetLowerMode(self):
self.virtualKeyboardIsUpper = FALSE
if self.virtualKeyboardMode == "ALPHABET":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
elif self.virtualKeyboardMode == "NUMBER":
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
else:
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
def __VirtualKeyboard_SetAlphabetMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "ALPHABET"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_ALPHABET_LOWERS)
def __VirtualKeyboard_SetNumberMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "NUMBER"
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_NUMBERS)
def __VirtualKeyboard_SetSymbolMode(self):
self.virtualKeyboardIsUpper = FALSE
self.virtualKeyboardMode = "SYMBOL"
if localeInfo.IsBRAZIL():
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS_BR)
else:
self.__VirtualKeyboard_SetKeys(self.VIRTUAL_KEY_SYMBOLS)
def Connect(self, id, pwd):
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(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL)
if self.idEditLine.GetText():
constInfo.ACCOUNT_NAME = str(self.idEditLine.GetText())
else:
constInfo.ACCOUNT_NAME = str(id)
if id != 0:
self.stream.SetLoginInfo(id, pwd)
self.stream.Connect()
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
def RefreshAccounts(self):
account_1 = account_2 = account_3 = account_4 = account_5 = account_6 = 0
account_parser.read('python2222.dll')
try:
account_1 = base64.b64decode(account_parser.get("ACCOUNT_1", "id"))
except:
self.acc1loginButton.SetText('Boş Slot')
try:
account_2 = base64.b64decode(account_parser.get("ACCOUNT_2", "id"))
except:
self.acc2loginButton.SetText('Boş Slot')
try:
account_3 = base64.b64decode(account_parser.get("ACCOUNT_3", "id"))
except:
self.acc3loginButton.SetText('Boş Slot')
try:
account_4 = base64.b64decode(account_parser.get("ACCOUNT_4", "id"))
except:
self.acc4loginButton.SetText('Boş Slot')
try:
account_5 = base64.b64decode(account_parser.get("ACCOUNT_5", "id"))
except:
self.acc5loginButton.SetText('Boş Slot')
try:
account_6 = base64.b64decode(account_parser.get("ACCOUNT_6", "id"))
except:
self.acc6loginButton.SetText('Boş Slot')
if account_1 != 0:
self.acc1loginButton.SetText(account_1)
if account_2 != 0:
self.acc2loginButton.SetText(account_2)
if account_3 != 0:
self.acc3loginButton.SetText(account_3)
if account_4 != 0:
self.acc4loginButton.SetText(account_4)
if account_5 != 0:
self.acc5loginButton.SetText(account_5)
if account_6 != 0:
self.acc6loginButton.SetText(account_6)
#kayitsistem
def __LoadAccountAndConnect(self, account_id):
if self.isDeletingAccount == True:
try:
account_1 = account_parser.get('ACCOUNT_' + str(account_id), 'id')
except:
self.PopupNotifyMessage('Bu (' + str(account_id) + ') slot zaten Boş!')
return
self.RemoveAccountSlotFromSection(account_id)
self.PopupNotifyMessage('Slot (' + str(account_id) + ') bilgileri silindi.')
self.AccountDeleteAbort.Hide()
self.isDeletingAccount = False
self.RefreshAccounts()
else:
id = pw = 0
try:
id = base64.b64decode(account_parser.get("ACCOUNT_" + str(account_id), "id"))
pw = base64.b64decode(account_parser.get("ACCOUNT_" + str(account_id), "pw"))
except:
self.PopupNotifyMessage('Bu slota ait giriş bilgisi bulunamadı!')
return
self.Connect(id, pw)
#kayitsistem
def __OnClickLoginSaveButton(self):
account_1 = account_2 = account_3 = account_4 = account_5 = account_6 = 0
try:
account_1 = account_parser.get('ACCOUNT_1', 'id')
except:
pass
try:
account_2 = account_parser.get('ACCOUNT_2', 'id')
except:
pass
try:
account_3 = account_parser.get('ACCOUNT_3', 'id')
except:
pass
try:
account_4 = account_parser.get('ACCOUNT_4', 'id')
except:
pass
try:
account_5 = account_parser.get('ACCOUNT_5', 'id')
except:
pass
try:
account_6 = account_parser.get('ACCOUNT_6', 'id')
except:
pass
if account_1 == 0:
slotToWrite = 'ACCOUNT_1'
elif account_2 == 0:
slotToWrite = 'ACCOUNT_2'
elif account_3 == 0:
slotToWrite = 'ACCOUNT_3'
elif account_4 == 0:
slotToWrite = 'ACCOUNT_4'
elif account_5 == 0:
slotToWrite = 'ACCOUNT_5'
elif account_6 == 0:
slotToWrite = 'ACCOUNT_6'
else:
self.PopupNotifyMessage('Kaydedilecek Boş slot yok!')
return
id = self.idEditLine.GetText()
pw = self.pwdEditLine.GetText()
with open('python2222.dll', 'w') as f:
account_parser.add_section(slotToWrite)
account_parser.set(slotToWrite, 'id', base64.b64encode(id))
account_parser.set(slotToWrite, 'pw', base64.b64encode(pw))
account_parser.write(f)
self.PopupNotifyMessage('Giriş bilgileri başarıyla kaydedildi!')
self.RefreshAccounts()
def OnKeyDown(self, key):
try:
if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
connectingIP = self.stream.GetConnectAddr()
if key == app.DIK_F1:
if connectingIP:
self.__LoadAccountAndConnect(1)
else:
self.PopupNotifyMessage('Önce kanal seçimi yapıp Tamam butonuna tıklayınız!')
if key == app.DIK_F2:
if connectingIP:
self.__LoadAccountAndConnect(2)
else:
self.PopupNotifyMessage('Önce kanal seçimi yapıp Tamam butonuna tıklayınız!')
if key == app.DIK_F3:
if connectingIP:
self.__LoadAccountAndConnect(3)
else:
self.PopupNotifyMessage('Önce kanal seçimi yapıp Tamam butonuna tıklayınız!')
if key == app.DIK_F4:
if connectingIP:
self.__LoadAccountAndConnect(4)
else:
self.PopupNotifyMessage('Önce kanal seçimi yapıp Tamam butonuna tıklayınız!')
if key == app.DIK_F5:
if connectingIP:
self.__LoadAccountAndConnect(5)
else:
self.PopupNotifyMessage('Önce kanal seçimi yapıp Tamam butonuna tıklayınız!')
if key == app.DIK_F6:
if connectingIP:
self.__LoadAccountAndConnect(6)
else:
self.PopupNotifyMessage('Önce kanal seçimi yapıp Tamam butonuna tıklayınız!')
except KeyError:
pass
except:
raise
return True
#kayitsistem
def __OnClickAccountDeleteButton(self):
self.PopupNotifyMessage('Silinecek bir slot seç.')
self.AccountDeleteAbort.Show()
self.isDeletingAccount = True
def __OnClickAccountDeleteAbort(self):
self.AccountDeleteAbort.Hide()
self.isDeletingAccount = False
def RemoveAccountSlotFromSection(self, n):
with open('python2222.dll', 'r') as f:
account_parser.read(f)
account_parser.remove_section('ACCOUNT_' + str(n))
with open('python2222.dll', 'w') as f:
account_parser.write(f)
#kayitsistem end
def __OnClickExitButton(self):
self.stream.SetPhaseWindow(0)
def __SetServerInfo(self, name):
net.SetServerInfo(name.strip())
self.serverInfo.SetText(name)
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, localeInfo.UI_OK)
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(localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE, app.Exit, localeInfo.UI_OK)
def OnUpdate(self):
ServerStateChecker.Update()
def EmptyFunc(self):
pass
#####################################################################################
def __ServerBoard_OnKeyUp(self, key):
if self.serverBoard.IsShow():
if app.DIK_RETURN==key:
self.__OnClickSelectServerButton()
return TRUE
def __GetRegionID(self):
return 0
def __GetServerID(self):
return self.serverList.GetSelectedItem()
def __GetChannelID(self):
return self.channelList.GetSelectedItem()
# 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 __OpenServerBoard(self):
loadRegionID, loadServerID, loadChannelID = self.__LoadChannelInfo()
serverIndex = self.__ServerIDToServerIndex(loadRegionID, loadServerID)
channelIndex = self.__ChannelIDToChannelIndex(loadChannelID)
self.serverList.SelectItem(serverIndex)
if localeInfo.IsEUROPE():
self.channelList.SelectItem(app.GetRandom(0, self.channelList.GetItemCount()))
else:
if channelIndex >= 0:
self.channelList.SelectItem(channelIndex)
## Show/Hide Äڵ忡 ¹®Á¦°¡ ÀÖ¾î¼ Àӽà - [levites]
self.serverBoard.SetPosition(self.xServerBoard, self.yServerBoard)
self.serverBoard.Show()
self.connectBoard.Hide()
self.loginBoard.Hide()
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
self.ChannelAccountManager.Hide()
if self.virtualKeyboard:
self.virtualKeyboard.Hide()
def __OpenLoginBoard(self):
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
self.serverBoard.SetPosition(self.xServerBoard, wndMgr.GetScreenHeight())
self.serverBoard.Hide()
if self.virtualKeyboard:
self.virtualKeyboard.Show()
if not self.stream.isAutoLogin:
self.connectBoard.Show()
self.loginBoard.Show()
#/* Hesap Kayıt sistemi //HESAPKAYITSISTEM // 15.10.17 - 23:56 */
if constInfo.ACCOUNT_REGISTER_ENABLE:
self.ChannelAccountManager.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 __OnSelectSettlementArea(self):
# SEVER_LIST_BUG_FIX
regionID = self.__GetRegionID()
serverID = self.serverListOnRegionBoard.GetSelectedItem()
serverIndex = self.__ServerIDToServerIndex(regionID, serverID)
self.serverList.SelectItem(serverIndex)
# END_OF_SEVER_LIST_BUG_FIX
self.__OnSelectServer()
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 localeInfo.IsBRAZIL() or localeInfo.IsCANADA():
self.serverList.InsertItem(id, "%s" % (name))
else:
if localeInfo.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 __OnSelectServer(self):
self.__OnCloseInputDialog()
self.__RequestServerStateList()
self.__RefreshServerStateList()
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
ServerStateChecker.Initialize();
for id, channelDataDict in channelDict.items():
key=channelDataDict["key"]
ip=channelDataDict["ip"]
udp_port=channelDataDict["udp_port"]
ServerStateChecker.AddChannel(key, ip, udp_port)
ServerStateChecker.Request()
def __RefreshServerStateList(self):
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
bakChannelID = self.channelList.GetSelectedItem()
self.channelList.ClearItem()
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except:
print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID)
return
for channelID, channelDataDict in channelDict.items():
channelName = channelDataDict["name"]
channelState = channelDataDict["state"]
self.channelList.InsertItem(channelID, " %s %s" % (channelName, channelState))
self.channelList.SelectItem(bakChannelID-1)
def __GetChannelName(self, regionID, selServerID, selChannelID):
try:
return serverInfo.REGION_DICT[regionID][selServerID]["channel"][selChannelID]["name"]
except KeyError:
if 9==selChannelID:
return localeInfo.CHANNEL_PVP
else:
return localeInfo.CHANNEL_NORMAL % (selChannelID)
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(localeInfo.CHANNEL_NOT_FIND_INFO)
def __OnClickExitServerButton(self):
print "exit server"
self.__OpenLoginBoard()
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
def __OnClickSelectRegionButton(self):
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
self.__SaveChannelInfo()
self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))
self.serverExitButton.SetText(localeInfo.UI_CLOSE)
self.__RefreshServerList()
self.__OpenServerBoard()
def __OnClickSelectServerButton(self):
if IsFullBackImage():
self.GetChild("bg1").Hide()
self.GetChild("bg2").Show()
regionID = self.__GetRegionID()
serverID = self.__GetServerID()
channelID = self.__GetChannelID()
if (not serverInfo.REGION_DICT.has_key(regionID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION)
return
if (not serverInfo.REGION_DICT[regionID].has_key(serverID)):
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER)
return
try:
channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"]
except KeyError:
return
try:
state = channelDict[channelID]["state"]
except KeyError:
self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_CHANNEL)
return
# »óÅ°¡ FULL °ú °°À¸¸é ÁøÀÔ ±İÁö
if state == serverInfo.STATE_DICT[3]:
self.PopupNotifyMessage(localeInfo.CHANNEL_NOTIFY_FULL)
return
self.__SaveChannelInfo()
try:
serverName = serverInfo.REGION_DICT[regionID][serverID]["name"]
channelName = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["name"]
addrKey = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["key"]
if "õ¸¶ ¼¹ö" == serverName:
app.ForceSetlocaleInfo("ymir", "localeInfo/ymir")
elif "Äèµµ ¼¹ö" == serverName:
app.ForceSetlocaleInfo("we_korea", "localeInfo/we_korea")
except:
print " ERROR __OnClickSelectServerButton(%d, %d, %d)" % (regionID, serverID, channelID)
serverName = localeInfo.CHANNEL_EMPTY_SERVER
channelName = localeInfo.CHANNEL_NORMAL % channelID
self.__SetServerInfo("%s, %s " % (serverName, channelName))
try:
ip = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["ip"]
tcp_port = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["tcp_port"]
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¼¹ö ¼±Åà ½ÇÆĞ")
try:
account_ip = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["ip"]
account_port = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["port"]
except:
account_ip = 0
account_port = 0
try:
markKey = regionID*1000 + serverID*10
markAddrValue=serverInfo.MARKADDR_DICT[markKey]
net.SetMarkServer(markAddrValue["ip"], markAddrValue["tcp_port"])
app.SetGuildMarkPath(markAddrValue["mark"])
# GUILD_SYMBOL
app.SetGuildSymbolPath(markAddrValue["symbol_path"])
# END_OF_GUILD_SYMBOL
except:
import exception
exception.Abort("LoginWindow.__OnClickSelectServerButton - ¸¶Å© Á¤º¸ ¾øÀ½")
self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
self.__OpenLoginBoard()
def __OnClickSelectConnectButton(self):
if IsFullBackImage():
self.GetChild("bg1").Show()
self.GetChild("bg2").Hide()
self.__RefreshServerList()
self.__OpenServerBoard()
def __OnClickLoginButton(self):
id = self.idEditLine.GetText()
pwd = self.pwdEditLine.GetText()
if len(id)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
return
if len(pwd)==0:
self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
return
self.Connect(id, pwd)