Jump to content

Como Testar Cliente Sem Ter De Ligar O Servidor


Dynamic Things
 Share

Recommended Posts

Este tutorial é ideal para pessoas que gostam de testar mapas, ou ideal para pessoas que quer começar a explorar novos tipos de interface, como por exemplo este aqui:

ou mesmo para pessoas que estejam a trabalhar com a interface do cliente e não queiram estar sempre a fazer login

 

O que fazer?

Subistituir todo o vosso codigo do root/intrologin.py por isso:

 

 

 

import dbg

import app

import net

import ui

import ime

import snd

import wndMgr

import musicInfo

import serverInfo

import systemSetting

import ServerStateChecker

import localeInfo

import constInfo

import uiCommon

import time

import serverCommandParser

import ime

import uiScriptLocale

import loginInfo

 

RUNUP_MATRIX_AUTH = FALSE

NEWCIBN_PASSPOD_AUTH = FALSE

 

LOGIN_DELAY_SEC = 0.0

SKIP_LOGIN_PHASE = FALSE

SKIP_LOGIN_PHASE_SUPPORT_CHANNEL = FALSE

FULL_BACK_IMAGE = FALSE

 

PASSPOD_MSG_DICT = {}

 

VIRTUAL_KEYBOARD_NUM_KEYS = 46

VIRTUAL_KEYBOARD_RAND_KEY = TRUE

 

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

 

if localeInfo.IsNEWCIBN() or localeInfo.IsCIBN10():

LOGIN_DELAY_SEC = 60.0

FULL_BACK_IMAGE = TRUE

NEWCIBN_PASSPOD_AUTH = TRUE

PASSPOD_MSG_DICT = {

"PASERR1" : localeInfo.LOGIN_FAILURE_PASERR1,

"PASERR2" : localeInfo.LOGIN_FAILURE_PASERR2,

"PASERR3" : localeInfo.LOGIN_FAILURE_PASERR3,

"PASERR4" : localeInfo.LOGIN_FAILURE_PASERR4,

"PASERR5" : localeInfo.LOGIN_FAILURE_PASERR5,

}

 

elif localeInfo.IsYMIR() or localeInfo.IsCHEONMA():

FULL_BACK_IMAGE = TRUE

 

elif localeInfo.IsHONGKONG():

FULL_BACK_IMAGE = TRUE

RUNUP_MATRIX_AUTH = TRUE

PASSPOD_MSG_DICT = {

"NOTELE" : localeInfo.LOGIN_FAILURE_NOTELEBLOCK,

}

 

elif localeInfo.IsJAPAN():

FULL_BACK_IMAGE = TRUE

 

elif localeInfo.IsBRAZIL():

LOGIN_DELAY_SEC = 60.0

 

def IsFullBackImage():

global FULL_BACK_IMAGE

return FULL_BACK_IMAGE

 

def IsLoginDelay():

global LOGIN_DELAY_SEC

if LOGIN_DELAY_SEC > 0.0:

return TRUE

else:

return FALSE

 

def IsRunupMatrixAuth():

global RUNUP_MATRIX_AUTH

return RUNUP_MATRIX_AUTH

 

def IsNEWCIBNPassPodAuth():

global NEWCIBN_PASSPOD_AUTH

return NEWCIBN_PASSPOD_AUTH

 

def GetLoginDelay():

global LOGIN_DELAY_SEC

return LOGIN_DELAY_SEC

 

app.SetGuildMarkPath("test")

 

class ConnectingDialog(ui.ScriptWindow):

 

def __init__(self):

ui.ScriptWindow.__init__(self)

self.__LoadDialog()

self.eventTimeOver = lambda *arg: None

self.eventExit = lambda *arg: None

 

def __del__(self):

ui.ScriptWindow.__del__(self)

 

def __LoadDialog(self):

try:

PythonScriptLoader = ui.PythonScriptLoader()

PythonScriptLoader.LoadScriptFile(self, "UIScript/ConnectingDialog.py")

 

self.board = self.GetChild("board")

self.message = self.GetChild("message")

self.countdownMessage = self.GetChild("countdown_message")

 

except:

import exception

exception.Abort("ConnectingDialog.LoadDialog.BindObject")

 

def Open(self, waitTime):

curTime = time.clock()

self.endTime = curTime + waitTime

 

self.Lock()

self.SetCenterPosition()

self.SetTop()

self.Show()

 

def Close(self):

self.Unlock()

self.Hide()

 

def Destroy(self):

self.Hide()

self.ClearDictionary()

 

def SetText(self, text):

self.message.SetText(text)

 

def SetCountDownMessage(self, waitTime):

self.countdownMessage.SetText("%.0f%s" % (waitTime, 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):

import loginInfo

self.loginInfo=loginInfo.TestGame()

self.loginInfo()

print "NEW LOGIN WINDOW ----------------------------------------------------------------------------"

ui.ScriptWindow.__init__(self)

net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)

net.SetAccountConnectorHandler(self)

 

self.loginInfo=loginInfo.TestGame()

self.loginInfo()

self.matrixInputChanceCount = 0

self.lastLoginTime = 0

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

 

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,

}

 

self.loginFailureFuncDict = {

"WRONGPWD" : self.__DisconnectAndInputPassword,

"WRONGMAT" : self.__DisconnectAndInputMatrix,

"QUIT" : app.Exit,

}

 

self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())

self.SetWindowName("LoginWindow")

 

if not self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py"):

dbg.TraceError("LoginWindow.Open - __LoadScript Error")

return

 

self.__LoadLoginInfo("loginInfo.xml")

 

if app.loggined:

self.loginFailureFuncDict = {

"WRONGPWD" : app.Exit,

"WRONGMAT" : app.Exit,

"QUIT" : app.Exit,

}

 

if musicInfo.loginMusic != "":

snd.SetMusicVolume(systemSetting.GetMusicVolume())

snd.FadeInMusic("BGM/"+musicInfo.loginMusic)

 

snd.SetSoundVolume(systemSetting.GetSoundVolume())

 

# pevent key "[" "]"

ime.AddExceptKey(91)

ime.AddExceptKey(93)

 

self.Show()

 

global SKIP_LOGIN_PHASE

if SKIP_LOGIN_PHASE:

if self.isStartError:

self.connectBoard.Hide()

self.loginBoard.Hide()

self.serverBoard.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:

if app.USE_OPENID and not app.OPENID_TEST :

self.__RefreshServerList()

self.__OpenServerBoard()

else:

self.__OpenLoginBoard()

if IsFullBackImage():

self.GetChild("bg1").Hide()

self.GetChild("bg2").Show()

 

else:

self.__RefreshServerList()

self.__OpenServerBoard()

 

app.ShowCursor()

 

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

self.idEditLine = None

self.pwdEditLine = None

self.inputDialog = None

self.connectingDialog = None

self.loadingImage = None

 

self.serverBoard = None

self.serverList = None

self.channelList = None

 

# RUNUP_MATRIX_AUTH

self.matrixQuizBoard = None

self.matrixAnswerInput = None

self.matrixAnswerOK = None

self.matrixAnswerCancel = None

# RUNUP_MATRIX_AUTH_END

 

# NEWCIBN_PASSPOD_AUTH

self.passpodBoard = None

self.passpodAnswerInput = None

self.passpodAnswerOK = None

self.passpodAnswerCancel = None

# NEWCIBN_PASSPOD_AUTH_END

 

self.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()

 

self.stream.popupWindow.Close()

self.loginFailureFuncDict=None

 

ime.ClearExceptKey()

 

app.HideCursor()

 

def __SaveChannelInfo(self):

try:

file=open("channel.inf", "w")

file.write("%d %d %d" % (self.__GetServerID(), self.__GetChannelID(), self.__GetRegionID()))

except:

print "LoginWindow.__SaveChannelInfo - SaveError"

 

def __LoadChannelInfo(self):

try:

file=open("channel.inf")

lines=file.readlines()

 

if len(lines)>0:

tokens=lines[0].split()

 

selServerID=int(tokens[0])

selChannelID=int(tokens[1])

 

if len(tokens) == 3:

regionID = int(tokens[2])

 

return regionID, selServerID, selChannelID

 

except:

print "LoginWindow.__LoadChannelInfo - OpenError"

return -1, -1, -1

 

def __ExitGame(self):

app.Exit()

 

def SetIDEditLineFocus(self):

if self.idEditLine != None:

self.idEditLine.SetFocus()

 

def SetPasswordEditLineFocus(self):

if localeInfo.IsEUROPE():

if self.idEditLine != None: #0000862: [M2EU] 로그인창 팝업 에러: 종료시 먼저 None 설정됨

self.idEditLine.SetText("")

self.idEditLine.SetFocus() #0000685: [M2EU] 아이디/비밀번호 유추 가능 버그 수정: 무조건 아이디로 포커스가 가게 만든다

 

if self.pwdEditLine != None: #0000862: [M2EU] 로그인창 팝업 에러: 종료시 먼저 None 설정됨

self.pwdEditLine.SetText("")

else:

if self.pwdEditLine != None:

self.pwdEditLine.SetFocus()

 

def OnEndCountDown(self):

self.isNowCountDown = FALSE

if localeInfo.IsBRAZIL():

self.timeOutMsg = TRUE

else:

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 app.loggined:

self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.__ExitGame)

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)

constInfo.ACCOUNT_NAME = str(self.idEditLine.GetText())

 

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:

if PASSPOD_MSG_DICT:

try:

loginFailureMsg = PASSPOD_MSG_DICT[error]

except KeyError:

loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN + error

else:

loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN + error

 

 

#0000685: [M2EU] 아이디/비밀번호 유추 가능 버그 수정: 무조건 패스워드로 포커스가 가게 만든다

loginFailureFunc=self.loginFailureFuncDict.get(error, self.SetPasswordEditLineFocus)

 

if app.loggined:

self.PopupNotifyMessage(loginFailureMsg, self.__ExitGame)

else:

self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc)

 

snd.PlaySound("sound/ui/loginfail.wav")

 

def __DisconnectAndInputID(self):

if self.connectingDialog:

self.connectingDialog.Close()

self.connectingDialog = None

 

self.SetIDEditLineFocus()

net.Disconnect()

 

def __DisconnectAndInputPassword(self):

if self.connectingDialog:

self.connectingDialog.Close()

self.connectingDialog = None

 

self.SetPasswordEditLineFocus()

net.Disconnect()

 

def __DisconnectAndInputMatrix(self):

if self.connectingDialog:

self.connectingDialog.Close()

self.connectingDialog = None

 

self.stream.popupWindow.Close()

self.matrixInputChanceCount -= 1

 

if self.matrixInputChanceCount <= 0:

self.__OnCloseInputDialog()

 

elif self.inputDialog:

self.inputDialog.Show()

 

def __LoadScript(self, fileName):

import dbg

try:

pyScrLoader = ui.PythonScriptLoader()

pyScrLoader.LoadScriptFile(self, fileName)

except:

import exception

exception.Abort("LoginWindow.__LoadScript.LoadObject")

try:

GetObject=self.GetChild

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")

 

if localeInfo.IsVIETNAM():

self.checkButton = GetObject("CheckButton")

self.checkButton.Down()

 

# RUNUP_MATRIX_AUTH

if IsRunupMatrixAuth():

self.matrixQuizBoard = GetObject("RunupMatrixQuizBoard")

self.matrixAnswerInput = GetObject("RunupMatrixAnswerInput")

self.matrixAnswerOK = GetObject("RunupMatrixAnswerOK")

self.matrixAnswerCancel = GetObject("RunupMatrixAnswerCancel")

# RUNUP_MATRIX_AUTH_END

 

# NEWCIBN_PASSPOD_AUTH

if IsNEWCIBNPassPodAuth():

self.passpodBoard = GetObject("NEWCIBN_PASSPOD_BOARD")

self.passpodAnswerInput = GetObject("NEWCIBN_PASSPOD_INPUT")

self.passpodAnswerOK = GetObject("NEWCIBN_PASSPOD_OK")

self.passpodAnswerCancel= GetObject("NEWCIBN_PASSPOD_CANCEL")

# NEWCIBN_PASSPOD_AUTH_END

 

self.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")

 

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))

 

# RUNUP_MATRIX_AUTH

if IsRunupMatrixAuth():

self.matrixAnswerOK.SAFE_SetEvent(self.__OnClickMatrixAnswerOK)

self.matrixAnswerCancel.SAFE_SetEvent(self.__OnClickMatrixAnswerCancel)

self.matrixAnswerInput.SAFE_SetReturnEvent(self.__OnClickMatrixAnswerOK)

# RUNUP_MATRIX_AUTH_END

 

# NEWCIBN_PASSPOD_AUTH

if IsNEWCIBNPassPodAuth():

self.passpodAnswerOK.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerOK)

self.passpodAnswerCancel.SAFE_SetEvent(self.__OnClickNEWCIBNPasspodAnswerCancel)

self.passpodAnswerInput.SAFE_SetReturnEvent(self.__OnClickNEWCIBNPasspodAnswerOK)

 

# NEWCIBN_PASSPOD_AUTH_END

 

 

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 constInfo.SEQUENCE_PACKET_ENABLE:

net.SetPacketSequenceMode()

 

if IsLoginDelay():

loginDelay = GetLoginDelay()

self.connectingDialog = ConnectingDialog()

self.connectingDialog.Open(loginDelay)

self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)

self.connectingDialog.SAFE_SetExitEvent(self.OnPressExitKey)

self.isNowCountDown = TRUE

 

else:

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL)

 

self.stream.SetLoginInfo(id, pwd)

self.stream.Connect()

 

def __OnClickExitButton(self):

self.stream.SetPhaseWindow(0)

 

def __SetServerInfo(self, name):

net.SetServerInfo(name.strip())

self.serverInfo.SetText(name)

 

def __LoadLoginInfo(self, loginInfoFileName):

 

try:

loginInfo={}

execfile(loginInfoFileName, loginInfo)

except IOError:

print(\

"자동 로그인을 하시려면" + loginInfoFileName + "파일을 작성해주세요\n"\

"\n"\

"내용:\n"\

"================================================================\n"\

"addr=주소\n"\

"port=포트\n"\

"id=아이디\n"\

"pwd=비밀번호\n"\

"slot=캐릭터 선택 인덱스 (없거나 -1이면 자동 선택 안함)\n"\

"autoLogin=자동 접속 여부\n"

"autoSelect=자동 접속 여부\n"

"locale=(ymir) LC_Ymir 일경우 ymir로 작동. 지정하지 않으면 korea로 작동\n"

);

 

id=loginInfo.get("id", "")

pwd=loginInfo.get("pwd", "")

 

if self.IS_TEST:

try:

addr=loginInfo["addr"]

port=loginInfo["port"]

account_addr=addr

account_port=port

 

net.SetMarkServer(addr, port)

self.__SetServerInfo(locale.CHANNEL_TEST_SERVER_ADDR % (addr, port))

except:

try:

addr=serverInfo.TESTADDR["ip"]

port=serverInfo.TESTADDR["tcp_port"]

 

net.SetMarkServer(addr, port)

self.__SetServerInfo(locale.CHANNEL_TEST_SERVER)

except:

import exception

exception.Abort("LoginWindow.__LoadLoginInfo - 테스트서버 주소가 없습니다")

 

else:

addr=loginInfo.get("addr", "")

port=loginInfo.get("port", 0)

account_addr=loginInfo.get("account_addr", addr)

account_port=loginInfo.get("account_port", port)

 

locale = loginInfo.get("locale", "")

 

if addr and port:

net.SetMarkServer(addr, port)

 

if locale == "ymir" :

net.SetServerInfo("천마 서버")

self.serverInfo.SetText("Y:"+addr+":"+str(port))

else:

net.SetServerInfo(addr+":"+str(port))

self.serverInfo.SetText("K:"+addr+":"+str(port))

 

slot=loginInfo.get("slot", 0)

isAutoLogin=loginInfo.get("auto", 0)

isAutoLogin=loginInfo.get("autoLogin", 0)

isAutoSelect=loginInfo.get("autoSelect", 0)

 

self.stream.SetCharacterSlot(slot)

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

self.stream.isAutoLogin=isAutoLogin

self.stream.isAutoSelect=isAutoSelect

 

self.id = None

self.pwd = None

self.loginnedServer = None

self.loginnedChannel = None

app.loggined = FALSE

 

self.loginInfo = loginInfo

 

if self.id and self.pwd:

app.loggined = TRUE

 

if isAutoLogin:

self.Connect(id, pwd)

 

print "=================================================================================="

print "자동 로그인: %s - %s:%d %s" % (loginInfoFileName, addr, port, id)

print "=================================================================================="

 

 

def PopupDisplayMessage(self, msg):

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(msg)

 

def PopupNotifyMessage(self, msg, func=0):

if not func:

func=self.EmptyFunc

 

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(msg, func, localeInfo.UI_OK)

 

# RUNUP_MATRIX_AUTH

def BINARY_OnRunupMatrixQuiz(self, quiz):

if not IsRunupMatrixAuth():

return

 

id = self.GetChild("RunupMatrixID")

id.SetText(self.idEditLine.GetText())

 

code = self.GetChild("RunupMatrixCode")

 

code.SetText("".join(["[%c,%c]" % (quiz, quiz[i+1]) for i in xrange(0, len(quiz), 2)]))

 

self.stream.popupWindow.Close()

self.serverBoard.Hide()

self.connectBoard.Hide()

self.loginBoard.Hide()

self.matrixQuizBoard.Show()

self.matrixAnswerInput.SetFocus()

 

def __OnClickMatrixAnswerOK(self):

answer = self.matrixAnswerInput.GetText()

 

print "matrix_quiz.ok"

net.SendRunupMatrixCardPacket(answer)

self.matrixQuizBoard.Hide()

 

self.stream.popupWindow.Close()

self.stream.popupWindow.Open("WAITING FOR MATRIX AUTHENTICATION",

self.__OnClickMatrixAnswerCancel,

localeInfo.UI_CANCEL)

 

def __OnClickMatrixAnswerCancel(self):

print "matrix_quiz.cancel"

 

if self.matrixQuizBoard:

self.matrixQuizBoard.Hide()

 

if self.connectBoard:

self.connectBoard.Show()

 

if self.loginBoard:

self.loginBoard.Show()

 

# RUNUP_MATRIX_AUTH_END

 

# NEWCIBN_PASSPOD_AUTH

def BINARY_OnNEWCIBNPasspodRequest(self):

if not IsNEWCIBNPassPodAuth():

return

 

if self.connectingDialog:

self.connectingDialog.Close()

self.connectingDialog = None

 

self.stream.popupWindow.Close()

self.serverBoard.Hide()

self.connectBoard.Hide()

self.loginBoard.Hide()

self.passpodBoard.Show()

self.passpodAnswerInput.SetFocus()

 

def BINARY_OnNEWCIBNPasspodFailure(self):

if not IsNEWCIBNPassPodAuth():

return

 

def __OnClickNEWCIBNPasspodAnswerOK(self):

answer = self.passpodAnswerInput.GetText()

 

print "passpod.ok"

net.SendNEWCIBNPasspodAnswerPacket(answer)

self.passpodAnswerInput.SetText("")

self.passpodBoard.Hide()

 

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(localeInfo.WAIT_FOR_PASSPOD,

self.__OnClickNEWCIBNPasspodAnswerCancel,

localeInfo.UI_CANCEL)

 

def __OnClickNEWCIBNPasspodAnswerCancel(self):

print "passpod.cancel"

 

if self.passpodBoard:

self.passpodBoard.Hide()

 

if self.connectBoard:

self.connectBoard.Show()

 

if self.loginBoard:

self.loginBoard.Show()

 

# NEWCIBN_PASSPOD_AUTH_END

 

 

def OnMatrixCard(self, row1, row2, row3, row4, col1, col2, col3, col4):

 

if self.connectingDialog:

self.connectingDialog.Close()

self.connectingDialog = None

 

self.matrixInputChanceCount = 3

 

self.stream.popupWindow.Close()

 

# CHINA_MATRIX_CARD_BUG_FIX

## A~Z 까지 26 이내의 값이 들어있어야만 한다.

## Python Exception Log 에서 그 이상의 값이 들어있어서 에러 방지

## 헌데 왜 한국쪽 로그에서 이게 활용되는지는 모르겠음

row1 = min(30, row1)

row2 = min(30, row2)

row3 = min(30, row3)

row4 = min(30, row4)

# END_OF_CHINA_MATRIX_CARD_BUG_FIX

 

row1 = chr(row1 + ord('A'))

row2 = chr(row2 + ord('A'))

row3 = chr(row3 + ord('A'))

row4 = chr(row4 + ord('A'))

col1 = col1 + 1

col2 = col2 + 1

col3 = col3 + 1

col4 = col4 + 1

 

inputDialog = uiCommon.InputDialogWithDescription2()

inputDialog.SetMaxLength(8)

inputDialog.SetAcceptEvent(ui.__mem_func__(self.__OnAcceptMatrixCardData))

inputDialog.SetCancelEvent(ui.__mem_func__(self.__OnCancelMatrixCardData))

inputDialog.SetTitle(localeInfo.INPUT_MATRIX_CARD_TITLE)

inputDialog.SetDescription1(localeInfo.INPUT_MATRIX_CARD_NUMBER)

inputDialog.SetDescription2("%c%d %c%d %c%d %c%d" % (row1, col1,

row2, col2,

row3, col3,

row4, col4))

 

inputDialog.Open()

self.inputDialog = inputDialog

 

def __OnAcceptMatrixCardData(self):

text = self.inputDialog.GetText()

net.SendChinaMatrixCardPacket(text)

if self.inputDialog:

self.inputDialog.Hide()

self.PopupNotifyMessage(localeInfo.LOGIN_PROCESSING)

return TRUE

 

def __OnCancelMatrixCardData(self):

self.SetPasswordEditLineFocus()

self.__OnCloseInputDialog()

self.__DisconnectAndInputPassword()

return TRUE

 

def __OnCloseInputDialog(self):

if self.inputDialog:

self.inputDialog.Close()

self.inputDialog = None

return TRUE

 

def OnPressExitKey(self):

self.stream.popupWindow.Close()

self.stream.SetPhaseWindow(0)

return TRUE

 

def OnExit(self):

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(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)

 

# RUNUP_MATRIX_AUTH

if IsRunupMatrixAuth():

self.matrixQuizBoard.Hide()

# RUNUP_MATRIX_AUTH_END

 

# NEWCIBN_PASSPOD_AUTH

if IsNEWCIBNPassPodAuth():

self.passpodBoard.Hide()

# NEWCIBN_PASSPOD_AUTH_END

 

 

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()

 

if self.virtualKeyboard:

self.virtualKeyboard.Hide()

 

if app.loggined and not SKIP_LOGIN_PHASE_SUPPORT_CHANNEL:

self.serverList.SelectItem(self.loginnedServer-1)

self.channelList.SelectItem(self.loginnedChannel-1)

self.__OnClickSelectServerButton()

 

def __OpenLoginBoard(self):

 

self.serverExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitServerButton))

self.serverExitButton.SetText(localeInfo.UI_CLOSE)

 

# RUNUP_MATRIX_AUTH

if IsRunupMatrixAuth():

self.matrixQuizBoard.Hide()

# RUNUP_MATRIX_AUTH_END

 

# NEWCIBN_PASSPOD_AUTH

if IsNEWCIBNPassPodAuth():

self.passpodBoard.Hide()

# NEWCIBN_PASSPOD_AUTH_END

 

self.serverBoard.SetPosition(self.xServerBoard, wndMgr.GetScreenHeight())

self.serverBoard.Hide()

 

if self.virtualKeyboard:

self.virtualKeyboard.Show()

 

if app.loggined:

self.Connect(self.id, self.pwd)

self.connectBoard.Hide()

self.loginBoard.Hide()

elif not self.stream.isAutoLogin:

self.connectBoard.Show()

self.loginBoard.Show()

 

## if users have the login infomation, then don't initialize.2005.9 haho

if self.idEditLine == None:

self.idEditLine.SetText("")

if self.pwdEditLine == None:

self.pwdEditLine.SetText("")

 

self.idEditLine.SetFocus()

 

global SKIP_LOGIN_PHASE

if SKIP_LOGIN_PHASE:

if not self.loginInfo:

self.connectBoard.Hide()

 

def __OnSelectRegionGroup(self):

self.__RefreshServerList()

 

def __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=self.__GetRegionID()

serverID=self.__GetServerID()

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.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()

 

 

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

 

net.ACCOUNT_ID = id

net.ACCOUNT_PW = pwd

 

self.Connect(id, pwd)

 

def SameLogin_OpenUI(self):

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_SAMELOGIN, 0, localeInfo.UI_OK)

 

 

 

 

 

Agora ainda no root criam um novo ficheiro chamado: logininfo.py, e metem dentro o seguinte código

 

 

 

import app

import wndMgr

import systemSetting

import mouseModule

import grp

import uiScriptLocale

import ui

import localeInfo

import net

import background

import uiPhaseCurtain

import time

import effect

import playerSettingModule

import wndMgr

import textTail

import chrmgr

import chr

import player

import uiAffectShower

import uiTarget

import constInfo

import uiCharacter

import emotion

import interfaceModule

import uiPrivateShopBuilder

import item

import uiCommon

import skill

import uiPlayerGauge

chrmgr.CreateRace(0)

chrmgr.SelectRace(0)

chrmgr.SetPathName("d:/ymir Work/pc/warrior/")

chrmgr.LoadLocalRaceData("warrior_m.msm")

chrmgr.SetPathName("d:/ymir work/pc/warrior/general/")

chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, "run.msa")

 

app.SetCamera(604.0, 0.0, 0.0, 17976.0)

wndMgr.SetOutlineFlag(0)

class TestGame(ui.ScriptWindow):

def __init__(self):

ui.ScriptWindow.__init__(self, "GAME")

self.SetWindowName("game")

net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)

player.SetGameWindow(self)

skill.LoadSkillData()

playerSettingModule.LoadGameData("INIT")

playerSettingModule.LoadGameData("SOUND")

playerSettingModule.LoadGameData("EFFECT")

playerSettingModule.LoadGameData("WARRIOR")

playerSettingModule.LoadGameData("ASSASSIN")

playerSettingModule.LoadGameData("WARRIOR")

playerSettingModule.LoadGameData("SURA")

playerSettingModule.LoadGameData("SHAMAN")

playerSettingModule.LoadGameData("SKILL")

playerSettingModule.LoadGameData("ENEMY")

playerSettingModule.LoadGameData("NPC")

playerSettingModule.isInitData=0

# playerSettingModule.RegisterSkill(0,1)

# playerSettingModule.__LoadGameSkill()

# playerSettingModule.__LoadGameEnemy()

self.curtain = uiPhaseCurtain.PhaseCurtain()

self.curtain.speed = 0.03

self.curtain.Hide()

emotion.EMOTION_VERSION=2

emotion.RegisterEmotionIcons()

self.stf= uiCharacter.CharacterWindow()

 

self.stf.state = "STATUS"

self.stf.isLoaded = 0

self.stf.toolTipSkill = 1

self.stf.SHOW_ONLY_ACTIVE_SKILL=FALSE

self.stf.refreshToolTip = 1

self.stf.curSelectedSkillGroup = 1

self.stf.canUseHorseSkill = 0

self.stf.emotionToolTip = 1

self.stf.soloEmotionSlot = 1

self.stf.dualEmotionSlot = 1

self.stf.toolTip = "dd"

self.stf.toolTipJob = 1

self.stf.toolTipAlignment = "1233"

self.stf.toolTipSkill = "123"

self.quickSlotPageIndex = 0

self.PickingCharacterIndex = -1

self.PickingItemIndex = -1

self.pressNumber = None

self.playerGauge = None

self.playerGauge = uiPlayerGauge.PlayerGauge(self)

self.playerGauge.Hide()

self.consoleEnable = FALSE

self.isShowDebugInfo = FALSE

self.ShowNameFlag = FALSE

self.enableXMasBoom = FALSE

self.startTimeXMasBoom = 0.0

self.indexXMasBoom = 0

 

x = 41300

y = 39900

localeInfo.LoadLocaleData()

self.interface = interfaceModule.Interface()

self.interface.MakeInterface()

self.interface.ShowDefaultWindows()

self.AffectShower = uiAffectShower.AffectShower()

self.AffectShower.Show()

self.targetBoard = uiTarget.TargetBoard()

self.targetBoard.SetWhisperEvent(ui.__mem_func__(self.interface.OpenWhisperDialog))

self.targetBoard.Hide()

# self.SetAMob(x,y)

todo= "0#10,1#20,2#30,3#40,4#50"

yutom = []

self.dssd = {}

yutom.append(todo.split("#"))

ASD=todo.split("#")

for i in range(4):

YG=ASD

YB=ASD

self.dssd = ui.TextLine()

self.dssd.SetFontName(localeInfo.UI_DEF_FONT)

self.dssd.SetPosition(0, 15+i*13)

self.dssd.SetWindowHorizontalAlignCenter()

self.dssd.SetHorizontalAlignCenter()

self.dssd.SetFeather()

self.dssd.SetOutline()

self.dssd.SetText("RES:"+YG+"||"+YB)

self.dssd.Show()

self.Exit = ui.Button()

self.Exit.SetPosition(215,0)

self.Exit.SetText("Cerrar")

self.Exit.SetEvent(self.Kala)

self.Exit.SetUpVisual("d:/ymir work/ui/game/windows/skill_tab_button_01.sub")

self.Exit.SetOverVisual("d:/ymir work/ui/game/windows/skill_tab_button_02.sub")

self.Exit.SetDownVisual("d:/ymir work/ui/game/windows/skill_tab_button_03.sub")

self.Exit.Show()

self.Exi1t = ui.Button()

self.Exi1t.SetPosition(215,20)

self.Exi1t.SetText("GO")

self.Exi1t.SetEvent(self.Kala4)

self.Exi1t.SetUpVisual("d:/ymir work/ui/game/windows/skill_tab_button_01.sub")

self.Exi1t.SetOverVisual("d:/ymir work/ui/game/windows/skill_tab_button_02.sub")

self.Exi1t.SetDownVisual("d:/ymir work/ui/game/windows/skill_tab_button_03.sub")

self.Exi1t.Show()

self.__BuildKeyDict()

self.Pronob = ui.Board()

self.Pronob.SetPosition(15,10)

self.Pronob.SetSize(100,10)

self.Pronob.Show()

self.Faren = ui.TextLine()

self.Faren.SetParent(self.Pronob)

self.Faren.SetPosition(0,0)

self.Faren.SetText("100,10")

self.Faren.Show()

import uiToolTip

self.toolTip = uiToolTip.ToolTip()

self.toolTipJob = uiToolTip.ToolTip(130)

self.toolTipAlignment = uiToolTip.ToolTip(130)

# self.Exit2 = ui.ImageBox()

# self.Exit2.SetPosition(wndMgr.GetScreenWidth()-100, wndMgr.GetScreenHeight()-130)

# self.Exit2.LoadImage("localeInfo/es/silkroad/dsa.dds")

# self.Exit2.SAFE_SetStringEvent('MOUSE_OVER_IN', self.__ShowAlignmentToolTip)

# self.Exit2.SAFE_SetStringEvent('MOUSE_OVER_OUT', self.__HideAlignmentToolTip)

# self.Exit2.Show()

global gokuz

gokuz= player.GetTargetVID()

 

 

self.Cam()

self.wndGuildBuilding = None

player.SetItemData(0, 27001, 999)

player.SetItemData(1, 27004, 999)

player.SetItemData(2, 71014, 999)

player.SetItemData(3, 50053, 999)

player.SetItemData(4, 50404, 999)

player.SetItemData(5, 9501, 1)

background.Initialize()

background.LoadMap("metin2_map_c1", x, y, 0)

self.MakeCharacter(1, 0, 42200, 40200)

player.SetMainCharacterIndex(1)

chr.SelectInstance(1)

self.SetOneNPC(9001, "arms", 41500, 39600)

# self.SetOneNPC2()

self.SetGuard(20343, "jinno_patrol_spear", x ,y)

self.SetMovingNPC(20354, "guard_leader", 40600 , 38600)

# self.SetMob1(1335, "bumble", 40600 , 38600)

# Use(0 or 1 or 2 or.., "msm file",0, "pc/warrior-assasin", hair, armor, chr.MOTION_WAIT, X, Y)

self.SetGhostPC(7,"sura",7,27,3009,chr.MOTION_WAIT,43700,40100)

self.SetGhostPC(9,"sura",9,30,3009,chr.MOTION_WAIT,43600,40100)

self.SetGhostPC(10,"sura",10,2,3009,chr.MOTION_WAIT,43500,40100)

self.SetGhostPC(11,"sura",11,3,3008,chr.MOTION_WAIT,43400,40100)

self.SetGhostPC(12,"sura",12,27,3009,chr.MOTION_WAIT,43300,40100)

self.SetGhostPC(13,"sura",13,27,3009,chr.MOTION_WAIT,43200,40100)

self.SetGhostPC(14,"sura",14,27,3009,chr.MOTION_WAIT,43100,40100)

self.SetGhostPC(15,"sura",15,27,3009,chr.MOTION_WAIT,43000,40100)

self.SetGhostPC(16,"sura",16,27,3009,chr.MOTION_WAIT,42900,40100)

self.SetGhostPC(17,"sura",17,27,3009,chr.MOTION_WAIT,42800,40100)

self.SetGhostPC(18,"sura",18,27,3009,chr.MOTION_WAIT,42700,40100)

self.SetGhostPC(19,"sura",19,27,3009,chr.MOTION_WAIT,42600,40100)

self.SetGhostPC(20,"sura",20,27,3009,chr.MOTION_WAIT,42500,40100)

self.SetGhostPC(21,"sura",21,27,3009,chr.MOTION_WAIT,42400,40100)

self.SetGhostPC(22,"sura",22,27,3009,chr.MOTION_WAIT,42300,40100)

self.SetGhostPC(23,"sura",23,27,3009,chr.MOTION_WAIT,42200,40100)

self.SetGhostPC(7,"warrior",7,11901,1010,chr.MOTION_WAIT,42100,40100)

self.SetGhostPC(8,"warrior",8,9,1009,chr.MOTION_MODE_GENERAL,43800,40100)

# self.escribir()

self.interface.RefreshSkill()

self.interface.RefreshStatus()

self.interface.RefreshStamina()

self.playerGauge.RefreshGauge()

self.interface.CheckGameButton()

self.interface.RefreshInventory()

# self.interface.RefreshCharacter()

def Cam(self):

app.SetCamera(604.0, 0.0, 0.0, 17976.0)

def Kala4(self):

chrmgr.SetEmoticon(-3,int(6))

chrmgr.SetAffect(-3,-3,2)

chr.SelectInstance(1)

chr.ChangeShape(1)

# chr.PushOnceMotion(chr.MOTION_SKILL+5)

# chr.PushOnceMotion(chr.MOTION_STAND_UP)

chr.PushOnceMotion(chr.MOTION_SKILL+5)

# chr.SetMotionMode(chr.MOTION_MODE_BOW)

def SaveScreen(self):

# EmoticonStr = "d:/ymir work/effect/etc/emoticon/"

# chrmgr.RegisterEffect(chrmgr.EFFECT_EMOTICON+0, "", EmoticonStr+"sweat.mse")

# net.RegisterEmoticonString("(Ȳ´ç)")

print "save screen"

import os

SCREENSHOT_CWDSAVE = TRUE

# SCREENSHOT_CWDSAVE

if SCREENSHOT_CWDSAVE:

if not os.path.exists(os.getcwd()+os.sep+"inver"):

os.mkdir(os.getcwd()+os.sep+"inver")

 

(succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"inver"+os.sep)

else:

(succeeded, name) = grp.SaveScreenShot()

# END_OF_SCREENSHOT_CWDSAVE

 

if succeeded:

pass

""

chat.AppendChat(chat.CHAT_TYPE_INFO, 'Captura de pantalla guardada en '+ name)

snd.PlaySound("sound/pc/warrior/skill/gyeokgong.wav")

""

else:

chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE_FAILURE)

snd.PlaySound("sound/pc/warrior/skill/daejin.wav")

 

def __ShowAlignmentToolTip(self):

self.toolTipAlignment.ClearToolTip()

import colorInfo

self.toolTipAlignment.SetSize(130, 50)

self.toolTipAlignment.SetDefaultFontName("TAHOMA")

self.toolTipAlignment.AutoAppendTextLine(".Troll Works Global.")#,0xffA6FF00)

self.toolTipAlignment.AutoAppendTextLine("Water Mark")#,0xff555555)

self.toolTipAlignment.ShowToolTip()

 

def __SetQuickSlotMode(self):

self.pressNumber=ui.__mem_func__(self.__PressQuickSlot)

 

def __SetQuickPageMode(self):

self.pressNumber=ui.__mem_func__(self.__SelectQuickPage)

 

def __PressQuickSlot(self, localSlotIndex):

player.RequestUseLocalQuickSlot(localSlotIndex)

 

def __SelectQuickPage(self, pageIndex):

self.quickSlotPageIndex = pageIndex

player.SetQuickPage(pageIndex)

def __HideAlignmentToolTip(self):

self.toolTipAlignment.HideToolTip()

 

# def escribir(self):

# import net

# import os

# name = "Test"

# if os.path.exists('msg'):

# f = open(os.getcwd()+os.sep+'msg\\' + name+'.lib', 'a')

# else:

# f = open(os.getcwd()+os.sep+os.mkdir('msg') + name+'.lib', 'a')

 

# f.write((str(time.strftime("[%Y-%m-%d %H:%M:%S]"))\

# + '///' + str("lolo") + '///' + str("ukik") + '///' + str("lolo")\

# + ' : ' + str("text") + '///' + str(net.GetServerInfo().split(',')[0]))+"\n")

 

# f.close()

def __del__(self):

ui.ScriptWindow.__del__(self)

 

def Kala(self):

import sys

sys.exit()

 

def SetOneNPC(self, race, name, x, y):

chrmgr.CreateRace(race)

chrmgr.SelectRace(race)

 

## RESERVED

chrmgr.SetPathName("d:/ymir work/npc/" + name + "/")

chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")

chrmgr.LoadRaceData(name + ".msm")

self.MakeCharacter2(5, race, x, y)

def SetOneNPC2(self):

chrmgr.CreateRace(25)

chrmgr.SelectRace(25)

 

## RESERVED

chrmgr.SetPathName("d:/ymir work/npc2/marauder/")

chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")

chrmgr.LoadRaceData("marauder.msm")

self.MakeCharacter2(6, 25, 41500, 38600)

def SetGhostPC(self, index, name, race, armorid, hairid, motion, x, y):

chrmgr.CreateRace(race)

chrmgr.SelectRace(race)

 

## RESERVED

chrmgr.SetPathName("d:/ymir Work/pc2/" + name + "/")

chrmgr.LoadLocalRaceData(name+"_w.msm")

chrmgr.SetPathName("d:/ymir work/pc2/" + name + "/intro/")

chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")

chrmgr.SetPathName("d:/ymir work/pc2/" + name + "/general/")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, "run.msa")

self.CreateGhost(index, race, armorid, hairid, motion, x, y)

def SetMob1(self, race, name, x, y):

chrmgr.CreateRace(race)

chrmgr.SelectRace(race)

 

## RESERVED

chrmgr.SetPathName("d:/ymir work/npc2/" + name + "/")

chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WALK, "walk.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, "run.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD, "die.msa")

 

chrmgr.LoadRaceData(name + ".msm")

self.MakeCharacter2(4, race, x, y)

def SetMob2(self, race, name, x, y):

chrmgr.CreateRace(race)

chrmgr.SelectRace(race)

 

## RESERVED

chrmgr.SetPathName("d:/ymir work/monster2/" + name + "/")

chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait00.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WALK, "walk.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, "run.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD, "die.msa")

 

chrmgr.LoadRaceData(name + ".msm")

self.MakeCharacter2(4, race, x, y)

def SetAMob(self,zx,zy):

chrmgr.CreateRace(2011)

chrmgr.SelectRace(2011)

 

## RESERVED

chrmgr.SetPathName("d:/ymir work/monster2/zombie_bigboss2/")

chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait00.msa")

chrmgr.LoadRaceData("zombie_bigboss2.msm")

self.MakeCharacter21(2011, 2011, zx, zy)

def MakeCharacter21(self, index, race, x, y):

chr.CreateInstance(index)

chr.SelectInstance(index)

chr.SetVirtualID(index)

chr.SetInstanceType(chr.INSTANCE_TYPE_PLAYER)

chr.SetRace(race)

chr.SetArmor(0)

chr.SetHair(0)

chr.Refresh()

chr.SetMotionMode(chr.MOTION_MODE_GENERAL)

chr.SetLoopMotion(chr.MOTION_WAIT)

 

chr.SetPixelPosition(x, y)

chr.SetDirection(chr.DIR_WEST)

def SetMovingNPC(self, race, name, x, y):

chrmgr.CreateRace(race)

chrmgr.SelectRace(race)

 

## RESERVED

chrmgr.SetPathName("d:/ymir work/npc/" + name + "/")

chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WALK, "walk.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, "run.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD, "die.msa")

 

chrmgr.LoadRaceData(name + ".msm")

self.MakeCharacter2(4, race, x, y)

def SetGuard(self, value1, name, x, y):

chrmgr.CreateRace(value1)

chrmgr.SelectRace(value1)

 

## Script Data

chrmgr.SetPathName("d:/ymir work/npc/" + name + "/")

chrmgr.LoadRaceData(name + ".msm")

 

## GENERAL

chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_SPAWN, "00.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "00.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, "03.msa")

 

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE, "30.msa", 50)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE, "30_1.msa", 50)

 

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE_BACK, "34.msa", 50)

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE_BACK, "34_1.msa", 50)

 

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE_FLYING,"32.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_STAND_UP, "33.msa")

 

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DAMAGE_FLYING_BACK, "35.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_STAND_UP_BACK, "36.msa")

 

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD, "31.msa")

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_DEAD_BACK, "37.msa")

 

chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_NORMAL_ATTACK, "20.msa")

 

## Attacking Data

chrmgr.RegisterNormalAttack(chr.MOTION_MODE_GENERAL, chr.MOTION_NORMAL_ATTACK)

self.MakeCharacter2(2, value1, x, y)

def MakeCharacter(self, index, race, x, y):

chr.CreateInstance(index)

chr.SelectInstance(index)

chr.SetVirtualID(index)

 

chr.SetInstanceType(chr.INSTANCE_TYPE_PLAYER)

chr.SetRace(race)

chr.SetArmor(11299)

chr.SetHair(1010)

chr.SetWeapon(169)

chr.testSetComboType(1)

chr.Refresh()

chr.SetMotionMode(chr.MOTION_MODE_GENERAL)

chr.SetLoopMotion(chr.MOTION_WAIT)

 

chr.SetPixelPosition(x, y)

chr.SetDirection(chr.DIR_NORTH)

def MakeCharacter2(self, index, race, x, y):

chr.CreateInstance(index)

chr.SelectInstance(index)

chr.SetVirtualID(index)

 

chr.SetInstanceType(chr.INSTANCE_TYPE_PLAYER)

chr.SetRace(race)

chr.SetArmor(0)

chr.SetHair(0)

chr.Refresh()

chr.SetMotionMode(chr.MOTION_MODE_GENERAL)

chr.SetLoopMotion(chr.MOTION_WAIT)

 

chr.SetPixelPosition(x, y)

chr.SetDirection(chr.DIR_WEST)

def CreateGhost(self, index, race, armorid, hairid, motion, x, y):

chr.CreateInstance(index)

chr.SelectInstance(index)

chr.SetVirtualID(index)

 

chr.SetInstanceType(chr.INSTANCE_TYPE_PLAYER)

chr.SetRace(race)

chr.SetArmor(armorid)

chr.SetHair(hairid)

chr.Refresh()

chr.SetMotionMode(chr.MOTION_MODE_GENERAL)

chr.SetLoopMotion(motion)

 

chr.SetPixelPosition(x, y)

chr.SetDirection(chr.DIR_SOUTH)

# chr.SetDirection(chr.DIR_WEST)

 

def OnMouseLeftButtonDown(self):

 

if self.interface.BUILD_OnMouseLeftButtonDown():

return

 

self.CheckFocus()

 

if FALSE == mouseModule.mouseController.isAttached():

player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);

 

return TRUE

 

def OnMouseLeftButtonUp(self):

import game

if self.interface.BUILD_OnMouseLeftButtonUp():

return

 

if TRUE == mouseModule.mouseController.isAttached():

 

attachedType = mouseModule.mouseController.GetAttachedType()

attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()

attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()

attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()

 

## QuickSlot

if player.SLOT_TYPE_QUICK_SLOT == attachedType:

player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)

 

## Inventory

elif player.SLOT_TYPE_INVENTORY == attachedType:

 

if player.ITEM_MONEY == attachedItemIndex:

self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)

else:

self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)

 

mouseModule.mouseController.DeattachObject()

 

else:

player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)

 

#player.EndMouseWalking()

return TRUE

def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):

if TRUE == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:

if player.IsEquipmentSlot(attachedItemSlotPos):

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)

else:

if chr.IsNPC(dstChrID):

net.SendGiveItemPacket(dstChrID, attachedItemSlotPos, attachedItemCount)

else:

net.SendExchangeStartPacket(dstChrID)

net.SendExchangeItemAddPacket(attachedItemSlotPos, 0)

else:

self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)

 

def __PutMoney(self, attachedType, attachedMoney, dstChrID):

if TRUE == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:

net.SendExchangeStartPacket(dstChrID)

net.SendExchangeElkAddPacket(attachedMoney)

else:

self.__DropMoney(attachedType, attachedMoney)

 

def __DropMoney(self, attachedType, attachedMoney):

# PRIVATESHOP_DISABLE_ITEM_DROP - ???? ?? ?? ?? ??? ?? ??

if uiPrivateShopBuilder.IsBuildingPrivateShop():

chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)

return

# END_OF_PRIVATESHOP_DISABLE_ITEM_DROP

 

if attachedMoney>=1000:

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(localeInfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeInfo.UI_OK)

return

 

itemDropQuestionDialog = uiCommon.QuestionDialog()

itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_MONEY % (attachedMoney))

itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))

itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))

itemDropQuestionDialog.Open()

itemDropQuestionDialog.dropType = attachedType

itemDropQuestionDialog.dropCount = attachedMoney

itemDropQuestionDialog.dropNumber = player.ITEM_MONEY

self.itemDropQuestionDialog = itemDropQuestionDialog

 

def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):

# PRIVATESHOP_DISABLE_ITEM_DROP - ???? ?? ?? ?? ??? ?? ??

if uiPrivateShopBuilder.IsBuildingPrivateShop():

chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)

return

# END_OF_PRIVATESHOP_DISABLE_ITEM_DROP

 

if player.IsEquipmentSlot(attachedItemSlotPos):

self.stream.popupWindow.Close()

self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)

 

else:

dropItemIndex = player.GetItemIndex(attachedItemSlotPos)

 

item.SelectItem(dropItemIndex)

dropItemName = item.GetItemName()

 

## Question Text

questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)

 

## Dialog

itemDropQuestionDialog = uiCommon.QuestionDialog()

itemDropQuestionDialog.SetText(questionText)

itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))

itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))

itemDropQuestionDialog.Open()

itemDropQuestionDialog.dropType = attachedType

itemDropQuestionDialog.dropNumber = attachedItemSlotPos

itemDropQuestionDialog.dropCount = attachedItemCount

self.itemDropQuestionDialog = itemDropQuestionDialog

 

def RequestDropItem(self, answer):

 

if not self.itemDropQuestionDialog:

return

 

if answer:

dropType = self.itemDropQuestionDialog.dropType

dropCount = self.itemDropQuestionDialog.dropCount

dropNumber = self.itemDropQuestionDialog.dropNumber

 

if player.SLOT_TYPE_INVENTORY == dropType:

 

if dropNumber == player.ITEM_MONEY:

net.SendGoldDropPacketNew(dropCount)

snd.PlaySound("sound/ui/money.wav")

 

else:

# PRIVATESHOP_DISABLE_ITEM_DROP

self.__SendDropItemPacket(dropNumber, dropCount)

# END_OF_PRIVATESHOP_DISABLE_ITEM_DROP

 

self.itemDropQuestionDialog.Close()

self.itemDropQuestionDialog = None

 

# PRIVATESHOP_DISABLE_ITEM_DROP

def __SendDropItemPacket(self, itemVNum, itemCount):

if uiPrivateShopBuilder.IsBuildingPrivateShop():

chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)

return

 

def OnMouseRightButtonDown(self):

player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS);

return TRUE

 

def OnMouseRightButtonDown(self):

 

self.CheckFocus()

 

if TRUE == mouseModule.mouseController.isAttached():

mouseModule.mouseController.DeattachObject()

 

else:

player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)

 

return TRUE

 

def OnMouseRightButtonUp(self):

if TRUE == mouseModule.mouseController.isAttached():

return TRUE

 

player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)

return TRUE

 

 

def OnMouseMiddleButtonDown(self):

player.SetMouseMiddleButtonState(player.MBS_PRESS)

 

def OnMouseMiddleButtonUp(self):

player.SetMouseMiddleButtonState(player.MBS_CLICK)

def CheckFocus(self):

if FALSE == self.IsFocus():

if TRUE == self.interface.IsOpenChat():

self.interface.ToggleChat()

 

self.SetFocus()

def OnUpdate(self):

global gokuz

if gokuz != player.GetTargetVID() and player.GetTargetVID() :

gokuz=player.GetTargetVID()

# vid = player.GetTargetVID()

# if 0 == vid or vid == player.GetMainCharacterIndex() or chr.IsNPC(vid) or chr.IsEnemy(vid):

# import chat

# chat.AppendChat(chat.CHAT_TYPE_INFO, 'Selecciona un objetivo')

# return

app.UpdateGame()

# self.Movetime = 1

# Curtime = app.GetTime() - self.Movetime % (1)

# if Curtime < 2.5:

# self.Exit2.Show()

# elif Curtime<2.9:

# self.Exit2.Hide()

def __BuildKeyDict(self):

onPressKeyDict = {}

onPressKeyDict[app.DIK_1] = lambda : self.__PressNumKey(1)

onPressKeyDict[app.DIK_2] = lambda : self.__PressNumKey(2)

onPressKeyDict[app.DIK_3] = lambda : self.__PressNumKey(3)

onPressKeyDict[app.DIK_4] = lambda : self.__PressNumKey(4)

onPressKeyDict[app.DIK_5] = lambda : self.__PressNumKey(5)

onPressKeyDict[app.DIK_6] = lambda : self.__PressNumKey(6)

onPressKeyDict[app.DIK_7] = lambda : self.__PressNumKey(7)

onPressKeyDict[app.DIK_8] = lambda : self.__PressNumKey(8)

onPressKeyDict[app.DIK_9] = lambda : self.__PressNumKey(9)

 

onPressKeyDict[app.DIK_LALT] = lambda : self.ShowName()

onPressKeyDict[app.DIK_SYSRQ] = lambda : self.SaveScreen()

onPressKeyDict[app.DIK_SPACE] = lambda : self.StartAttack()

 

#??? ???

onPressKeyDict[app.DIK_UP] = lambda : self.MoveUp()

onPressKeyDict[app.DIK_DOWN] = lambda : self.MoveDown()

onPressKeyDict[app.DIK_LEFT] = lambda : self.MoveLeft()

onPressKeyDict[app.DIK_RIGHT] = lambda : self.MoveRight()

onPressKeyDict[app.DIK_W] = lambda : self.MoveUp()

onPressKeyDict[app.DIK_S] = lambda : self.MoveDown()

onPressKeyDict[app.DIK_A] = lambda : self.MoveLeft()

onPressKeyDict[app.DIK_D] = lambda : self.MoveRight()

onPressKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)

onPressKeyDict[app.DIK_G] = lambda: app.PitchCamera(app.CAMERA_TO_POSITIVE)

onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)

onPressKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_TO_NEGATIVE)

onPressKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)

onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)

#onPressKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)

onPressKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)

 

onPressKeyDict[app.DIK_NUMPAD9] = lambda: app.MovieResetCamera()

onPressKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)

onPressKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)

onPressKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)

onPressKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)

onPressKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)

onPressKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)

onPressKeyDict[app.DIK_C] = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)

onPressKeyDict[app.DIK_V] = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)

#onPressKeyDict[app.DIK_B] = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)

onPressKeyDict[app.DIK_N] = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)

onPressKeyDict[app.DIK_I] = lambda : self.interface.ToggleInventoryWindow()

onPressKeyDict[app.DIK_M] = lambda : self.interface.PressMKey()

#onPressKeyDict[app.DIK_H] = lambda : self.interface.OpenHelpWindow()

onPressKeyDict[app.DIK_ADD] = lambda : self.interface.MiniMapScaleUp()

onPressKeyDict[app.DIK_SUBTRACT] = lambda : self.interface.MiniMapScaleDown()

onPressKeyDict[app.DIK_L] = lambda : self.interface.ToggleChatLogWindow()

 

# CUBE_TEST

#onPressKeyDict[app.DIK_K] = lambda : self.interface.OpenCubeWindow()

# CUBE_TEST_END

 

self.onPressKeyDict = onPressKeyDict

 

onClickKeyDict = {}

onClickKeyDict[app.DIK_UP] = lambda : self.StopUp()

onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown()

onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft()

onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight()

onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack()

 

onClickKeyDict[app.DIK_W] = lambda : self.StopUp()

onClickKeyDict[app.DIK_S] = lambda : self.StopDown()

onClickKeyDict[app.DIK_A] = lambda : self.StopLeft()

onClickKeyDict[app.DIK_D] = lambda : self.StopRight()

onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_G] = lambda: app.PitchCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)

onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)

#if constInfo.PVPMODE_ACCELKEY_ENABLE:

# onClickKeyDict[app.DIK_B] = lambda: self.ChangePKMode()

 

self.onClickKeyDict=onClickKeyDict

 

def __PressNumKey(self,num):

if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):

 

if num >= 1 and num <= 9:

if(chrmgr.IsPossibleEmoticon(-1)):

chrmgr.SetEmoticon(-1,int(num)-1)

net.SendEmoticon(int(num)-1)

else:

if num >= 1 and num <= 4:

self.pressNumber(num-1)

def StartAttack(self):

player.SetAttackKeyState(TRUE)

 

def EndAttack(self):

player.SetAttackKeyState(FALSE)

 

def MoveUp(self):

player.SetSingleDIKKeyState(app.DIK_UP, TRUE)

 

def MoveDown(self):

player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)

 

def MoveLeft(self):

player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)

 

def MoveRight(self):

player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)

 

def StopUp(self):

player.SetSingleDIKKeyState(app.DIK_UP, FALSE)

 

def StopDown(self):

player.SetSingleDIKKeyState(app.DIK_DOWN, FALSE)

 

def StopLeft(self):

player.SetSingleDIKKeyState(app.DIK_LEFT, FALSE)

 

def StopRight(self):

player.SetSingleDIKKeyState(app.DIK_RIGHT, FALSE)

 

def PickUpItem(self):

player.PickCloseItem()

 

###############################################################################################

###############################################################################################

## Event Handler

 

def OnKeyDown(self, key):

if self.interface.wndWeb and self.interface.wndWeb.IsShow():

return

try:

self.onPressKeyDict[key]()

except KeyError:

pass

except:

raise

 

return TRUE

 

def OnKeyUp(self, key):

try:

self.onClickKeyDict[key]()

except KeyError:

pass

except:

raise

 

return TRUE

# def OnKeyDown(self, key):

# if key==17 or key==200:

# player.SetSingleDIKKeyState(app.DIK_UP, TRUE)

# if key==30 or key==203:

# player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)

# if key==31 or key==208:

# player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)

# if key==32 or key==205:

# player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)

# def OnKeyUp(self, key):

# if key==17 or key==200:

# player.SetSingleDIKKeyState(app.DIK_UP, FALSE)

# if key==30 or key==203:

# player.SetSingleDIKKeyState(app.DIK_LEFT, FALSE)

# if key==31 or key==208:

# player.SetSingleDIKKeyState(app.DIK_DOWN, FALSE)

# if key==32 or key==205:

# player.SetSingleDIKKeyState(app.DIK_RIGHT, FALSE)

def ShowName(self):

self.ShowNameFlag = TRUE

self.playerGauge.EnableShowAlways()

player.SetQuickPage(self.quickSlotPageIndex+1)

 

# ADD_ALWAYS_SHOW_NAME

def __IsShowName(self):

 

if systemSetting.IsAlwaysShowName():

return TRUE

 

if self.ShowNameFlag:

return TRUE

 

return FALSE

# END_OF_ADD_ALWAYS_SHOW_NAME

 

def HideName(self):

self.ShowNameFlag = FALSE

self.playerGauge.DisableShowAlways()

player.SetQuickPage(self.quickSlotPageIndex)

def OnRender(self):

(x, y) = app.GetCursorPosition()

app.RenderGame()

grp.PopState()

chr.Deform()

chr.Render()

grp.PopState()

grp.SetInterfaceRenderState()

grp.ClearDepthBuffer()

# grp.SetGameRenderState()

grp.PushState()

grp.SetOmniLight()

background.SetShadowLevel(background.SHADOW_ALL)

background.SetVisiblePart(background.PART_TERRAIN,1)

background.SetVisiblePart(background.PART_OBJECT,1)

background.SetVisiblePart(background.PART_CLOUD,1)

background.SetVisiblePart(background.PART_TREE,1)

background.SetVisiblePart(background.PART_WATER,1)

background.SetVisiblePart(background.PART_SKY,1)

background.SetRenderSort(background.DISTANCE_SORT)

background.SetRenderSort(background.TEXTURE_SORT)

app.EnablePerformanceTime(15, 1)

# background.RegisterEnvironmentData(0, constInfo.ENVIRONMENT_NIGHT)

# background.RegisterEnvironmentData(0, "d:/ymir work/estudio_foto.msenv")

background.SetEnvironmentData(0)

self.curtain.FadeIn()

textTail.UpdateAllTextTail()

 

if TRUE == wndMgr.IsPickedWindow(self.hWnd):

 

self.PickingCharacterIndex = chr.Pick()

 

if -1 != self.PickingCharacterIndex:

textTail.ShowCharacterTextTail(self.PickingCharacterIndex)

if 0 != self.targetBoard.GetTargetVID():

textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())

 

# ADD_ALWAYS_SHOW_NAME

if not self.__IsShowName():

self.PickingItemIndex = item.Pick()

if -1 != self.PickingItemIndex:

textTail.ShowItemTextTail(self.PickingItemIndex)

# END_OF_ADD_ALWAYS_SHOW_NAME

 

## Show all name in the range

 

# ADD_ALWAYS_SHOW_NAME

if self.__IsShowName():

textTail.ShowAllTextTail()

self.PickingItemIndex = textTail.Pick(x, y)

# END_OF_ADD_ALWAYS_SHOW_NAME

 

textTail.UpdateShowingTextTail()

textTail.ArrangeTextTail()

if -1 != self.PickingItemIndex:

textTail.SelectItemName(self.PickingItemIndex)

 

grp.PopState()

grp.SetInterfaceRenderState()

 

textTail.Render()

textTail.HideAllTextTail()

 

 

 

# import ui

# import chr

FILE_NAME_LEN = 40

class Item(ui.ListBoxEx.Item):

def __init__(self, fileName):

ui.ListBoxEx.Item.__init__(self)

self.canLoad=0

self.text=fileName

self.textLine=self.__CreateTextLine(fileName[:FILE_NAME_LEN])

 

def __del__(self):

ui.ListBoxEx.Item.__del__(self)

 

def GetText(self):

return self.text

 

def SetSize(self, width, height):

ui.ListBoxEx.Item.SetSize(self, 6*len(self.textLine.GetText()) + 4, height)

 

def __CreateTextLine(self, fileName):

textLine=ui.TextLine()

textLine.SetParent(self)

textLine.SetPosition(0, 0)

textLine.SetText(fileName)

textLine.Show()

return textLine

class MapListDialog(ui.Window):

def __init__(self):

ui.Window.__init__(self)

self.isLoaded=0

self.selectEvent=None

self.fileListBox=None

 

self.Board = ui.BoardWithTitleBar()

self.Board.SetSize(240, 335)

self.Board.SetCenterPosition()

self.Board.AddFlag("movable")

self.Board.AddFlag("float")

self.Board.SetTitleName("Seleccionar mapa")

self.Board.SetCloseEvent(self.Close)

self.Board.Show()

 

def __del__(self):

ui.Window.__del__(self)

 

def Show(self):

if self.isLoaded==0:

self.isLoaded=1

 

self.__Load()

 

ui.Window.Show(self)

 

def Open(self):

self.Show()

 

self.SetCenterPosition()

self.SetTop()

self.UpdateFileList()

 

def Close(self):

self.Board.Hide()

self.XCoordinateValue = None

self.YCoordinateValue = None

return TRUE

 

def OnPressEscapeKey(self):

self.Close()

return TRUE

 

def __CreateFileListBox(self):

fileListBox = ui.ListBoxEx()

fileListBox.SetParent(self.Board)

fileListBox.SetSelectEvent(self.UpdateMapInfo)

fileListBox.SetPosition(15, 50)

fileListBox.Show()

return fileListBox

 

def __Load(self):

self.__Load_BindObject()

 

self.UpdateFileList()

 

def __Load_BindObject(self):

self.fileListBox = self.__CreateFileListBox()

self.LoadFuckingScrollBar()

self.LoadTextLines()

self.fileListBox.SetScrollBar(self.ScrollBar)

 

self.SelectMap = ui.Button()

self.SelectMap.SetParent(self.Board)

self.SelectMap.SetPosition(20, 295)

self.SelectMap.SetUpVisual("d:/ymir work/ui/public/Middle_Button_01.sub")

self.SelectMap.SetOverVisual("d:/ymir work/ui/public/Middle_Button_02.sub")

self.SelectMap.SetDownVisual("d:/ymir work/ui/public/Middle_Button_03.sub")

self.SelectMap.SetText("OK")

self.SelectMap.SetEvent(ui.__mem_func__(self.LoadMap))

self.SelectMap.Show()

 

self.CancelBonus = ui.Button()

self.CancelBonus.SetParent(self.Board)

self.CancelBonus.SetPosition(85, 295)

self.CancelBonus.SetUpVisual("d:/ymir work/ui/public/Middle_Button_01.sub")

self.CancelBonus.SetOverVisual("d:/ymir work/ui/public/Middle_Button_02.sub")

self.CancelBonus.SetDownVisual("d:/ymir work/ui/public/Middle_Button_03.sub")

self.CancelBonus.SetText("Cancelar")

self.CancelBonus.SetEvent(ui.__mem_func__(self.Close))

self.CancelBonus.Show()

 

self.Exit = ui.Button()

self.Exit.SetParent(self.Board)

self.Exit.SetPosition(150, 295)

self.Exit.SetUpVisual("d:/ymir work/ui/public/Middle_Button_01.sub")

self.Exit.SetOverVisual("d:/ymir work/ui/public/Middle_Button_02.sub")

self.Exit.SetDownVisual("d:/ymir work/ui/public/Middle_Button_03.sub")

self.Exit.SetText("salir")

self.Exit.SetEvent(ui.__mem_func__(self.exit))

self.Exit.Show()

 

self.XCoordinateSlotBar = ui.SlotBar()

self.XCoordinateSlotBar.SetParent(self.Board)

self.XCoordinateSlotBar.SetSize(85, 18)

self.XCoordinateSlotBar.SetPosition(15, 270)

self.XCoordinateSlotBar.Show()

 

self.XCoordinateValue = ui.EditLine()

self.XCoordinateValue.SetParent(self.XCoordinateSlotBar)

self.XCoordinateValue.SetSize(60, 17)

self.XCoordinateValue.SetPosition(5, 2)

self.XCoordinateValue.SetMax(4)

self.XCoordinateValue.SetText("0")

self.XCoordinateValue.SetNumberMode()

self.XCoordinateValue.Show()

 

self.YCoordinateSlotBar = ui.SlotBar()

self.YCoordinateSlotBar.SetParent(self.Board)

self.YCoordinateSlotBar.SetSize(85, 18)

self.YCoordinateSlotBar.SetPosition(110, 270)

self.YCoordinateSlotBar.Show()

 

self.YCoordinateValue = ui.EditLine()

self.YCoordinateValue.SetParent(self.YCoordinateSlotBar)

self.YCoordinateValue.SetSize(60, 17)

self.YCoordinateValue.SetPosition(5, 2)

self.YCoordinateValue.SetMax(4)

self.YCoordinateValue.SetText("0")

self.YCoordinateValue.SetNumberMode()

self.YCoordinateValue.Show()

def exit(self):

import sys

sys.exit()

def LoadTextLines(self):

self.Headline = ui.TextLine()

self.Headline.SetParent(self.Board)

self.Headline.SetDefaultFontName()

self.Headline.SetPosition(80, 29)

self.Headline.SetFeather()

self.Headline.SetText("Mapas atlantisinfo.txt:")

self.Headline.SetFontColor(0.2, 0.2, 1.0)

self.Headline.SetOutline()

self.Headline.Show()

 

self.XKoordinate = ui.TextLine()

self.XKoordinate.SetParent(self.Board)

self.XKoordinate.SetDefaultFontName()

self.XKoordinate.SetPosition(15, 250)

self.XKoordinate.SetFeather()

self.XKoordinate.SetText("X:")

self.XKoordinate.SetFontColor(0.6, 0.7, 1)

self.XKoordinate.SetOutline()

self.XKoordinate.Show()

 

self.YKoordinate = ui.TextLine()

self.YKoordinate.SetParent(self.Board)

self.YKoordinate.SetDefaultFontName()

self.YKoordinate.SetPosition(110, 250)

self.YKoordinate.SetFeather()

self.YKoordinate.SetText("Y")

self.YKoordinate.SetFontColor(0.6, 0.7, 1)

self.YKoordinate.SetOutline()

self.YKoordinate.Show()

 

def LoadFuckingScrollBar(self):

self.ScrollBar = ui.ScrollBar()

self.ScrollBar.SetParent(self.Board)

self.ScrollBar.SetPosition(210, 40)

self.ScrollBar.SetScrollBarSize(220)

self.ScrollBar.Show()

 

def UpdateMapInfo(self, name):

SelectedIndex = self.fileListBox.GetSelectedItem()

SelectedIndex = SelectedIndex.GetText()

 

lines = pack_open("atlasinfo.txt", "r").readlines()

for line in lines:

tokens = line[:-1].split("\t")

if str(SelectedIndex) == str(tokens[0]):

XKoordinate = int(int(tokens[3]) * 25500 / 2) / 100

YKoordinate = int(int(tokens[4]) * 25500 / 2) / 100

self.XCoordinateValue.SetText(str(XKoordinate))

self.YCoordinateValue.SetText(str(YKoordinate))

 

def UpdateFileList(self):

self.__RefreshFileList()

try:

lines = pack_open("atlasinfo.txt", "r").readlines()

except IOError:

 

app.Abort()

 

for line in lines:

tokens = line[:-1].split("\t")

if len(tokens) == 0 or not tokens[0]:

continue

 

mapname = str(tokens[0])

if mapname:

self.fileListBox.AppendItem(Item(mapname))

 

def __RefreshFileList(self):

self.fileListBox.RemoveAllItems()

 

def LoadMap(self):

import background

SelectedIndex = self.fileListBox.GetSelectedItem()

SelectedIndex = SelectedIndex.GetText()

XKoordinate = int(self.XCoordinateValue.GetText()) * 100

YKoordinate = int(self.YCoordinateValue.GetText()) * 100

background.LoadMap(str(SelectedIndex), XKoordinate, YKoordinate, 0)

chr.SetPixelPosition(int(XKoordinate), int(YKoordinate))

MapList = MapListDialog()

MapList.Show()

game = TestGame()

game.SetSize(systemSetting.GetWidth(), systemSetting.GetHeight())

game.Show()

app.Loop()

 

 

 

Link to comment
Share on other sites

  • 1 year later...

Só pra informação... ainda faltam coisas a ser anexadas, visto que o modo 'copy+paste' do tutorial dá erro no cliente ao executá-lo.. fora parte de tabulações e tal.. massssssssssssssss quem quiser dá pra se empenhar e usar o tutorial apenas como auxilio para desenvolver um script funcional

 

 

Hidden Content

    Give reaction to this post to see the hidden content.

Link to comment
Share on other sites

18 horas atrás, Valenza disse:

Só pra informação... ainda faltam coisas a ser anexadas, visto que o modo 'copy+paste' do tutorial dá erro no cliente ao executá-lo.. fora parte de tabulações e tal.. massssssssssssssss quem quiser dá pra se empenhar e usar o tutorial apenas como auxilio para desenvolver um script funcional

 

 

Hidden Content

    Give reaction to this post to see the hidden content.

O código apresentado no tópico não está errado e nem falta nenhum ficheiro de anexo, isso são erros de indentações, o erro é que por alguma razão o BB code formatou o código, mas para meter o código a funcionar novamente é so organizar o código com as tabulações como deve ser

Edited by No0ne
Link to comment
Share on other sites

Em 01/03/2018 em 15:23, No0ne disse:

O código apresentado no tópico não está errado e nem falta nenhum ficheiro de anexo, isso são erros de indentações, o erro é que por alguma razão o BB code formatou o código, mas para meter o código a funcionar novamente é so organizar o código com as tabulações como deve ser

Compreendi... tu teria o arquivo para sacar direto? visto que são diversas linhas em ambos os arquivos e demoraria um bom tempo para corrigir as tabulações..

Link to comment
Share on other sites

17 minutos atrás, Valenza disse:

Compreendi... tu teria o arquivo para sacar direto? visto que são diversas linhas em ambos os arquivos e demoraria um bom tempo para corrigir as tabulações..

 

Aqui tens o logininfo, tenta o usar sem o outro.


Hidden Content

    Give reaction to this post to see the hidden content.

 

 

Link to comment
Share on other sites

6 minutos atrás, webnull disse:

 

Aqui tens o logininfo, tenta o usar sem o outro.


Hidden Content

    Give reaction to this post to see the hidden content.

 

 

Grato, mas ainda pede os dados  para poder acessar... de qualquer forma deu um adianto no arquivo , visto que neste tópico ainda teria que organizar tabulação do logininfo...

 

Link to comment
Share on other sites

Tenta usar este código no intrologin.py a ver se assim já funciona .

Procura por:

Hidden Content

    Give reaction to this post to see the hidden content.

E depois de:

Hidden Content

    Give reaction to this post to see the hidden content.

Metes isto:

Hidden Content

    Give reaction to this post to see the hidden content.

 

Tens aqui outro logininfo caso não funcione com o primeiro.


Hidden Content

    Give reaction to this post to see the hidden content.

 

Para mudares de mapa edita:

Hidden Content

    Give reaction to this post to see the hidden content.

 

Edited by webnull
Link to comment
Share on other sites

4 minutos atrás, webnull disse:

Tenta usar este código no intrologin.py a ver se assim já funciona . Se não der sem login mete um qualquer e vê se funciona. 

(Mete debaixo do último import)

Hidden Content

    Give reaction to this post to see the hidden content.

 

Hidden Content

    Give reaction to this post to see the hidden content.

ele até deu uma carregada porém logo bateu o erro haha

Nesse meio tempo estou corrigindo as tabs do intrologin, esse ''sistema'' seria muito bom pra mim, visto que agora estou na etapa de ficar só focado nas interfaces, aí ficar logando direto é muita perda de tempo

Link to comment
Share on other sites

@Valenza

Se o teu objetivo é ver os mapas, ignora o que te estou a dizer, agora se quiseres mexer a nível de interface como o caro @No0ne falou, siga o seguinte:

1) Adicione o ficheiro que estará disponível no final da resposta no root

2) Procure por:

Hidden Content

    Give reaction to this post to see the hidden content.

 

Adicione por baixo:

Hidden Content

    Give reaction to this post to see the hidden content.

 

3) Procure por:

Hidden Content

    Give reaction to this post to see the hidden content.

 

Adicione abaixo:

Hidden Content

    Give reaction to this post to see the hidden content.

 

Com isto, será criado automaticamente uma pasta chamada "system" no cliente onde terá que meter a tal interface que quer experimentar.

Depois disso ao entrar, ele aparece, carregue em cargar (espanhol) e irá aparecer o(s) seu(s) ficheiro(s):

Hidden Content

    Give reaction to this post to see the hidden content.

 

OBS: Isto não me pertence, o criado dá-se pelo nome de JFirewall, somente fiz aquele pedaço de código para aparecer no login e não no jogo.

 

 

Hidden Content

    Give reaction to this post to see the hidden content.

Edited by Mário.
Link to comment
Share on other sites

17 minutos atrás, Mário. disse:

@Valenza

Se o teu objetivo é ver os mapas, ignora o que te estou a dizer, agora se quiseres mexer a nível de interface como o caro @No0ne falou, siga o seguinte:

1) Adicione o ficheiro que estará disponível no final da resposta no root

2) Procure por:

Hidden Content

    Give reaction to this post to see the hidden content.

 

Adicione por baixo:

Hidden Content

    Give reaction to this post to see the hidden content.

 

3) Procure por:

Hidden Content

    Give reaction to this post to see the hidden content.

 

Adicione abaixo:

Hidden Content

    Give reaction to this post to see the hidden content.

 

Com isto, será criado automaticamente uma pasta chamada "system" no cliente onde terá que meter a tal interface que quer experimentar.

Depois disso ao entrar, ele aparece, carregue em cargar (espanhol) e irá aparecer o(s) seu(s) ficheiro(s):

Hidden Content

    Give reaction to this post to see the hidden content.

 

OBS: Isto não me pertence, o criado dá-se pelo nome de JFirewall, somente fiz aquele pedaço de código para aparecer no login e não no jogo.

 

 

Hidden Content

    Give reaction to this post to see the hidden content.
 0   3 kB

Opa, isso vai me ajudar também, não sabia desse método.. tenho que aprender usar isso, visto que coloquei os arquivos sacados dentro da pasta criada, clico em ''acceptar'' e nada acontece :FailFish:..

 

Meu objetivo geral é desenvolver interfaces usando o mesmo método deste rapaz >>

Um método visualmente simples porém que agiliza bastante o trabalho, evitando perda de tempo...

Uma pena o sistema desse vídeo que estou dando como exemplo servir apenas para clientes ATÉ 34k.. uso 40k :/

 

Agradeço a ajuda, de qualquer forma esse script será util para alguns projetos.. abraço!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...