Am bagat o interfata noua si nu inteleg de ce nu merge am modificat si ip si port in intrologin.py din root.
Cine ma poate ajuta pun aicia intrologin.py
import app
import net
import ui
import snd
import wndMgr
import musicInfo
import systemSetting
import locale
import constInfo
import ime
import webbrowser
import uiScriptLocale
''' codin' pass '''
import binascii
''' Registry '''
import _winreg
REG_PATH = r"SOFTWARE\Savies"
def set_reg(name, value):
try:
_winreg.CreateKey(_winreg.HKEY_CURRENT_USER, REG_PATH)
registry_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, REG_PATH, 0,
_winreg.KEY_WRITE)
_winreg.SetValueEx(registry_key, name, 0, _winreg.REG_SZ, value)
_winreg.CloseKey(registry_key)
return True
except WindowsError:
return False
def get_reg(name):
try:
registry_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, REG_PATH, 0,
_winreg.KEY_READ)
value, regtype = _winreg.QueryValueEx(registry_key, name)
_winreg.CloseKey(registry_key)
return value
except WindowsError:
return None
class LoginWindow(ui.ScriptWindow):
IS_TEST = net.IsTest()
def __init__(self, stream):
ui.ScriptWindow.__init__(self)
net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(self)
self.stream = stream
self.channels = None
self.channelButton = None
def __del__(self):
ui.ScriptWindow.__del__(self)
net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(0)
def Open(self):
self.loginFailureMsgDict={
"ALREADY" : locale.LOGIN_FAILURE_ALREAY,
"NOID" : locale.LOGIN_FAILURE_NOT_EXIST_ID,
"WRONGPWD" : locale.LOGIN_FAILURE_WRONG_PASSWORD,
"FULL" : locale.LOGIN_FAILURE_TOO_MANY_USER,
"SHUTDOWN" : locale.LOGIN_FAILURE_SHUTDOWN,
"REPAIR" : locale.LOGIN_FAILURE_REPAIR_ID,
"BLOCK" : locale.LOGIN_FAILURE_BLOCK_ID,
"WRONGMAT" : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER,
"QUIT" : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE,
"BESAMEKEY" : locale.LOGIN_FAILURE_BE_SAME_KEY,
"NOTAVAIL" : locale.LOGIN_FAILURE_NOT_AVAIL,
"NOBILL" : locale.LOGIN_FAILURE_NOBILL,
"BLKLOGIN" : locale.LOGIN_FAILURE_BLOCK_LOGIN,
"WEBBLK" : locale.LOGIN_FAILURE_WEB_BLOCK,
}
self.loginFailureFuncDict = {
"WRONGPWD" : locale.LOGIN_FAILURE_WRONG_PASSWORD,
"WRONGMAT" : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER,
"QUIT" : app.Exit,
}
self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
self.SetWindowName("LoginWindow")
self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py")
if musicInfo.loginMusic != "":
snd.SetMusicVolume(systemSetting.GetMusicVolume())
snd.FadeInMusic("BGM/" + musicInfo.loginMusic)
snd.SetSoundVolume(systemSetting.GetSoundVolume())
ime.AddExceptKey(91)
ime.AddExceptKey(93)
self.SetChannel("CH1")
self.idEditLine.SetFocus()
self.Show()
app.ShowCursor()
def Close(self):
if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
snd.FadeOutMusic("BGM/"+musicInfo.loginMusic)
if self.stream.popupWindow:
self.stream.popupWindow.Close()
self.Hide()
app.HideCursor()
ime.ClearExceptKey()
def OnConnectFailure(self):
snd.PlaySound("sound/ui/loginfail.wav")
self.PopupNotifyMessage(locale.LOGIN_CONNECT_FAILURE, self.EmptyFunc)
def OnHandShake(self):
snd.PlaySound("sound/ui/loginok.wav")
self.PopupDisplayMessage(locale.LOGIN_CONNECT_SUCCESS)
def OnLoginStart(self):
self.PopupDisplayMessage(locale.LOGIN_PROCESSING)
def OnLoginFailure(self, error):
try:
loginFailureMsg = self.loginFailureMsgDict[error]
except KeyError:
loginFailureMsg = locale.LOGIN_FAILURE_UNKNOWN + error
loginFailureFunc = self.loginFailureFuncDict.get(error, self.EmptyFunc)
self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc)
snd.PlaySound("sound/ui/loginfail.wav")
def __LoadScript(self, fileName):
try:
ui.PythonScriptLoader().LoadScriptFile(self, fileName)
self.idEditLine = self.GetChild("id")
self.pwdEditLine = self.GetChild("pwd")
self.loginButton = self.GetChild("login")
self.saveButton = self.GetChild("save")
self.channelButton = {
"CH1" : self.GetChild("ch1"),
"CH2" : self.GetChild("ch2"),
"CH3" : self.GetChild("ch3"),
"CH4" : self.GetChild("ch4")}
self.panelButton = {
"EXIT" : self.GetChild("exit")}
for (action, button) in self.panelButton.items():
button.SetEvent(ui.__mem_func__(self.MainBoard), action)
except:
import exception
exception.Abort("LoginWindow.__LoadScript.BindObject")
for (channelID, channelButtons) in self.channelButton.items():
channelButtons.SetEvent(ui.__mem_func__(self.SetChannel), channelID)
if (get_reg("id") != None) and (get_reg("pwd") != None):
self.idEditLine.SetText("%s" % binascii.a2b_base64("%s" % get_reg("id")))
self.pwdEditLine.SetText("%s" % binascii.a2b_base64("%s" % get_reg("pwd")))
self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
self.saveButton.SetEvent(ui.__mem_func__(self.SaveAccount))
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))
def MainBoard(self, action):
actions = {
"EXIT" : 0}
if actions.has_key(action):
if action != "EXIT":
webbrowser.open(actions[action])
else:
self.stream.SetPhaseWindow(0)
def SetChannel(self, ch):
self.SetChannelInfo(ch)
for (channelID, channelButtons) in self.channelButton.items():
if ch != channelID:
channelButtons.SetUp()
self.stream.SetConnectInfo("89.34.26.243", self.ChannelPort(ch, 0), "89.34.26.243", self.ChannelPort("LOGIN"))
net.SetMarkServer("89.34.26.243", self.ChannelPort("LOGO"))
app.SetGuildMarkPath("10.tga")
app.SetGuildSymbolPath("10")
net.SetServerInfo(self.ChannelPort(ch, 2))
def SetChannelInfo(self, ch):
self.channels = str(ch)
def GetChannel(self):
return self.channels
def ChannelPort(self, ch="CH1", value=0):
channel = {
"CH1" : [12345,locale.APP_TITLE,"CH1"],
"CH2" : [12346,locale.APP_TITLE,"CH2"],
"CH3" : [12347,locale.APP_TITLE,"CH3"],
"CH4" : [12348,locale.APP_TITLE,"CH4"]}
if ch == "LOGIN":
return 11002
# return 11002
elif ch == "LOGO":
return channel["CH1"][0]
elif value == 2:
return "%s, %s" % (channel[ch][1], channel[ch][2])
else:
return channel[ch][value]
def Connect(self, id, pwd):
if constInfo.SEQUENCE_PACKET_ENABLE:
net.SetPacketSequenceMode()
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(locale.LOGIN_CONNETING, self.EmptyFunc, locale.UI_CANCEL)
self.stream.SetLoginInfo(id, pwd)
self.stream.Connect()
def PopupDisplayMessage(self, msg):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(msg)
def PopupNotifyMessage(self, msg, func=0):
if not func:
func = self.EmptyFunc
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(msg, func, locale.UI_OK)
def OnPressExitKey(self):
if self.stream.popupWindow:
self.stream.popupWindow.Close()
self.stream.SetPhaseWindow(0)
return TRUE
def OnUpdate(self):
for (channelID, channelButtons) in self.channelButton.items():
if self.GetChannel() == channelID:
channelButtons.Down()
def EmptyFunc(self):
pass
def __OnClickLoginButton(self):
id = self.idEditLine.GetText()
pwd = self.pwdEditLine.GetText()
if len(id)==0:
self.PopupNotifyMessage(locale.LOGIN_INPUT_ID, self.EmptyFunc)
return
if len(pwd)==0:
self.PopupNotifyMessage(locale.LOGIN_INPUT_PASSWORD, self.EmptyFunc)
return
self.Connect(id, pwd)
def SaveAccount(self):
if self.idEditLine.GetText() == "" or self.pwdEditLine.GetText() == "":
self.PopupNotifyMessage("WprowadŸ login i has?!", self.EmptyFunc)
return
set_reg("id", str(binascii.b2a_base64(self.idEditLine.GetText())))
set_reg("pwd", str(binascii.b2a_base64(self.pwdEditLine.GetText())))
self.PopupNotifyMessage("Pomyœlnie zapisano!", self.EmptyFunc)
import net
import ui
import snd
import wndMgr
import musicInfo
import systemSetting
import locale
import constInfo
import ime
import webbrowser
import uiScriptLocale
''' codin' pass '''
import binascii
''' Registry '''
import _winreg
REG_PATH = r"SOFTWARE\Savies"
def set_reg(name, value):
try:
_winreg.CreateKey(_winreg.HKEY_CURRENT_USER, REG_PATH)
registry_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, REG_PATH, 0,
_winreg.KEY_WRITE)
_winreg.SetValueEx(registry_key, name, 0, _winreg.REG_SZ, value)
_winreg.CloseKey(registry_key)
return True
except WindowsError:
return False
def get_reg(name):
try:
registry_key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, REG_PATH, 0,
_winreg.KEY_READ)
value, regtype = _winreg.QueryValueEx(registry_key, name)
_winreg.CloseKey(registry_key)
return value
except WindowsError:
return None
class LoginWindow(ui.ScriptWindow):
IS_TEST = net.IsTest()
def __init__(self, stream):
ui.ScriptWindow.__init__(self)
net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(self)
self.stream = stream
self.channels = None
self.channelButton = None
def __del__(self):
ui.ScriptWindow.__del__(self)
net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
net.SetAccountConnectorHandler(0)
def Open(self):
self.loginFailureMsgDict={
"ALREADY" : locale.LOGIN_FAILURE_ALREAY,
"NOID" : locale.LOGIN_FAILURE_NOT_EXIST_ID,
"WRONGPWD" : locale.LOGIN_FAILURE_WRONG_PASSWORD,
"FULL" : locale.LOGIN_FAILURE_TOO_MANY_USER,
"SHUTDOWN" : locale.LOGIN_FAILURE_SHUTDOWN,
"REPAIR" : locale.LOGIN_FAILURE_REPAIR_ID,
"BLOCK" : locale.LOGIN_FAILURE_BLOCK_ID,
"WRONGMAT" : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER,
"QUIT" : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE,
"BESAMEKEY" : locale.LOGIN_FAILURE_BE_SAME_KEY,
"NOTAVAIL" : locale.LOGIN_FAILURE_NOT_AVAIL,
"NOBILL" : locale.LOGIN_FAILURE_NOBILL,
"BLKLOGIN" : locale.LOGIN_FAILURE_BLOCK_LOGIN,
"WEBBLK" : locale.LOGIN_FAILURE_WEB_BLOCK,
}
self.loginFailureFuncDict = {
"WRONGPWD" : locale.LOGIN_FAILURE_WRONG_PASSWORD,
"WRONGMAT" : locale.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER,
"QUIT" : app.Exit,
}
self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
self.SetWindowName("LoginWindow")
self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py")
if musicInfo.loginMusic != "":
snd.SetMusicVolume(systemSetting.GetMusicVolume())
snd.FadeInMusic("BGM/" + musicInfo.loginMusic)
snd.SetSoundVolume(systemSetting.GetSoundVolume())
ime.AddExceptKey(91)
ime.AddExceptKey(93)
self.SetChannel("CH1")
self.idEditLine.SetFocus()
self.Show()
app.ShowCursor()
def Close(self):
if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
snd.FadeOutMusic("BGM/"+musicInfo.loginMusic)
if self.stream.popupWindow:
self.stream.popupWindow.Close()
self.Hide()
app.HideCursor()
ime.ClearExceptKey()
def OnConnectFailure(self):
snd.PlaySound("sound/ui/loginfail.wav")
self.PopupNotifyMessage(locale.LOGIN_CONNECT_FAILURE, self.EmptyFunc)
def OnHandShake(self):
snd.PlaySound("sound/ui/loginok.wav")
self.PopupDisplayMessage(locale.LOGIN_CONNECT_SUCCESS)
def OnLoginStart(self):
self.PopupDisplayMessage(locale.LOGIN_PROCESSING)
def OnLoginFailure(self, error):
try:
loginFailureMsg = self.loginFailureMsgDict[error]
except KeyError:
loginFailureMsg = locale.LOGIN_FAILURE_UNKNOWN + error
loginFailureFunc = self.loginFailureFuncDict.get(error, self.EmptyFunc)
self.PopupNotifyMessage(loginFailureMsg, loginFailureFunc)
snd.PlaySound("sound/ui/loginfail.wav")
def __LoadScript(self, fileName):
try:
ui.PythonScriptLoader().LoadScriptFile(self, fileName)
self.idEditLine = self.GetChild("id")
self.pwdEditLine = self.GetChild("pwd")
self.loginButton = self.GetChild("login")
self.saveButton = self.GetChild("save")
self.channelButton = {
"CH1" : self.GetChild("ch1"),
"CH2" : self.GetChild("ch2"),
"CH3" : self.GetChild("ch3"),
"CH4" : self.GetChild("ch4")}
self.panelButton = {
"EXIT" : self.GetChild("exit")}
for (action, button) in self.panelButton.items():
button.SetEvent(ui.__mem_func__(self.MainBoard), action)
except:
import exception
exception.Abort("LoginWindow.__LoadScript.BindObject")
for (channelID, channelButtons) in self.channelButton.items():
channelButtons.SetEvent(ui.__mem_func__(self.SetChannel), channelID)
if (get_reg("id") != None) and (get_reg("pwd") != None):
self.idEditLine.SetText("%s" % binascii.a2b_base64("%s" % get_reg("id")))
self.pwdEditLine.SetText("%s" % binascii.a2b_base64("%s" % get_reg("pwd")))
self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
self.saveButton.SetEvent(ui.__mem_func__(self.SaveAccount))
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))
def MainBoard(self, action):
actions = {
"EXIT" : 0}
if actions.has_key(action):
if action != "EXIT":
webbrowser.open(actions[action])
else:
self.stream.SetPhaseWindow(0)
def SetChannel(self, ch):
self.SetChannelInfo(ch)
for (channelID, channelButtons) in self.channelButton.items():
if ch != channelID:
channelButtons.SetUp()
self.stream.SetConnectInfo("89.34.26.243", self.ChannelPort(ch, 0), "89.34.26.243", self.ChannelPort("LOGIN"))
net.SetMarkServer("89.34.26.243", self.ChannelPort("LOGO"))
app.SetGuildMarkPath("10.tga")
app.SetGuildSymbolPath("10")
net.SetServerInfo(self.ChannelPort(ch, 2))
def SetChannelInfo(self, ch):
self.channels = str(ch)
def GetChannel(self):
return self.channels
def ChannelPort(self, ch="CH1", value=0):
channel = {
"CH1" : [12345,locale.APP_TITLE,"CH1"],
"CH2" : [12346,locale.APP_TITLE,"CH2"],
"CH3" : [12347,locale.APP_TITLE,"CH3"],
"CH4" : [12348,locale.APP_TITLE,"CH4"]}
if ch == "LOGIN":
return 11002
# return 11002
elif ch == "LOGO":
return channel["CH1"][0]
elif value == 2:
return "%s, %s" % (channel[ch][1], channel[ch][2])
else:
return channel[ch][value]
def Connect(self, id, pwd):
if constInfo.SEQUENCE_PACKET_ENABLE:
net.SetPacketSequenceMode()
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(locale.LOGIN_CONNETING, self.EmptyFunc, locale.UI_CANCEL)
self.stream.SetLoginInfo(id, pwd)
self.stream.Connect()
def PopupDisplayMessage(self, msg):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(msg)
def PopupNotifyMessage(self, msg, func=0):
if not func:
func = self.EmptyFunc
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(msg, func, locale.UI_OK)
def OnPressExitKey(self):
if self.stream.popupWindow:
self.stream.popupWindow.Close()
self.stream.SetPhaseWindow(0)
return TRUE
def OnUpdate(self):
for (channelID, channelButtons) in self.channelButton.items():
if self.GetChannel() == channelID:
channelButtons.Down()
def EmptyFunc(self):
pass
def __OnClickLoginButton(self):
id = self.idEditLine.GetText()
pwd = self.pwdEditLine.GetText()
if len(id)==0:
self.PopupNotifyMessage(locale.LOGIN_INPUT_ID, self.EmptyFunc)
return
if len(pwd)==0:
self.PopupNotifyMessage(locale.LOGIN_INPUT_PASSWORD, self.EmptyFunc)
return
self.Connect(id, pwd)
def SaveAccount(self):
if self.idEditLine.GetText() == "" or self.pwdEditLine.GetText() == "":
self.PopupNotifyMessage("WprowadŸ login i has?!", self.EmptyFunc)
return
set_reg("id", str(binascii.b2a_base64(self.idEditLine.GetText())))
set_reg("pwd", str(binascii.b2a_base64(self.pwdEditLine.GetText())))
self.PopupNotifyMessage("Pomyœlnie zapisano!", self.EmptyFunc)




