amvenitsavadcv scrie: ↑30 Noi 2020, 12:24
Pune și tu introselect.py aici
Cât despre celelalte erori, îți lipsesc fișiere MSM.
Caută-le în alt client și le completezi la tine în client.
import grp
import app
import wndMgr
import snd
import net
import systemSetting
import localeInfo
import chr
import ui
import uiScriptLocale
import musicInfo
import playerSettingModule
import uiCommon
import constInfo
import chat
import player
import intrologin
LEAVE_BUTTON_FOR_POTAL = False
class SelectCharacterWindow(ui.Window):
SLOT_COUNT = 5
class CharacterRenderer(ui.Window):
def OnRender(self):
grp.ClearDepthBuffer()
grp.SetGameRenderState()
grp.PushState()
grp.SetOmniLight()
screenWidth = wndMgr.GetScreenWidth()
screenHeight = wndMgr.GetScreenHeight()
newScreenWidth = float(screenWidth+30)
newScreenHeight = float(screenHeight+30)
grp.SetViewport(270.0/screenWidth, 0.0, newScreenWidth/screenWidth, newScreenHeight/screenHeight)
app.SetCenterPosition(20.0, -470.0, -100.0)
app.SetCamera(2800.0, 15.0, 180.0, 102.0)
grp.SetPerspective(10.0, newScreenWidth/newScreenHeight, 1000.0, 4000.0)
(x, y) = app.GetCursorPosition()
grp.SetCursorPosition(x, y)
chr.Deform()
chr.Render()
grp.RestoreViewport()
grp.PopState()
grp.SetInterfaceRenderState()
def __init__(self, stream):
ui.Window.__init__(self)
net.SetPhaseWindow(net.PHASE_WINDOW_SELECT, self)
self.stream = stream
self.slot = self.stream.GetCharacterSlot()
self.openLoadingFlag = False
self.startIndex = -1
self.startReservingTime = 0
self.dlgBoard = 0
self.changeNameFlag = False
self.nameInputBoard = None
self.sendedChangeNamePacket = False
self.startIndex = -1
self.isLoad = 0
def __del__(self):
ui.Window.__del__(self)
net.SetPhaseWindow(net.PHASE_WINDOW_SELECT, 0)
def Open(self):
self.__LoadBoardDialog("twix_work/characterwindow/select/selectcharacterwindow.py")
self.__LoadQuestionDialog("uiscript/questiondialog.py")
playerSettingModule.LoadGameData("INIT")
self.InitCharacterBoard()
self.btnStart.Enable()
self.btnCreate.Enable()
self.btnDelete.Enable()
self.dlgBoard.Show()
self.SetWindowName("SelectCharacterWindow")
self.Show()
if musicInfo.selectMusic != "":
snd.SetMusicVolume(systemSetting.GetMusicVolume())
snd.FadeInMusic("BGM/"+musicInfo.selectMusic)
app.SetCenterPosition(0.0, 0.0, 0.0)
app.SetCamera(1550.0, 15.0, 180.0, 95.0)
self.isLoad = 1
self.Refresh()
if self.stream.isAutoSelect:
self.SelectSlot(self.stream.GetCharacterSlot())
self.StartGame()
self.selected = 0
app.ShowCursor()
def Close(self):
if musicInfo.selectMusic != "":
snd.FadeOutMusic("BGM/"+musicInfo.selectMusic)
self.stream.popupWindow.Close()
if self.dlgBoard:
self.dlgBoard.ClearDictionary()
self.empireName = None
self.flagDict = {}
self.dlgBoard = None
self.btnStart = None
self.btnCreate = None
self.btnDelete = None
self.backGround = None
self.dlgQuestion.ClearDictionary()
self.dlgQuestion = None
self.dlgQuestionText = None
self.dlgQuestionAcceptButton = None
self.dlgQuestionCancelButton = None
self.privateInputBoard = None
self.nameInputBoard = None
chr.DeleteInstance(0)
chr.DeleteInstance(1)
chr.DeleteInstance(2)
chr.DeleteInstance(3)
self.Hide()
self.KillFocus()
app.HideCursor()
def Refresh(self):
if not self.isLoad:
return
indexArray = (3, 2, 1, 0)
for index in indexArray:
id=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_ID)
race=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_RACE)
form=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_FORM)
name=net.GetAccountCharacterSlotDataString(index, net.ACCOUNT_CHARACTER_SLOT_NAME)
hair=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_HAIR)
sash=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_SASH)
if id:
self.MakeCharacter(index, id, name, race, form, hair, sash)
self.SelectSlot(index)
try:
self.SelectSlot(int(intrologin.get_reg("%s_slot" % constInfo.LastAccount)))
except:
self.SelectSlot(self.slot)
def GetCharacterSlotID(self, slotIndex):
return net.GetAccountCharacterSlotDataInteger(slotIndex, net.ACCOUNT_CHARACTER_SLOT_ID)
def __LoadQuestionDialog(self, fileName):
self.dlgQuestion = ui.ScriptWindow()
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self.dlgQuestion, fileName)
except:
import exception
exception.Abort("SelectCharacterWindow.LoadQuestionDialog.LoadScript")
try:
GetObject=self.dlgQuestion.GetChild
self.dlgQuestionText=GetObject("message")
self.dlgQuestionAcceptButton=GetObject("accept")
self.dlgQuestionCancelButton=GetObject("cancel")
except:
import exception
exception.Abort("SelectCharacterWindow.LoadQuestionDialog.BindObject")
self.dlgQuestionText.SetText(localeInfo.SELECT_DO_YOU_DELETE_REALLY)
self.dlgQuestionAcceptButton.SetEvent(ui.__mem_func__(self.RequestDeleteCharacter))
self.dlgQuestionCancelButton.SetEvent(ui.__mem_func__(self.dlgQuestion.Hide))
return 1
def __LoadBoardDialog(self, fileName):
self.dlgBoard = ui.ScriptWindow()
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self.dlgBoard, fileName)
except:
import exception
exception.Abort("SelectCharacterWindow.LoadBoardDialog.LoadScript")
try:
GetObject = self.dlgBoard.GetChild
self.btnStart = GetObject("select_button")
self.btnCreate = GetObject("create_button")
self.btnDelete = GetObject("delete_button")
self.btnExit = GetObject("exit_button")
self.backGround = GetObject("BackGround")
self.charName = GetObject("name")
self.empireName = GetObject("empire")
self.guildName = GetObject("guild")
self.level = GetObject("level")
self.playTime = GetObject("playtime")
self.btnLeft = GetObject("left_button")
self.btnRight = GetObject("right_button")
except:
import exception
exception.Abort("SelectCharacterWindow.LoadBoardDialog.BindObject")
self.btnStart.SetEvent(ui.__mem_func__(self.StartGame))
self.btnCreate.SetEvent(ui.__mem_func__(self.CreateCharacter))
self.btnDelete.SetEvent(ui.__mem_func__(self.InputPrivateCode))
self.btnExit.SetEvent(ui.__mem_func__(self.OnPressExitKey))
self.btnLeft.SetEvent(ui.__mem_func__(self.DecreaseSlotIndex))
self.btnRight.SetEvent(ui.__mem_func__(self.IncreaseSlotIndex))
self.chrRenderer = self.CharacterRenderer()
self.chrRenderer.SetParent(self.backGround)
self.chrRenderer.Show()
return 1
def SameLoginDisconnect(self):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_SAMELOGIN, self.ExitSelect, localeInfo.UI_OK)
def MakeCharacter(self, index, id, name, race, form, hair, sash):
if 0 == id:
return
chr.CreateInstance(index)
chr.SelectInstance(index)
chr.SetVirtualID(index)
chr.SetNameString(name)
chr.SetRace(race)
chr.SetArmor(form)
chr.SetHair(hair)
chr.SetSash(sash)
chr.Refresh()
chr.SetMotionMode(chr.MOTION_MODE_GENERAL)
chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)
chr.SetRotation(0.0)
chr.Show()
def StartGame(self):
if self.sendedChangeNamePacket:
return
if self.changeNameFlag:
self.OpenChangeNameDialog()
return
if -1 != self.startIndex:
return
if musicInfo.selectMusic != "":
snd.FadeLimitOutMusic("BGM/"+musicInfo.selectMusic, systemSetting.GetMusicVolume()*0.05)
self.btnStart.SetUp()
self.btnCreate.SetUp()
self.btnDelete.SetUp()
self.btnLeft.SetUp()
self.btnRight.SetUp()
self.btnStart.Disable()
self.btnCreate.Disable()
self.btnDelete.Disable()
self.btnLeft.Disable()
self.btnRight.Disable()
self.dlgQuestion.Hide()
self.stream.SetCharacterSlot(self.slot)
self.selected = 1
self.startIndex = self.slot
self.startReservingTime = app.GetTime()
chr.SelectInstance(self.slot)
chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED, 0.1)
def OpenChangeNameDialog(self):
import uiCommon
nameInputBoard = uiCommon.InputDialogWithDescription()
nameInputBoard.SetTitle(localeInfo.SELECT_CHANGE_NAME_TITLE)
nameInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputName))
nameInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputName))
nameInputBoard.SetMaxLength(chr.PLAYER_NAME_MAX_LEN)
nameInputBoard.SetBoardWidth(200)
nameInputBoard.SetDescription(localeInfo.SELECT_INPUT_CHANGING_NAME)
nameInputBoard.Open()
nameInputBoard.slot = self.slot
self.nameInputBoard = nameInputBoard
def OnChangeName(self, id, name):
self.SelectSlot(id)
self.sendedChangeNamePacket = False
self.PopupMessage(localeInfo.SELECT_CHANGED_NAME)
def AcceptInputName(self):
changeName = self.nameInputBoard.GetText()
if not changeName:
return
self.sendedChangeNamePacket = True
net.SendChangeNamePacket(self.nameInputBoard.slot, changeName)
return self.CancelInputName()
def CancelInputName(self):
self.nameInputBoard.Close()
self.nameInputBoard = None
return True
def OnCreateFailure(self, type):
self.sendedChangeNamePacket = False
if 0 == type:
self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_STRANGE_NAME)
elif 1 == type:
self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_ALREADY_EXIST_NAME)
elif 100 == type:
self.PopupMessage(localeInfo.SELECT_CHANGE_FAILURE_STRANGE_INDEX)
def CreateCharacter(self):
if 0 == self.GetCharacterSlotID(self.slot):
self.stream.SetCharacterSlot(self.slot)
EMPIRE_MODE = 1
if EMPIRE_MODE:
if self.__AreAllSlotEmpty():
self.stream.SetReselectEmpirePhase()
else:
self.stream.SetCreateCharacterPhase()
else:
self.stream.SetCreateCharacterPhase()
def __AreAllSlotEmpty(self):
for iSlot in xrange(self.SLOT_COUNT):
if 0!=net.GetAccountCharacterSlotDataInteger(iSlot, net.ACCOUNT_CHARACTER_SLOT_ID):
return 0
return 1
def PopupDeleteQuestion(self):
id = self.GetCharacterSlotID(self.slot)
if 0 == id:
return
self.dlgQuestion.Show()
self.dlgQuestion.SetTop()
def RequestDeleteCharacter(self):
self.dlgQuestion.Hide()
id = self.GetCharacterSlotID(self.slot)
if 0 == id:
self.PopupMessage(localeInfo.SELECT_EMPTY_SLOT)
return
net.SendDestroyCharacterPacket(self.slot, "1234567")
self.PopupMessage(localeInfo.SELECT_DELEING)
def InputPrivateCode(self):
privateInputBoard = uiCommon.InputDialogWithDescription()
privateInputBoard.SetTitle(localeInfo.INPUT_PRIVATE_CODE_DIALOG_TITLE)
privateInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrivateCode))
privateInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrivateCode))
privateInputBoard.SetNumberMode()
privateInputBoard.SetSecretMode()
privateInputBoard.SetMaxLength(7)
privateInputBoard.SetBoardWidth(250)
privateInputBoard.SetDescription(localeInfo.INPUT_PRIVATE_CODE_DIALOG_DESCRIPTION)
privateInputBoard.Open()
self.privateInputBoard = privateInputBoard
def AcceptInputPrivateCode(self):
privateCode = self.privateInputBoard.GetText()
if not privateCode:
return
id = self.GetCharacterSlotID(self.slot)
if 0 == id:
self.PopupMessage(localeInfo.SELECT_EMPTY_SLOT)
return
net.SendDestroyCharacterPacket(self.slot, privateCode)
self.PopupMessage(localeInfo.SELECT_DELEING)
self.CancelInputPrivateCode()
return True
def CancelInputPrivateCode(self):
self.privateInputBoard = None
return True
def OnDeleteSuccess(self, slot):
self.PopupMessage(localeInfo.SELECT_DELETED)
self.DeleteCharacter(slot)
def OnDeleteFailure(self):
self.PopupMessage(localeInfo.SELECT_CAN_NOT_DELETE)
def DeleteCharacter(self, index):
chr.DeleteInstance(index)
self.SelectSlot(self.slot)
def ExitSelect(self):
self.dlgQuestion.Hide()
self.Hide()
self.stream.SetLoginPhase()
def GetSlotIndex(self):
return self.slot
def SelectSlot(self, index):
if index < 0:
return
if index >= self.SLOT_COUNT:
return
self.slot = index
for i in range(self.SLOT_COUNT):
chr.DeleteInstance(i)
chr.SelectInstance(self.slot)
id = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_ID)
if 0 != id:
self.btnStart.Enable()
self.btnDelete.Show()
self.btnCreate.Hide()
name = net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_NAME)
level = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
playTime = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
hth = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_HTH)
int = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_INT)
str = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_STR)
dex = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_DEX)
race = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_RACE)
form = net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_FORM)
hair = net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_HAIR)
sash = net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_SASH)
self.changeNameFlag = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_CHANGE_NAME_FLAG)
self.MakeCharacter(self.slot, id, name, race, form, hair, sash)
self.charName.SetText("%s" % name)
self.empireName.SetText("Imperiul %s" % {1:"Shinsoo", 2:"Chunjo", 3:"Jinno"}.get(net.GetEmpireID(), "None"))
if net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME):
self.guildName.SetText(net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME))
else:
self.guildName.SetText(localeInfo.SELECT_NOT_JOIN_GUILD)
self.level.SetText("%d" % level)
self.playTime.SetText("%d" % playTime)
else:
self.InitCharacterBoard()
def InitCharacterBoard(self):
self.btnStart.Disable()
self.btnDelete.Hide()
self.btnCreate.Show()
self.charName.SetText("")
self.empireName.SetText("")
self.guildName.SetText("")
self.level.SetText("")
self.playTime.SetText("")
def DecreaseSlotIndex(self):
if self.selected == 0:
slotIndex = (self.GetSlotIndex() - 1 + self.SLOT_COUNT) % self.SLOT_COUNT
self.SelectSlot(slotIndex)
def IncreaseSlotIndex(self):
if self.selected == 0:
slotIndex = (self.GetSlotIndex() + 1) % self.SLOT_COUNT
self.SelectSlot(slotIndex)
def OnKeyDown(self, key):
if 1 == key:
self.ExitSelect()
if 2 == key:
self.SelectSlot(0)
if 3 == key:
self.SelectSlot(1)
if 4 == key:
self.SelectSlot(2)
if 5 == key:
self.SelectSlot(3)
if 28 == key:
id = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_ID)
if 0 == id:
self.CreateCharacter()
else:
self.StartGame()
if 203 == key:
self.DecreaseSlotIndex()
if 205 == key:
self.IncreaseSlotIndex()
return True
def OnUpdate(self):
chr.Update()
for i in xrange(self.SLOT_COUNT):
if FALSE == chr.HasInstance(i):
continue
chr.SelectInstance(i)
if -1 != self.startIndex:
if app.GetTime() - self.startReservingTime > 3.0:
if False == self.openLoadingFlag:
chrSlot=self.stream.GetCharacterSlot()
net.DirectEnter(chrSlot)
self.openLoadingFlag = True
player.SetPlayTime(net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME))
chat.Clear()
intrologin.set_reg("%s_slot" % constInfo.LastAccount, "%d" % self.stream.GetCharacterSlot())
def EmptyFunc(self):
pass
def PopupMessage(self, msg, func=0):
if not func:
func=self.EmptyFunc
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(msg, func, localeInfo.UI_OK)
def OnPressExitKey(self):
self.ExitSelect()
return True