Esempio n. 1
0
	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.ForceSetLocale("ymir", "locale/ymir")
			elif "쾌도 서버" == serverName:			
				app.ForceSetLocale("we_korea", "locale/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 - 마크 정보 없음")


		if app.USE_OPENID and not app.OPENID_TEST :
			## 2012.07.19 OpenID : 김용욱
			# 채널 선택 화면에서 "확인"(SelectServerButton) 을 눌렀을때,
			# 로그인 화면으로 넘어가지 않고 바로 서버에 OpenID 인증키를 보내도록 수정
			self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
			self.Connect(0, 0)
		else :
			self.stream.SetConnectInfo(ip, tcp_port, account_ip, account_port)
			self.__OpenLoginBoard()
Esempio n. 2
0
    def __LoadLoginInfo(self, loginInfoFileName):
        def getValue(element, name, default):
            if [] != element.getElementsByTagName(name):
                return element.getElementsByTagName(name).item(
                    0).firstChild.nodeValue
            else:
                return default

        self.id = None
        self.pwd = None
        self.loginnedServer = None
        self.loginnedChannel = None
        app.loggined = False

        self.loginInfo = True

        from xml.dom.minidom import parse
        try:
            f = old_open(loginInfoFileName, "r")
            dom = parse(f)
        except:
            return
        serverLst = dom.getElementsByTagName("server")
        if [] != dom.getElementsByTagName("logininfo"):
            logininfo = dom.getElementsByTagName("logininfo")[0]
        else:
            return

        try:
            server_name = logininfo.getAttribute("name")
            channel_idx = int(logininfo.getAttribute("channel_idx"))
        except:
            return

        try:
            matched = False

            for k, v in serverInfo.REGION_DICT[0].iteritems():
                if v["name"] == server_name:
                    account_addr = serverInfo.REGION_AUTH_SERVER_DICT[0][k][
                        "ip"]
                    account_port = serverInfo.REGION_AUTH_SERVER_DICT[0][k][
                        "port"]

                    channel_info = v["channel"][channel_idx]
                    channel_name = channel_info["name"]
                    addr = channel_info["ip"]
                    port = channel_info["tcp_port"]

                    net.SetMarkServer(addr, port)
                    self.stream.SetConnectInfo(addr, port, account_addr,
                                               account_port)

                    matched = True
                    break

            if False == matched:
                return
        except:
            return

        self.__SetServerInfo("%s, %s " % (server_name, channel_name))
        id = getValue(logininfo, "id", "")
        pwd = getValue(logininfo, "pwd", "")
        self.idEditLine.SetText(id)
        self.pwdEditLine.SetText(pwd)
        slot = getValue(logininfo, "slot", "0")
        locale = getValue(logininfo, "locale", "")
        locale_dir = getValue(logininfo, "locale_dir", "")
        is_auto_login = int(getValue(logininfo, "auto_login", "0"))

        self.stream.SetCharacterSlot(int(slot))
        self.stream.isAutoLogin = is_auto_login
        self.stream.isAutoSelect = is_auto_login

        if locale and locale_dir:
            app.ForceSetLocale(locale, locale_dir)

        if 0 != is_auto_login:
            self.Connect(id, pwd)

        return