Jump to content

Recommended Posts

Hi liebe Com,
 

In epvp bekomme ich leider keine vernünftigen Antworten und ich habe mir den Code auch mehrfach durch studiert aber finde den Fehler nicht.

Mir wird im characterselect immer nur die Gelbe Flagge angezeigt, selbst wenn der Account im blauen ist.

Weiterhin wird das Schulterband beim ersten Login nicht angezeigt.
Beim Charwechseln allerdings schon.

Kann dort jemand helfen?
Ich finde den Fehler leider nicht selbst, da auch kein syserr eintrag besteht.

English Translation:

Spoiler

Hi Com,

I only see the yellow empire flag in characterselect, even if the account is in blue kingdom.

Also the sash is not shown at first login, but when you change character, it does.

Can someone help me ?
I cant find the mistake myself.

introselect.py

Spoiler

import chr
import grp
import os
import dbg
import app
import math
import wndMgr
import snd
import net
import systemSetting
import localeInfo
import ui
import uiScriptLocale
import networkModule
import musicInfo
import playerSettingModule
import uiCommon
import uiMapNameShower
import uiAffectShower
import uiCharacter
import uiTarget
import consoleModule
import interfaceModule
import uiTaskBar
import uiInventory
import player
import chat
import uiPlayerGauge

LEAVE_BUTTON_FOR_POTAL = FALSE
NOT_NEED_DELETE_CODE = FALSE
ENABLE_ENGNUM_DELETE_CODE = FALSE
FOLDER_SELECT = "selectwindow/"

if localeInfo.IsJAPAN():
NOT_NEED_DELETE_CODE = True
elif localeInfo.IsHONGKONG():
ENABLE_ENGNUM_DELETE_CODE = True
elif localeInfo.IsNEWCIBN() or localeInfo.IsCIBN10():
ENABLE_ENGNUM_DELETE_CODE = True
elif localeInfo.IsEUROPE():
ENABLE_ENGNUM_DELETE_CODE = True

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

class SelectCharacterWindow(ui.Window):

SLOT_COUNT = 4
CHARACTER_TYPE_COUNT = 4

EMPIRE_NAME = {
net.EMPIRE_A : localeInfo.EMPIRE_A,
net.EMPIRE_B : localeInfo.EMPIRE_B,
net.EMPIRE_C : localeInfo.EMPIRE_C
}

class CharacterRenderer(ui.Window):
def OnRender(self):
grp.ClearDepthBuffer()

grp.SetGameRenderState()
grp.PushState()
grp.SetOmniLight()

screenWidth = wndMgr.GetScreenWidth()
screenHeight = wndMgr.GetScreenHeight()
newScreenWidth = float(screenWidth - 270)
newScreenHeight = float(screenHeight)

grp.SetViewport(270.0/screenWidth, 0.0, newScreenWidth/screenWidth, newScreenHeight/screenHeight)

app.SetCenterPosition(-50.0, -50.0, -45.0)
##app.SetCenterPosition(0.0, 0.0, 0.0)
app.SetCamera(1550.0, 15.0, 180.0, 95.0)
grp.SetPerspective(11.0, newScreenWidth/newScreenHeight, 1000.0, 3000.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.flagDict = {}
self.curRotation = []
self.destRotation = []

self.curNameAlpha = []
self.destNameAlpha = []
for i in xrange(self.CHARACTER_TYPE_COUNT):
self.curNameAlpha.append(0.0)
self.destNameAlpha.append(0.0)

self.curGauge = [0.0, 0.0, 0.0, 0.0]
self.destGauge = [0.0, 0.0, 0.0, 0.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):
if not self.__LoadBoardDialog(FOLDER_SELECT + "selectcharacterwindow.py"):
dbg.TraceError("SelectCharacterWindow.Open - __LoadScript Error")
return

if not self.__LoadQuestionDialog("uiscript/questiondialog.py"):
return

playerSettingModule.LoadGameData("INIT")

self.InitCharacterBoard()

self.btnStart.Enable()
self.btnCreate.Enable()
self.btnDelete.Enable()
self.btnExit.Enable()
self.btnMall.Enable()

self.dlgBoard.Show()
self.SetWindowName("SelectCharacterWindow")
self.Show()

if self.slot>=0:
self.SelectSlot(self.slot)

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:
chrSlot=self.stream.GetCharacterSlot()
self.SelectSlot(chrSlot)
self.StartGame()

self.HideAllFlag()
self.SetEmpire(net.GetEmpireID())

app.ShowCursor()

def Close(self):
if musicInfo.selectMusic != "":
snd.FadeOutMusic("BGM/"+musicInfo.selectMusic)

self.stream.popupWindow.Close()

if self.dlgBoard:
self.dlgBoard.ClearDictionary()

self.flagDict = {}
self.dlgBoard = None
self.btnStart = None
self.btnCreate = None
self.btnDelete = None
self.btnExit = None
self.btnMall = 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 SetEmpire(self, id):
if self.flagDict.has_key(id):
self.flagDict[id].Show()

def HideAllFlag(self):
for flag in self.flagDict.values():
flag.Hide()

def Refresh(self):
if not self.isLoad:
return

indexArray = (3, 2, 1, 0)
for index in indexArray:
playTime=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
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)
level=net.GetAccountCharacterSlotDataInteger(index , net.ACCOUNT_CHARACTER_SLOT_LEVEL)
hair=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_HAIR)
acce=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_ACCE)
valueHTH=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_HTH)
valueINT=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_INT)
valueSTR=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_STR)
valueDEX=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_DEX)
guildName=net.GetAccountCharacterSlotDataString(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME)

if id:
self.MakeCharacter(index, id, name, race, form, hair, acce)
self.SelectSlot(index)

if race == 0 or race == 4:
race = "Warrior"
elif race == 1 or race == 5: #ninja
race = "Ninja"
elif race == 2 or race == 6: #sura
race = "Sura"
elif race == 3 or race == 7: ##shaman
race = "Shaman"
elif race == 8: #wolfman
race = "Wolfman"

if index == 0:
self.CharacterLevel01.SetText(str(level))
self.CharacterName01.SetText(name)
self.CharacterRace01.SetText(str(race))
self.CharacterLevelBIG1.SetText(str(level))
self.PlayTime.SetText(str(playTime))

if index == 1:
self.CharacterLevel02.SetText(str(level))
self.CharacterName02.SetText(name)
self.CharacterRace02.SetText(str(race))
self.CharacterLevelBIG1.SetText(str(level))
self.PlayTime.SetText(str(playTime))

elif index == 2:
self.CharacterName03.SetText(name)
self.CharacterLevel03.SetText(str(level))
self.CharacterRace03.SetText(str(race))
self.CharacterLevelBIG1.SetText(str(level))
self.PlayTime.SetText(str(playTime))

elif index == 3:
self.CharacterName04.SetText(name)
self.CharacterLevel04.SetText(str(level))
self.CharacterRace04.SetText(str(race))
self.CharacterLevelBIG1.SetText(str(level))
self.PlayTime.SetText(str(playTime))
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.LoadQuestio nDialog.LoadScript")

try:
GetObject=self.dlgQuestion.GetChild
self.dlgQuestionText=GetObject("message")
self.dlgQuestionAcceptButton=GetObject("accept")
self.dlgQuestionCancelButton=GetObject("cancel")
except:
import exception
exception.Abort("SelectCharacterWindow.LoadQuestio nDialog.BindObject")

self.dlgQuestionText.SetText(localeInfo.SELECT_DO_ YOU_DELETE_REALLY)
self.dlgQuestionAcceptButton.SetEvent(ui.__mem_fun c__(self.RequestDeleteCharacter))
self.dlgQuestionCancelButton.SetEvent(ui.__mem_fun c__(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.LoadBoardDi alog.LoadScript")

try:
GetObject=self.dlgBoard.GetChild

self.btnStart = GetObject("start_button")
self.btnCreate = GetObject("create_button")
self.btnDelete = GetObject("delete_button")
self.btnExit = GetObject("exit_button")
self.btnMall = GetObject("item_shop_button")

self.btnSlot01 = GetObject("slot_button_01")
self.btnSlot02 = GetObject("slot_button_02")
self.btnSlot03 = GetObject("slot_button_03")
self.btnSlot04 = GetObject("slot_button_04")
self.btnSlot01A = GetObject("slot_button_01_active")
self.btnSlot02A = GetObject("slot_button_02_active")
self.btnSlot03A = GetObject("slot_button_03_active")
self.btnSlot04A = GetObject("slot_button_04_active")
self.CharacterLevel01 = GetObject("character_level_value_01")
self.CharacterLevelBIG1 = GetObject("character_level_big")
self.PlayTime = GetObject("character_playtime")
self.CharacterName01 = GetObject("character_name_value_01")
self.CharacterRace01 = GetObject("character_raza_value_01")
self.CharacterLevel02 = GetObject("character_level_value_02")
self.CharacterName02 = GetObject("character_name_value_02")
self.CharacterRace02 = GetObject("character_raza_value_02")
self.CharacterLevel03 = GetObject("character_level_value_03")
self.CharacterName03 = GetObject("character_name_value_03")
self.CharacterRace03 = GetObject("character_raza_value_03")
self.CharacterLevel04 = GetObject("character_level_value_04")
self.CharacterName04 = GetObject("character_name_value_04")
self.CharacterRace04 = GetObject("character_raza_value_04")
self.CharacterLevel01A = GetObject("character_level_value_01_a")
self.CharacterName01A = GetObject("character_name_value_01_a")
self.CharacterRace01A = GetObject("character_raza_value_01_a")
self.CharacterLevel02A = GetObject("character_level_value_02_a")
self.CharacterName02A = GetObject("character_name_value_02_a")
self.CharacterRace02A = GetObject("character_raza_value_02_a")
self.CharacterLevel03A = GetObject("character_level_value_03_a")
self.CharacterName03A = GetObject("character_name_value_03_a")
self.CharacterRace03A = GetObject("character_raza_value_03_a")
self.CharacterLevel04A = GetObject("character_level_value_04_a")
self.CharacterName04A = GetObject("character_name_value_04_a")
self.CharacterRace04A = GetObject("character_raza_value_04_a")

self.GaugeList = []
self.GaugeList.append(GetObject("gauge_hth"))
self.GaugeList.append(GetObject("gauge_int"))
self.GaugeList.append(GetObject("gauge_str"))
self.GaugeList.append(GetObject("gauge_dex"))

self.flagDict[net.EMPIRE_A] = GetObject("EmpireFlag_A")
self.flagDict[net.EMPIRE_B] = GetObject("EmpireFlag_B")
self.flagDict[net.EMPIRE_C] = GetObject("EmpireFlag_C")

self.backGround = GetObject("BackGround")

except:
import exception
exception.Abort("SelectCharacterWindow.LoadBoardDi alog.BindObject")

self.btnStart.SetEvent(ui.__mem_func__(self.StartG ame))
self.btnCreate.SetEvent(ui.__mem_func__(self.Creat eCharacter))
self.btnExit.SetEvent(ui.__mem_func__(self.ExitSel ect))
self.btnMall.SetEvent(ui.__mem_func__(self.GoMall) )
self.btnSlot01.SetEvent(ui.__mem_func__(self.Selec tSlot1))
self.btnSlot02.SetEvent(ui.__mem_func__(self.Selec tSlot2))
self.btnSlot03.SetEvent(ui.__mem_func__(self.Selec tSlot3))
self.btnSlot04.SetEvent(ui.__mem_func__(self.Selec tSlot4))


self.btnSlot01.Show()
self.btnSlot02.Show()
self.btnSlot03.Show()
self.btnSlot04.Show()
self.btnSlot01A.Hide()
self.btnSlot02A.Hide()
self.btnSlot03A.Hide()
self.btnSlot04A.Hide()

if NOT_NEED_DELETE_CODE:
self.btnDelete.SetEvent(ui.__mem_func__(self.Popup DeleteQuestion))
else:
self.btnDelete.SetEvent(ui.__mem_func__(self.Input PrivateCode))

self.chrRenderer = self.CharacterRenderer()
self.chrRenderer.SetParent(self.backGround)
self.chrRenderer.Show()

return 1

def MakeCharacter(self, index, id, name, race, form, hair, acce):
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.SetAcce(acce)

chr.Refresh()
chr.SetMotionMode(chr.MOTION_MODE_GENERAL)
chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)

chr.SetRotation(0.0)

## Manage Slot
def SelectSlot1(self):
snd.PlaySound("sound/ui/click.wav")
self.SelectSlot(0)

def SelectSlot2(self):
snd.PlaySound("sound/ui/click.wav")
self.SelectSlot(1)

def SelectSlot3(self):
snd.PlaySound("sound/ui/click.wav")
self.SelectSlot(2)

def SelectSlot4(self):
snd.PlaySound("sound/ui/click.wav")
self.SelectSlot(3)

## Manage Character
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.btnExit.SetUp()
self.btnMall.SetUp()

self.btnStart.Disable()
self.btnCreate.Disable()
self.btnDelete.Disable()
self.btnExit.Disable()
self.btnMall.Disable()
self.dlgQuestion.Hide()

self.stream.SetCharacterSlot(self.slot)

self.startIndex = self.slot
self.startReservingTime = app.GetTime()

for i in xrange(self.SLOT_COUNT):

if FALSE == chr.HasInstance(i):
continue

chr.SelectInstance(i)

if i == self.slot:
self.slot=self.slot
chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED, 0.1)
continue

chr.PushOnceMotion(chr.MOTION_INTRO_NOT_SELECTED, 0.1)

def OpenChangeNameDialog(self):
import uiCommon
nameInputBoard = uiCommon.InputDialogWithDescription()
nameInputBoard.SetTitle(localeInfo.SELECT_CHANGE_N AME_TITLE)
nameInputBoard.SetAcceptEvent(ui.__mem_func__(self .AcceptInputName))
nameInputBoard.SetCancelEvent(ui.__mem_func__(self .CancelInputName))
nameInputBoard.SetMaxLength(chr.PLAYER_NAME_MAX_LE N)
nameInputBoard.SetBoardWidth(200)
nameInputBoard.SetDescription(localeInfo.SELECT_IN PUT_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):
id = self.GetCharacterSlotID(self.slot)
if 0==id:
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):

import uiCommon
privateInputBoard = uiCommon.InputDialogWithDescription()
privateInputBoard.SetTitle(localeInfo.INPUT_PRIVAT E_CODE_DIALOG_TITLE)
privateInputBoard.SetAcceptEvent(ui.__mem_func__(s elf.AcceptInputPrivateCode))
privateInputBoard.SetCancelEvent(ui.__mem_func__(s elf.CancelInputPrivateCode))

if ENABLE_ENGNUM_DELETE_CODE:
pass
else:
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)
if index == 0:
self.CharacterLevel01A.SetText("")
self.CharacterName01A.SetText("")
self.CharacterLevel01.SetText("")
self.CharacterRace01.SetText("")
self.CharacterRace01A.SetText("")
self.CharacterName01.SetText("")
elif index == 1:
self.CharacterLevel02A.SetText("")
self.CharacterName02A.SetText("")
self.CharacterLevel02.SetText("")
self.CharacterRace02.SetText("")
self.CharacterRace02A.SetText("")
self.CharacterName02.SetText("")
elif index == 2:
self.CharacterLevel03A.SetText("")
self.CharacterName03A.SetText("")
self.CharacterLevel03.SetText("")
self.CharacterRace03.SetText("")
self.CharacterRace03A.SetText("")
self.CharacterName03.SetText("")
elif index == 3:
self.CharacterLevel04A.SetText("")
self.CharacterName04A.SetText("")
self.CharacterLevel04.SetText("")
self.CharacterRace04.SetText("")
self.CharacterRace04A.SetText("")
self.CharacterName04.SetText("")

def ExitSelect(self):
self.dlgQuestion.Hide()

if LEAVE_BUTTON_FOR_POTAL:
if app.loggined:
self.stream.SetPhaseWindow(0)
else:
self.stream.setloginphase()
else:
self.stream.SetLoginPhase()

self.Hide()

def GoMall(self):
import os
os.system('@echo off && explorer "https://google.de/ishop/index.php"')
return TRUE

def GetSlotIndex(self):
return self.slot

def DecreaseSlotIndex(self):
slotIndex = (self.GetSlotIndex() - 1 + self.SLOT_COUNT) % self.SLOT_COUNT
self.SelectSlot(slotIndex)

def IncreaseSlotIndex(self):
slotIndex = (self.GetSlotIndex() + 1) % self.SLOT_COUNT
self.SelectSlot(slotIndex)

def SelectSlot(self, index):

if index < 0:
return
if index >= self.SLOT_COUNT:
return

chr.DeleteInstance(0)
chr.DeleteInstance(1)
chr.DeleteInstance(2)
chr.DeleteInstance(3)

self.slot = index

chr.SelectInstance(self.slot)

self.btnSlot01A.Hide()
self.btnSlot02A.Hide()
self.btnSlot03A.Hide()
self.btnSlot04A.Hide()

if self.slot == 0:
self.btnSlot01A.Show()
elif self.slot == 1:
self.btnSlot02A.Show()
elif self.slot == 2:
self.btnSlot03A.Show()
elif self.slot == 3:
self.btnSlot04A.Show()

id=net.GetAccountCharacterSlotDataInteger(self.slo t, net.ACCOUNT_CHARACTER_SLOT_ID)
if 0 != id:

self.btnStart.Enable()
self.btnDelete.Enable()
self.btnCreate.Disable()

playTime=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
level=net.GetAccountCharacterSlotDataInteger(self. slot, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
race=net.GetAccountCharacterSlotDataInteger(self.s lot, net.ACCOUNT_CHARACTER_SLOT_RACE)
name=net.GetAccountCharacterSlotDataString(self.sl ot, net.ACCOUNT_CHARACTER_SLOT_NAME)
race=net.GetAccountCharacterSlotDataInteger(self.s lot, net.ACCOUNT_CHARACTER_SLOT_RACE)
form=net.GetAccountCharacterSlotDataInteger(self.s lot, net.ACCOUNT_CHARACTER_SLOT_FORM)
hair=net.GetAccountCharacterSlotDataInteger(self.s lot, net.ACCOUNT_CHARACTER_SLOT_HAIR)
acce=net.GetAccountCharacterSlotDataInteger(self.s lot, net.ACCOUNT_CHARACTER_SLOT_ACCE)
valueHTH=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_HTH)
valueINT=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_INT)
valueSTR=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_STR)
valueDEX=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_DEX)
guildName=net.GetAccountCharacterSlotDataString(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME)
self.changeNameFlag=net.GetAccountCharacterSlotDat aInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_CHANGE_NAME_FLAG)

if id:
self.MakeCharacter(self.slot, id, name, race, form, hair, acce)

if race == 0 or race == 4:
race = "Warrior"
elif race == 1 or race == 5:
race = "Ninja"
elif race == 2 or race == 6:
race = "Sura"
elif race == 3 or race == 7:
race = "Shaman"
elif race == 8: #wolfman
race = "Wolfman"

if self.slot == 0:
self.CharacterLevel01A.SetText(str(level))
self.CharacterName01A.SetText(name)
self.CharacterRace01A.SetText(str(race))
self.CharacterLevelBIG1.SetText(str(level))
self.PlayTime.SetText(str(playTime))
if self.slot == 1:
self.CharacterLevel02A.SetText(str(level))
self.CharacterName02A.SetText(name)
self.CharacterRace02A.SetText(str(race))
self.CharacterLevelBIG1.SetText(str(level))
self.PlayTime.SetText(str(playTime))
elif self.slot == 2:
self.CharacterLevel03A.SetText(str(level))
self.CharacterName03A.SetText(name)
self.CharacterRace03A.SetText(str(race))
self.CharacterLevelBIG1.SetText(str(level))
self.PlayTime.SetText(str(playTime))
elif self.slot == 3:
self.CharacterLevel04A.SetText(str(level))
self.CharacterName04A.SetText(name)
self.CharacterRace04A.SetText(str(race))
self.CharacterLevelBIG1.SetText(str(level))
self.PlayTime.SetText(str(playTime))

statesSummary = float(valueHTH + valueINT + valueSTR + valueDEX)
if statesSummary > 0.0:
self.destGauge = [
float(valueHTH) / statesSummary,
float(valueINT) / statesSummary,
float(valueSTR) / statesSummary,
float(valueDEX) / statesSummary,
]

else:
self.InitCharacterBoard()

def InitCharacterBoard(self):

self.btnStart.Disable()
self.btnDelete.Disable()
self.btnCreate.Enable()
#utg
self.CharacterLevel01A.SetText("")
self.CharacterName01A.SetText("")
self.CharacterRace01A.SetText("")
self.CharacterLevelBIG1.SetText("")
self.PlayTime.SetText("")

## Event
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 28 == key:

id = net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_ID)
if 0 == id:
self.CreateCharacter()

else:
self.StartGame()

if 203 == key:
self.slot = (self.GetSlotIndex() - 1 + self.SLOT_COUNT) % self.SLOT_COUNT
self.SelectSlot(self.slot)
if 205 == key:
self.slot = (self.GetSlotIndex() + 1) % self.SLOT_COUNT
self.SelectSlot(self.slot)

return TRUE

def OnUpdate(self):
chr.Update()

for i in xrange(4):
self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0
if abs(self.curGauge[i] - self.destGauge[i]) < 0.005:
self.curGauge[i] = self.destGauge[i]
self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0)

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

playTime=net.GetAccountCharacterSlotDataInteger(se lf.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)

import player
player.SetPlayTime(playTime)
import chat
chat.Clear()

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

 

selectcharacterwindow.py

Spoiler

import uiScriptLocale
import net

LOCATIE_FISIERE = "selectwindow/"
LOCATIE_FISIERE_BUTOANE = "selectwindow/butoane/"
BOARD_X = SCREEN_WIDTH * (65) / 800
DIFERENTA_BUTOANE = 75
BUTON_DREAPTA_STANGADREAPTA = 250
BUTON_DREAPTA_SUSJOS = 25
BOARD_ITEM_ADD_POSITION = -40

window = {
"name" : "SelectCharacterWindow",
"x" : 0,
"y" : 0,
"width" : SCREEN_WIDTH,
"height" : SCREEN_HEIGHT,
"children"
## Board
{
"name" : "BackGround",
"type" : "expanded_image",
"x" : 0, "y" : 0,
"x_scale" : float(SCREEN_WIDTH) / 1366.0,
"y_scale" : float(SCREEN_HEIGHT) / 768.0,
"image" : LOCATIE_FISIERE + "background.tga",
},
## Buttons
{
"name" : "character_level_big",
"type" : "text",
"x" : 94, "y" : 3*75+40,
"text" : "",
"fontname" : "Tahoma:35",
"horizontal_align" : "left",
},
{
"name" : "character_playtime",
"type" : "text",
"x" : 94+145, "y" : 3*75+40,
"text" : "",
"fontname" : "Tahoma:35",
"horizontal_align" : "left",
},
{
"name" : "statistici",
"type" : "image",
"x" : 70, "y" : 3*75,
"image" : LOCATIE_FISIERE + "statistici.tga",
"horizontal_align" : "left",
},
{
"name" : "character_hth",
"type" : "text",
"x" : 17 + 25,
"y" : 102 + 100 - 21 + BOARD_ITEM_ADD_POSITION + 250,
"children" :
(
{
"name" : "gauge_hth",
"type" : "newgauge",

"x" : 30,
"y" : 4,

"width" : 200,
"color" : "verde",
},
{
"name" : "character_hth_value",
"type" : "text",

"x" : 134 + 11 + 100,
"y" : 1,

"text" : "HP",

"text_horizontal_align" : "center",
},
),
},
{
"name" : "character_int",
"type" : "text",
"x" : 17 + 25,
"y" : 128 + 100 - 21 + BOARD_ITEM_ADD_POSITION + 250,
"children" :
(
{
"name" : "gauge_int",
"type" : "newgauge",

"x" : 30,
"y" : 4,

"width" : 200,
"color" : "mov",
},
{
"name" : "character_int_value",
"type" : "text",

"x" : 134 + 11 + 100,
"y" : 1,

"text" : "INT",

"text_horizontal_align" : "center",
},
),
},
{
"name" : "character_str",
"type" : "text",

"x" : 17 + 25,
"y" : 154 + 100 - 21 + BOARD_ITEM_ADD_POSITION + 250,


"children" :
(
{
"name" : "gauge_str",
"type" : "newgauge",

"x" : 30,
"y" : 4,

"width" : 200,
"color" : "rosu",
},
{
"name" : "character_str_value",
"type" : "text",

"x" : 134 + 11 + 100,
"y" : 1,

"text" : "STR",

"text_horizontal_align" : "center",
},
),
},
{
"name" : "character_dex",
"type" : "text",

"x" : 17 + 25,
"y" : 180 + 100 - 21 + BOARD_ITEM_ADD_POSITION + 250,

# "text" : uiScriptLocale.SELECT_DEX_GRADE,

"children" :
(
{
"name" : "gauge_dex",
"type" : "newgauge",

"x" : 30,
"y" : 4,

"width" : 200,
"color" : "galben",
},
{
"name" : "character_dex_value",
"type" : "text",

"x" : 134 + 11 + 100,
"y" : 1,

"text" : "DEX",

"text_horizontal_align" : "center",
},
),
},
{
"name" : "EmpireFlag_A",
"type" : "expanded_image",
"x" : 17 + 25 + 100,
"y" : 180 + 100 - 21 + BOARD_ITEM_ADD_POSITION + 250 + 50,
"image" : LOCATIE_FISIERE + "shinnso.tga"
},
{
"name" : "EmpireFlag_B",
"type" : "expanded_image",
"x" : 17 + 25 + 100,
"y" : 180 + 100 - 21 + BOARD_ITEM_ADD_POSITION + 250 + 50,
"image" : LOCATIE_FISIERE + "cunjo.tga"
},
{
"name" : "EmpireFlag_C",
"type" : "expanded_image",
"x" : 17 + 25 + 100,
"y" : 180 + 100 - 21 + BOARD_ITEM_ADD_POSITION + 250 + 50,
"image" : LOCATIE_FISIERE + "jinno.tga"
},
{
"name" : "base_stats",
"type" : "image",
"x" : 80, "y" : 5*75,
"image" : LOCATIE_FISIERE + "base_stats.tga",
"horizontal_align" : "left",
},
{
"name" : "slot_button_01",
"type" : "button",
"x" : BUTON_DREAPTA_STANGADREAPTA,
"y" : BUTON_DREAPTA_SUSJOS,

"horizontal_align" : "right",

"default_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol0.tga",
"over_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol2.tga",
"children" :
(
{
"name" : "character_name_value_01",
"type" : "text",

"x" : 95, ## LATIME
"y" : 23, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
"text_horizontal_align" : "center"
},
{
"name" : "character_level_value_01",
"type" : "text",

"x" : 125,
"y" : 39,

"text" : "",
"fontsize" : "LARGE",
},
{
"name" : "character_raza_value_01",
"type" : "text",

"x" : 95, ## LATIME
"y" : 9, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
},
),
},
{
"name" : "slot_button_01_active",
"type" : "button",

"x" : BUTON_DREAPTA_STANGADREAPTA,
"y" : BUTON_DREAPTA_SUSJOS,

"horizontal_align" : "right",

"default_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"over_image" :LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",

"children" :
(
{
"name" : "character_name_value_01_a",
"type" : "text",

"x" : 95, ## LATIME
"y" : 23, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
"text_horizontal_align" : "center"
},
{
"name" : "character_level_value_01_a",
"type" : "text",

"x" : 125,
"y" : 39,

"text" : "",
"fontsize" : "LARGE",
},
{
"name" : "character_raza_value_01_a",
"type" : "text",

"x" : 95, ## LATIME
"y" : 9, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
},
),
},
{
"name" : "slot_button_02",
"type" : "button",

'x' : BUTON_DREAPTA_STANGADREAPTA,
'y' : BUTON_DREAPTA_SUSJOS + DIFERENTA_BUTOANE,

"horizontal_align" : "right",

"default_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol0.tga",
"over_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol2.tga",

"children" :
(
{
"name" : "character_name_value_02",
"type" : "text",

"x" : 95, ## LATIME
"y" : 23, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
"text_horizontal_align" : "center"
},
{
"name" : "character_level_value_02",
"type" : "text",

"x" : 125,
"y" : 39,

"text" : "",
"fontsize" : "LARGE",
},
{
"name" : "character_raza_value_02",
"type" : "text",

"x" : 95, ## LATIME
"y" : 9, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
},
),
},
{
"name" : "slot_button_02_active",
"type" : "button",

'x' : BUTON_DREAPTA_STANGADREAPTA,
'y' : BUTON_DREAPTA_SUSJOS + DIFERENTA_BUTOANE,

"horizontal_align" : "right",

"default_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"over_image" :LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",

"children" :
(
{
"name" : "character_name_value_02_a",
"type" : "text",

"x" : 95, ## LATIME
"y" : 23, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
"text_horizontal_align" : "center"
},
{
"name" : "character_level_value_02_a",
"type" : "text",

"x" : 125,
"y" : 39,

"text" : "",
"fontsize" : "LARGE",
},
{
"name" : "character_raza_value_02_a",
"type" : "text",

"x" : 95, ## LATIME
"y" : 9, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
},
),
},
{
"name" : "slot_button_03",
"type" : "button",

'x' : BUTON_DREAPTA_STANGADREAPTA,
'y' : BUTON_DREAPTA_SUSJOS + 2*DIFERENTA_BUTOANE,

"horizontal_align" : "right",

"default_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol0.tga",
"over_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol2.tga",

"children" :
(
{
"name" : "character_name_value_03",
"type" : "text",

"x" : 95, ## LATIME
"y" : 23, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
"text_horizontal_align" : "center"
},
{
"name" : "character_level_value_03",
"type" : "text",

"x" : 125,
"y" : 39,

"text" : "",
"fontsize" : "LARGE",
},
{
"name" : "character_raza_value_03",
"type" : "text",

"x" : 95, ## LATIME
"y" : 9, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
},
),
},
{
"name" : "slot_button_03_active",
"type" : "button",

'x' : BUTON_DREAPTA_STANGADREAPTA,
'y' : BUTON_DREAPTA_SUSJOS + 2*DIFERENTA_BUTOANE,

"horizontal_align" : "right",

"default_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"over_image" :LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",

"children" :
(
{
"name" : "character_name_value_03_a",
"type" : "text",

"x" : 95, ## LATIME
"y" : 23, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
"text_horizontal_align" : "center"
},
{
"name" : "character_level_value_03_a",
"type" : "text",

"x" : 125,
"y" : 39,

"text" : "",
"fontsize" : "LARGE",
},
{
"name" : "character_raza_value_03_a",
"type" : "text",

"x" : 95, ## LATIME
"y" : 9, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
},
),
},
{
"name" : "slot_button_04",
"type" : "button",

'x' : BUTON_DREAPTA_STANGADREAPTA,
'y' : BUTON_DREAPTA_SUSJOS + 3*DIFERENTA_BUTOANE,

"horizontal_align" : "right",

"default_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol0.tga",
"over_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol2.tga",

"children" :
(
{
"name" : "character_name_value_04",
"type" : "text",

"x" : 95, ## LATIME
"y" : 23, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
"text_horizontal_align" : "center"
},
{
"name" : "character_level_value_04",
"type" : "text",

"x" : 125,
"y" : 39,

"text" : "",
"fontsize" : "LARGE",
},
{
"name" : "character_raza_value_04",
"type" : "text",

"x" : 95, ## LATIME
"y" : 9, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
},
),
},
{
"name" : "slot_button_04_active",
"type" : "button",

'x' : BUTON_DREAPTA_STANGADREAPTA,
'y' : BUTON_DREAPTA_SUSJOS + 3*DIFERENTA_BUTOANE,

"horizontal_align" : "right",

"default_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"over_image" :LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "slot_gol1.tga",

"children" :
(
{
"name" : "character_name_value_04_a",
"type" : "text",

"x" : 95, ## LATIME
"y" : 23, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
"text_horizontal_align" : "center"
},
{
"name" : "character_level_value_04_a",
"type" : "text",

"x" : 125,
"y" : 39,

"text" : "",
"fontsize" : "LARGE",
},
{
"name" : "character_raza_value_04_a",
"type" : "text",

"x" : 95, ## LATIME
"y" : 9, ## LUNGIME

"text" : "",
"fontsize" : "LARGE",
},
),
},
{
"name" : "create_button",
"type" : "button",
'x' : BUTON_DREAPTA_STANGADREAPTA,
"y" : BUTON_DREAPTA_SUSJOS + 4*DIFERENTA_BUTOANE,
"horizontal_align" : "right",
"default_image" : LOCATIE_FISIERE_BUTOANE + "crate_character0.tga",
"over_image" : LOCATIE_FISIERE_BUTOANE + "crate_character1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "crate_character2.tga",
},
{
"name" : "start_button",
"type" : "button",
'x' : -5,
"y" : SCREEN_HEIGHT * (540) / 645,
"horizontal_align" : "center",
"default_image" : LOCATIE_FISIERE_BUTOANE + "play0.tga",
"over_image" : LOCATIE_FISIERE_BUTOANE + "play1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "play2.tga",
},
{
"name" : "delete_button",
"type" : "button",
'x' : -140,
"y" : SCREEN_HEIGHT * (540) / 645,
"horizontal_align" : "center",
"default_image" : LOCATIE_FISIERE_BUTOANE + "delete0.tga",
"over_image" : LOCATIE_FISIERE_BUTOANE + "delete1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "delete2.tga",

},
{
"name" : "exit_button",
"type" : "button",
"x" : 53,
"y" : (SCREEN_HEIGHT + 60) * (540) / 645,
"horizontal_align" : "center",
"default_image" : LOCATIE_FISIERE_BUTOANE + "logout0.tga",
"over_image" : LOCATIE_FISIERE_BUTOANE + "logout1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "logout2.tga",
},
{
"name" : "item_shop_button",
"type" : "button",
"x" : -62,
"y" : (SCREEN_HEIGHT + 60) * (540) / 645,
"horizontal_align" : "center",
"default_image" : LOCATIE_FISIERE_BUTOANE + "item_mall0.tga",
"over_image" : LOCATIE_FISIERE_BUTOANE + "item_mall1.tga",
"down_image" : LOCATIE_FISIERE_BUTOANE + "item_mall2.tga",
},
),
}

 

 

Link to comment
https://metin2.dev/topic/21551-charselect-falsche-flagge/
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.