Jump to content
  • 0

Setting yohara level for introselect.py.


Device41

Question

packet.h

typedef struct SSimplePlayerInformation
#ifdef ENABLE_CONQUEROR_LEVEL
    BYTE byConquerorLevel;
#endif


phytonnetworkstream.cpp

#ifdef ENABLE_CONQUEROR_LEVEL
        case ACCOUNT_CHARACTER_SLOT_CONQUEROR:
            return rkSimplePlayerInfo.byConquerorLevel;
#endif

networkstream.h

#ifdef ENABLE_CONQUEROR_LEVEL
            ACCOUNT_CHARACTER_SLOT_CONQUEROR,
#endif

phaseloading.cpp

        else if (i == POINT_CONQUEROR_LEVEL)
            m_akSimplePlayerInfo[m_dwSelectedCharacterIndex].byConquerorLevel = PointsPacket.points[i];

networkstreammodule.cpp

#ifdef ENABLE_CONQUEROR_LEVEL
    PyModule_AddIntConstant(poModule, "ACCOUNT_CHARACTER_SLOT_CONQUEROR", CPythonNetworkStream::ACCOUNT_CHARACTER_SLOT_CONQUEROR);
#endif

common/tables.h

typedef struct SSimplePlayer
{

#ifdef ENABLE_CONQUEROR_LEVEL
    BYTE        byConquerorLevel;
#endif

 

db/src (All add-ons for clientmanagerlogin.cpp are made)

 

introselect.py

 

class MyCharacters:
	class MyUnit:
		def __init__(self, const_id, name, level, conquerorlevel, race, playtime, guildname, form, hair, stat_str, stat_dex, stat_hth, stat_int, change_name):
			self.UnitDataDic = {
				"ID" 				: 	const_id,
				"NAME"				:	name,
				"LEVEL"				:	level,
				"CONQUERORLEVEL"	:	conquerorlevel,
				"RACE"				:	race,
				"PLAYTIME"			:	playtime,
				"GUILDNAME"			:	guildname,
				"FORM"				:	form,
				"HAIR"				:	hair,
				"STR"				:	stat_str,
				"DEX"				:	stat_dex,
				"HTH"				:	stat_hth,
				"INT"				:	stat_int,
				"CHANGENAME"		:	change_name,
			}


and

            conquerorlevel            = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_CONQUEROR)
 

and

 

			if last_playtime <= 0:
				PrepareLastPlay += 1
				self.SetPriorityData(PrepareLastPlay)
				self.myUnitDic[PrepareLastPlay] = self.MyUnit(i, name, level, conquerorlevel, race, playtime, guildname, form, hair, stat_str, stat_dex, stat_hth, stat_int, change_name) #last_playtimeself.myUnitDic[i] = self.MyUnit(i, name, level, race, playtime, guildname, form, hair, stat_str, stat_dex, stat_hth, stat_int, change_name) #last_playtime
			else:
				self.SetPriorityData(last_playtime)
				self.myUnitDic[last_playtime] = self.MyUnit(i, name, level, conquerorlevel, race, playtime, guildname, form, hair, stat_str, stat_dex, stat_hth, stat_int, change_name) #last_playtime

 

and

 

			self.MainStream.InitDataSet(index, DestDataDic["NAME"], DestDataDic["LEVEL"], DestDataDic["CONQUERORLEVEL"], DestDataDic["ID"])

 

and 

 

		if app.ENABLE_CONQUEROR_LEVEL:
			self.ConquerorLevel_FontColor	 = grp.GenerateColor(140.0/255.0, 200.0/255.0, 255.0/255.0, 1.0);

 

		if app.ENABLE_CONQUEROR_LEVEL:
			self.ConquerorLevel_FontColor 	 = None

 

 

so far, everything is very good. 
 

But when the player is at normal level Lv. (Normal Level and level color)

How can I do this when I am at the yohara level Lv. (Yohara level and yohara color). I've tried code many times but it always shows yohara level.

I'm sorry for my bad english.

MY EXAMPLE CODE :

		# if player.GetLevel <= 120:
			# self.CharacterButtonList[slot].AppendTextLine("Lv." + str(level), localeInfo.UI_DEF_FONT, self.Level_FontColor		, "left", width - 42, height*3/4)
		# else:
			# self.CharacterButtonList[slot].AppendTextLine("Lv." + str(conquerorlevel), localeInfo.UI_DEF_FONT, self.ConquerorLevel_FontColor		, "left", width - 42, height*3/4)

		# self.CharacterButtonList[slot].AppendTextLine("Lv." + str(level), localeInfo.UI_DEF_FONT, self.Level_FontColor		, "left", width - 42, height*3/4)

		# if player.GetConquerorLevel >= 1:
			# self.CharacterButtonList[slot].AppendTextLine("Lv." + str(conquerorlevel), localeInfo.UI_DEF_FONT, self.ConquerorLevel_FontColor		, "left", width - 42, height*3/4)
		# else:
			# self.CharacterButtonList[slot].AppendTextLine("Lv." + str(level), localeInfo.UI_DEF_FONT, self.Level_FontColor		, "left", width - 42, height*3/4)

 

Here are a Few Pictures:

spacer.png
 

spacer.png  spacer.png

Thank you for wanting to help.

Edited by Device41
I added 2 pictures.
Link to post

6 answers to this question

Recommended Posts

  • 0

If conqueror level and generic level are different character points, I assume the method player.GetLevel() will not retrieve a sum of both of them.

That leaves us with the condition where you check for player.GetConquerorLevel(), however it seems you forgot to use parenthesis upon calling for this method.

when you return 0 and server doesn't boot:

unknown.png

Link to post
  • 0

here are my module functions for playermodule.cpp.

 

PyObject * playerGetLevel(PyObject* poSelf, PyObject* poArgs)
{
	return Py_BuildValue("i", CPythonPlayer::Instance().GetStatus(POINT_LEVEL));
}
PyObject * playerGetConquerorLevel(PyObject* poSelf, PyObject* poArgs)
{
	return Py_BuildValue("i", CPythonPlayer::Instance().GetStatus(POINT_CONQUEROR_LEVEL));
}

 

		if player.GetConquerorLevel() >= 1:
			self.CharacterButtonList[slot].AppendTextLine("Lv." + str(conquerorlevel), localeInfo.UI_DEF_FONT, self.ConquerorLevel_FontColor		, "left", width - 42, height*3/4)
		else:
			self.CharacterButtonList[slot].AppendTextLine("Lv." + str(level), localeInfo.UI_DEF_FONT, self.Level_FontColor		, "left", width - 42, height*3/4)

When I use it this way, it does not affect in any way. Shows a Yohara level player as 120 levels.

spacer.png

Link to post
  • 0

Ok If you are using the shared system you can with my introselect.py because have all Yohara System, I hope it helps for you, just search for:

 

Quote

if app.ENABLE_CONQUEROR_LEVEL:

 

Quote


import grp
import os
import dbg

import math
import wndMgr
import snd

import systemSetting
import localeInfo


import ui
import uiScriptlocale
import networkModule
import musicInfo
import playerSettingModule
import localeworldard
import event


####################################
# 빠른 실행을 위한 모듈 로딩 분담
####################################
import uiCommon                    
import uiMapNameShower             
import uiAffectShower             
import uiCharacter                 
import uiTarget                    
import consoleModule               
import interfaceModule             
import uiTaskBar                   
import uiInventory
import uiScriptLocale

###################################
import net
import app
import chr
import chrmgr
import player

if app.ENABLE_CONQUEROR_LEVEL:
    import uiToolTip
LEAVE_BUTTON_FOR_POTAL = FALSE
NOT_NEED_DELETE_CODE = FALSE
ENABLE_ENGNUM_DELETE_CODE = FALSE

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 DescWorldIndex(ui.DescWorld.DescWorldIndex):
    def __init__(self, fileName):
        ui.DescWorld.DescWorldIndex.__init__(self)
        self.text=fileName
        self.textLine=self.__CreateTextLine(fileName[:33])  

    def __del__(self):
        ui.DescWorld.DescWorldIndex.__del__(self)

    def GetText(self):
        return self.text

    def __CreateTextLine(self, fileName):
        textLine=ui.TextLine()
        textLine.SetParent(self)
        textLine.SetPosition(0, 0)
        textLine.SetText(fileName)
        textLine.Show()
        return textLine

class SelectCharacterWindow(ui.Window):

    # SLOT4
    #SLOT_COUNT = 3
    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(-60.0, -160.0, -45.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.EmpireImage = {}
        self.curGauge = [0.0, 0.0, 0.0, 0.0]
        self.destGauge = [0.0, 0.0, 0.0, 0.0]
        self.descIndex = 0
        self.fileListBox = 0

        self.dlgBoard = 0
        self.changeNameFlag = FALSE
        self.nameInputBoard = None
        self.sendedChangeNamePacket = FALSE

        self.startIndex = -1
        self.isLoad = 0

        if app.ENABLE_CONQUEROR_LEVEL:
            self.toolTipConquerorInfoButton = None
            
    def __del__(self):
        ui.Window.__del__(self)
        net.SetPhaseWindow(net.PHASE_WINDOW_SELECT, 0)

    def Open(self):
        if not self.__LoadBoardDialog(uiScriptlocale.LOCALE_UISCRIPT_PATH  + "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.Disable()
        self.btnCreate.Show()
        self.btnDelete.Enable()
        self.btnExit.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())
        self.BackGround()
        self.SelectSlotWorl(0)

        if app.ENABLE_CONQUEROR_LEVEL:
            self.btnSungmaPrev.Enable()
            self.btnSungmaNext.Enable()

        app.ShowCursor()

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

        self.stream.popupWindow.Close()

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

        self.dlgBoard = None
        self.btnStart = None
        self.btnCreate = None
        self.btnDelete = None
        self.btnExit = None
        self.backGroundShinsoo = None
        self.backGroundJinnos = None
        self.backGroundChunjo = None
        self.backGroundNone = None
        self.empireName = None
        self.EmpireImage = {}

        self.dlgQuestion.ClearDictionary()
        self.dlgQuestion = None
        self.dlgQuestionText = None
        self.dlgQuestionAcceptButton = None
        self.dlgQuestionCancelButton = None
        self.privateInputBoard = None
        self.nameInputBoard = None

        if app.ENABLE_CONQUEROR_LEVEL:
            self.toolTipConquerorInfoButton = None
            self.btnSungmaPrev = None
            self.btnSungmaNext = None
            
        chr.DeleteInstance(0)
        chr.DeleteInstance(1)
        chr.DeleteInstance(2)
        chr.DeleteInstance(3)

        self.Hide()
        self.KillFocus()

        app.HideCursor()
        event.Destroy()

    def SetEmpire(self, id):
        if self.__AreAllSlotEmpty():
            self.empireName.Hide()
            self.EmpireImage[id].Hide()
            self.backGroundNone.Show()
        else:
            self.empireName.SetText(self.EMPIRE_NAME.get(id, ""))
            if self.EmpireImage.has_key(id):
                self.EmpireImage[id].Show()
        
    def HideAllFlag(self):
        for flag in self.EmpireImage.values():
            flag.Hide()

    def BackGround(self):
        empire = net.GetEmpireID()
        if self.__AreAllSlotEmpty():
            self.backGroundShinsoo.Hide()
            self.backGroundJinnos.Hide()
            self.backGroundChunjo.Hide()
            self.backGroundNone.Show()
        else:
            if empire == 1:
                self.backGroundShinsoo.Show()
                self.backGroundJinnos.Hide()
                self.backGroundChunjo.Hide()
                self.backGroundNone.Hide()
                self.empireName.SetPackedFontColor(0xffBD0514)
            if empire == 2:
                self.backGroundShinsoo.Hide()
                self.backGroundJinnos.Hide()
                self.backGroundChunjo.Show()
                self.backGroundNone.Hide()
                self.empireName.SetPackedFontColor(0xffBDA805)
            if empire == 3:
                self.backGroundShinsoo.Hide()
                self.backGroundJinnos.Show()
                self.backGroundChunjo.Hide()
                self.backGroundNone.Hide()
                self.empireName.SetPackedFontColor(0xff1705BD)

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

            if app.ENABLE_CONQUEROR_LEVEL:
                conquerorlevel = net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_CONQUEROR_LEVEL)
            if id:
                self.MakeCharacter(index, id, name, race, form, hair, acce)
                self.SelectSlot(index)

        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

            #Buttons Go
            self.btnStart        = GetObject("start_button")
            self.btnExit        = GetObject("exit_button")
            self.btnCreate        = GetObject("create_button")
            self.btnDelete        = GetObject("delete_button")
            #Buttons End

            ## Name Job Go
            self.name_warrior= GetObject("name_warrior")
            self.name_assassin= GetObject("name_assassin")
            self.name_sura= GetObject("name_sura")
            self.name_shaman= GetObject("name_shaman")
            self.name_wolfman =GetObject("name_wolfman")
            ## Name Job End

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

            self.textBoard = GetObject("text_board")


            self.CharacterHTH    = GetObject("hth_value")
            self.CharacterINT    = GetObject("int_value")
            self.CharacterSTR    = GetObject("str_value")
            self.CharacterDEX    = GetObject("dex_value")
                
            self.CharacterName_0 = GetObject("CharacterName_0")
            self.CharacterName_1 = GetObject("CharacterName_1")
            self.CharacterName_2 = GetObject("CharacterName_2")
            self.CharacterName_3 = GetObject("CharacterName_3")


            self.CharacterLevel_0 = GetObject("CharacterLevel_0")
            self.CharacterLevel_1 = GetObject("CharacterLevel_1")
            self.CharacterLevel_2 = GetObject("CharacterLevel_2")
            self.CharacterLevel_3 = GetObject("CharacterLevel_3")


            self.CharacterTime_01 = GetObject("CharacterTime_01")
            self.CharacterTime_02 = GetObject("CharacterTime_02")
            self.CharacterTime_03 = GetObject("CharacterTime_03")
            self.CharacterTime_04 = GetObject("CharacterTime_04")


            self.CharacterGuild_01    = GetObject("CharacterGuild_01")
            self.CharacterGuild_02    = GetObject("CharacterGuild_02")
            self.CharacterGuild_03    = GetObject("CharacterGuild_03")
            self.CharacterGuild_04    = GetObject("CharacterGuild_04")
            self.text_board = GetObject("text_board")

            
            self.GaugeList = []
            self.GaugeList.append(GetObject("hth_gauge"))
            self.GaugeList.append(GetObject("int_gauge"))
            self.GaugeList.append(GetObject("str_gauge"))
            self.GaugeList.append(GetObject("dex_gauge"))

            if app.ENABLE_CONQUEROR_LEVEL:
                self.toolTipConquerorInfoButton = uiToolTip.ToolTip()
                
                self.btnSungmaPrev = GetObject("origin_stat_button")
                self.btnSungmaNext = GetObject("sungma_stat_button")
                
                self.HTH_IMG = GetObject("hth_img")
                self.INT_IMG = GetObject("int_img")
                self.STR_IMG = GetObject("str_img")
                self.DEX_IMG = GetObject("dex_img")
                
                
                self.HTH_IMG.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowHTHToolTip)
                self.HTH_IMG.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideHTHToolTip)
                
                self.INT_IMG.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowINTToolTip)
                self.INT_IMG.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideINTToolTip)
                
                self.STR_IMG.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowSTRToolTip)
                self.STR_IMG.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideSTRToolTip)
                
                self.DEX_IMG.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowDEXToolTip)
                self.DEX_IMG.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideDEXToolTip)


                self.SUNGMA_ST_IMG = GetObject("sungma_str_img")
                self.SUNGMA_HP_IMG = GetObject("sungma_hp_img")
                self.SUNGMA_MOVE_IMG = GetObject("sungma_move_img")
                self.SUNGMA_INMUNE_IMG = GetObject("sungma_immune_img")

                self.SUNGMA_ST_IMG.Hide()
                self.SUNGMA_HP_IMG.Hide()
                self.SUNGMA_MOVE_IMG.Hide()
                self.SUNGMA_INMUNE_IMG.Hide()
                
                self.SUNGMA_ST_IMG.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowSTToolTip)
                self.SUNGMA_ST_IMG.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideSTToolTip)
                
                self.SUNGMA_HP_IMG.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowHPToolTip)
                self.SUNGMA_HP_IMG.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideHPToolTip)
                
                self.SUNGMA_MOVE_IMG.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowMOVEToolTip)
                self.SUNGMA_MOVE_IMG.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideMOVEToolTip)
                
                self.SUNGMA_INMUNE_IMG.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowINMUNEToolTip)
                self.SUNGMA_INMUNE_IMG.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideINMUNEToolTip)
                
                
            self.CharacterFace_0 = GetObject("CharacterFace_0")
            self.CharacterFace_0.Hide()
            self.CharacterFace_1 = GetObject("CharacterFace_1")
            self.CharacterFace_1.Hide()
            self.CharacterFace_2 = GetObject("CharacterFace_2")
            self.CharacterFace_2.Hide()
            self.CharacterFace_3 = GetObject("CharacterFace_3")
            self.CharacterFace_3.Hide()

            self.CharacterSlot = []
            self.CharacterSlot.append(GetObject("CharacterSlot_0"))
            self.CharacterSlot.append(GetObject("CharacterSlot_1"))
            self.CharacterSlot.append(GetObject("CharacterSlot_2"))
            self.CharacterSlot.append(GetObject("CharacterSlot_3"))

            self.DiscFace = GetObject("DiscFace")
            self.DiscFace.Hide()
            self.raceName_Text = GetObject("raceName_Text")

            self.Board_Date_1 = GetObject("board_date_01")
            self.Board_Date_1.Hide()
            self.Board_Date_2 = GetObject("board_date_02")
            self.Board_Date_2.Hide()
            self.Board_Date_3 = GetObject("board_date_03")
            self.Board_Date_3.Hide()
            self.Board_Date_4 = GetObject("board_date_04")
            self.Board_Date_4.Hide()


            self.backGroundShinsoo = GetObject("backGroundShinsoo")
            self.backGroundJinnos = GetObject("backGroundJinnos")
            self.backGroundChunjo = GetObject("backGroundChunjo")
            self.backGroundNone = GetObject("backGroundNone")

            self.ButtonUp = ui.ButtonWorldArdUp()
            self.ButtonUp.SetParent(self.textBoard)
            self.ButtonUp.SetPosition(122,250)
            self.ButtonUp.SetButtonDownSize(160)
            self.ButtonUp.SetScrollStep(1.4)
            self.ButtonUp.Show()

            self.ButtonDown = ui.ButtonWorldArdDown()
            self.ButtonDown.SetParent(self.textBoard)
            self.ButtonDown.SetPosition(122 + 20 + 10,250)
            self.ButtonDown.SetButtonDownSize(160)
            self.ButtonDown.SetScrollStep(1.4)
            self.ButtonDown.Show()


            self.fileListBox = ui.DescWorld()
            self.fileListBox.SetParent(self.textBoard)
            self.fileListBox.SetPosition(20, 20)
            self.fileListBox.SetViewLines(11)
            self.fileListBox.ButtonWorldArdDown(self.ButtonDown)
            self.fileListBox.ButtonWorldArdUp(self.ButtonUp)
            self.fileListBox.Show()

                    
        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.btnExit.SetEvent(ui.__mem_func__(self.ExitSelect))
        self.CharacterSlot[0].SAFE_SetEvent(self.__CharacterSlot_01)
        self.CharacterSlot[1].SAFE_SetEvent(self.__CharacterSlot_11)
        self.CharacterSlot[2].SAFE_SetEvent(self.__CharacterSlot_21)
        self.CharacterSlot[3].SAFE_SetEvent(self.__CharacterSlot_31)

        if app.ENABLE_CONQUEROR_LEVEL:
            self.btnSungmaPrev.SetEvent(ui.__mem_func__(self.SungmaPrev))
            self.btnSungmaNext.SetEvent(ui.__mem_func__(self.SungmaNext))
                
        if NOT_NEED_DELETE_CODE:
            self.btnDelete.SetEvent(ui.__mem_func__(self.PopupDeleteQuestion))
        else:
            self.btnDelete.SetEvent(ui.__mem_func__(self.InputPrivateCode))

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

        self.chrRenderer1 = self.CharacterRenderer()
        self.chrRenderer1.SetParent(self.backGroundJinnos)
        self.chrRenderer1.Show()

        self.chrRenderer2 = self.CharacterRenderer()
        self.chrRenderer2.SetParent(self.backGroundChunjo)
        self.chrRenderer2.Show()

        self.chrRenderer3 = self.CharacterRenderer()
        self.chrRenderer3.SetParent(self.backGroundNone)
        self.chrRenderer3.Show()

        return 1

    if app.ENABLE_CONQUEROR_LEVEL:
    
        def SungmaPrev(self):
            self.SUNGMA_ST_IMG.Hide()
            self.SUNGMA_HP_IMG.Hide()
            self.SUNGMA_MOVE_IMG.Hide()
            self.SUNGMA_INMUNE_IMG.Hide()
            
            valueHTH=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_HTH)
            valueINT=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_INT)
            valueSTR=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_STR)
            valueDEX=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_DEX)
                
            self.CharacterHTH.SetText(str(valueHTH))
            self.CharacterINT.SetText(str(valueINT))
            self.CharacterSTR.SetText(str(valueSTR))
            self.CharacterDEX.SetText(str(valueDEX))

            self.destGauge = [0.0, 0.0, 0.0, 0.0]
            statesSummary = float(valueHTH + valueINT + valueSTR + valueDEX)
            if statesSummary > 0.0:
                self.destGauge =    [
                                        float(valueHTH) / statesSummary,
                                        float(valueINT) / statesSummary,
                                        float(valueSTR) / statesSummary,
                                        float(valueDEX) / statesSummary
                                    ]
                                    
            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)

            
        def SungmaNext(self):
            self.SUNGMA_ST_IMG.Show()
            self.SUNGMA_HP_IMG.Show()
            self.SUNGMA_MOVE_IMG.Show()
            self.SUNGMA_INMUNE_IMG.Show()
            
            valueConquerorST=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_SUNGMA_ST)
            valueConquerorHP=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_SUNGMA_HP)
            valueConquerorMOVE=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_SUNGMA_MOVE)
            valueConquerorINMUNE=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_SUNGMA_INMUNE)    
                
            self.CharacterHTH.SetText(str(valueConquerorST))
            self.CharacterINT.SetText(str(valueConquerorHP))
            self.CharacterSTR.SetText(str(valueConquerorMOVE))
            self.CharacterDEX.SetText(str(valueConquerorINMUNE))
            
            self.destGauge = [0.0, 0.0, 0.0, 0.0]
            statesSummary = float(valueConquerorST + valueConquerorHP + valueConquerorMOVE + valueConquerorINMUNE)
            if statesSummary > 0.0:
                self.destGauge =    [
                                        float(valueConquerorST) / statesSummary,
                                        float(valueConquerorHP) / statesSummary,
                                        float(valueConquerorMOVE) / statesSummary,
                                        float(valueConquerorINMUNE) / statesSummary
                                    ]
            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)
            
        def __ShowHTHToolTip(self):
            self.toolTipConquerorInfoButton.ClearToolTip()
            self.toolTipConquerorInfoButton.AutoAppendTextLine(localeInfo.STAT_TOOLTIP_IMG_CON)
            self.toolTipConquerorInfoButton.AlignHorizonalCenter()
            
            self.toolTipConquerorInfoButton.ShowToolTip()

        def __HideHTHToolTip(self):
            self.toolTipConquerorInfoButton.HideToolTip()

        def __ShowINTToolTip(self):
            self.toolTipConquerorInfoButton.ClearToolTip()
            self.toolTipConquerorInfoButton.AutoAppendTextLine(localeInfo.STAT_TOOLTIP_IMG_INT)
            self.toolTipConquerorInfoButton.AlignHorizonalCenter()
            
            self.toolTipConquerorInfoButton.ShowToolTip()

        def __HideINTToolTip(self):
            self.toolTipConquerorInfoButton.HideToolTip()

        def __ShowSTRToolTip(self):
            self.toolTipConquerorInfoButton.ClearToolTip()
            self.toolTipConquerorInfoButton.AutoAppendTextLine(localeInfo.STAT_TOOLTIP_IMG_STR)
            self.toolTipConquerorInfoButton.AlignHorizonalCenter()
            
            self.toolTipConquerorInfoButton.ShowToolTip()

        def __HideSTRToolTip(self):
            self.toolTipConquerorInfoButton.HideToolTip()
            
        def __ShowDEXToolTip(self):
            self.toolTipConquerorInfoButton.ClearToolTip()
            self.toolTipConquerorInfoButton.AutoAppendTextLine(localeInfo.STAT_TOOLTIP_IMG_DEX)
            self.toolTipConquerorInfoButton.AlignHorizonalCenter()
            
            self.toolTipConquerorInfoButton.ShowToolTip()

        def __HideDEXToolTip(self):
            self.toolTipConquerorInfoButton.HideToolTip()

        #Sungma
        def __ShowSTToolTip(self):
            self.toolTipConquerorInfoButton.ClearToolTip()
            self.toolTipConquerorInfoButton.AutoAppendTextLine(localeInfo.STAT_TOOLTIP_SUNGMA_STR)
            self.toolTipConquerorInfoButton.AlignHorizonalCenter()
            
            self.toolTipConquerorInfoButton.ShowToolTip()

        def __HideSTToolTip(self):
            self.toolTipConquerorInfoButton.HideToolTip()

        def __ShowHPToolTip(self):
            self.toolTipConquerorInfoButton.ClearToolTip()
            self.toolTipConquerorInfoButton.AutoAppendTextLine(localeInfo.STAT_TOOLTIP_SUNGMA_HP)
            self.toolTipConquerorInfoButton.AlignHorizonalCenter()
            
            self.toolTipConquerorInfoButton.ShowToolTip()

        def __HideHPToolTip(self):
            self.toolTipConquerorInfoButton.HideToolTip()

        def __ShowMOVEToolTip(self):
            self.toolTipConquerorInfoButton.ClearToolTip()
            self.toolTipConquerorInfoButton.AutoAppendTextLine(localeInfo.STAT_TOOLTIP_SUNGMA_MOVE)
            self.toolTipConquerorInfoButton.AlignHorizonalCenter()
            
            self.toolTipConquerorInfoButton.ShowToolTip()

        def __HideMOVEToolTip(self):
            self.toolTipConquerorInfoButton.HideToolTip()
            
        def __ShowINMUNEToolTip(self):
            self.toolTipConquerorInfoButton.ClearToolTip()
            self.toolTipConquerorInfoButton.AutoAppendTextLine(localeInfo.STAT_TOOLTIP_SUNGMA_INMUNE)
            self.toolTipConquerorInfoButton.AlignHorizonalCenter()
            
            self.toolTipConquerorInfoButton.ShowToolTip()

        def __HideINMUNEToolTip(self):
            self.toolTipConquerorInfoButton.HideToolTip()
            
    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)
        if acce == 100:
            chr.SetAcce(acce, 99)
        else:
            chr.SetAcce(acce, 0)
        chr.Refresh()
        chr.SetMotionMode(chr.MOTION_MODE_GENERAL)
        chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)

        chr.SetRotation(0.0)

    def __ClickRadioButton(self, buttonList, buttonIndex):
        try:
            selButton=buttonList[buttonIndex]
        except IndexError:
            return

        for eachButton in buttonList:
            eachButton.SetUp()

        selButton.Down()

    def SelectSlotWorl(self, index):
        self.SelectSlot(index)
        self.__ClickRadioButton(self.CharacterSlot, index)

    def __CharacterSlot_01(self):
        self.SelectSlotWorl(0)
        

    def __CharacterSlot_11(self):
        self.SelectSlotWorl(1)
    

    def __CharacterSlot_21(self):
        self.SelectSlotWorl(2)
    

    def __CharacterSlot_31(self):
        self.SelectSlotWorl(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.btnStart.Disable()
        self.btnCreate.Disable()
        self.btnDelete.Disable()
        self.btnExit.Disable()
        self.dlgQuestion.Hide()

        self.stream.SetCharacterSlot(self.slot)
        
        if app.ENABLE_CONQUEROR_LEVEL:
            self.btnSungmaNext.SetUp()
            self.btnSungmaPrev.SetUp()
            self.btnSungmaNext.Disable()
            self.btnSungmaPrev.Disable()
            
        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_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):
        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_PRIVATE_CODE_DIALOG_TITLE)
        privateInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrivateCode))
        privateInputBoard.SetCancelEvent(ui.__mem_func__(self.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)

    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 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.btnCreate.Show()
        self.btnStart.Show()
        self.btnDelete.Show()


        self.destGauge = [0.0, 0.0, 0.0, 0.0]

                

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

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

            level=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
            if app.ENABLE_CONQUEROR_LEVEL:
                conquerorlevel=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_CONQUEROR_LEVEL)
            race=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_RACE)
            race_text=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_RACE)
            race_img=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_RACE)
            name=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_NAME)
            race_descrip=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_RACE)
            form=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_FORM)
            hair=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_HAIR)
            acce=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_ACCE)
            self.changeNameFlag=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_CHANGE_NAME_FLAG)
            valueHTH=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_HTH)
            valueINT=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_INT)
            valueSTR=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_STR)
            valueDEX=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_DEX)
            playTime=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
            guildName=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME)
            
            if id:
                self.MakeCharacter(self.slot, id, name, race, form, hair, acce)

            if race_text == 0 or race_text == 4:
                race_text = localeworldard.Warrior
            elif race_text == 1 or race_text == 5:
                race_text = localeworldard.Assasin
            elif race_text == 2 or race_text == 6:
                race_text = localeworldard.Sura
            elif race_text == 3 or race_text == 7:
                race_text = localeworldard.Shaman
            elif race_text == 8:
                race_text = localeworldard.WolfMan

            if race_img == 0 or race_img == 4:
                self.name_warrior.Show()
                self.name_assassin.Hide()
                self.name_sura.Hide()
                self.name_shaman.Hide()
                self.name_wolfman.Hide()
            elif race_img == 1 or race_img == 5:
                self.name_assassin.Show()
                self.name_warrior.Hide()
                self.name_sura.Hide()
                self.name_shaman.Hide()
                self.name_wolfman.Hide()
            elif race_img == 2 or race_img == 6:
                self.name_sura.Show()
                self.name_assassin.Hide()
                self.name_warrior.Hide()
                self.name_shaman.Hide()
                self.name_wolfman.Hide()
            elif race_img == 3 or race_img == 7:
                self.name_shaman.Show()
                self.name_assassin.Hide()
                self.name_sura.Hide()
                self.name_warrior.Hide()
                self.name_wolfman.Hide()
            elif race_img == 8:
                self.name_shaman.Hide()
                self.name_assassin.Hide()
                self.name_sura.Hide()
                self.name_warrior.Hide()
                self.name_wolfman.Show()

            if race_descrip == 0 or race_descrip == 4:
                f = pack_open(localeworldard.DESCRIPTION_FILE_NAME["RACE_WARRIOR"],'r')        
            elif race_descrip == 1 or race_descrip == 5:
                f = pack_open(localeworldard.DESCRIPTION_FILE_NAME["RACE_ASSASSIN"],'r')
            elif race_descrip == 2 or race_descrip == 6:
                f = pack_open(localeworldard.DESCRIPTION_FILE_NAME["RACE_SURA"],'r')                
            elif race_descrip == 3 or race_descrip == 7:
                f = pack_open(localeworldard.DESCRIPTION_FILE_NAME["RACE_SHAMAN"],'r')
            elif race_descrip == 8:
                f = pack_open(localeworldard.DESCRIPTION_FILE_NAME["RACE_WOLFMAN"],'r')

            self.fileListBox.RemoveAllItems()
            race_descrip
            lines = f.readlines()
            for i in lines:
                self.fileListBox.AppendItem(DescWorldIndex(i.replace("[World]", "")))
                
            self.raceName_Text.SetText(str(race_text))

            self.CharacterHTH.SetText(str(valueHTH))
            self.CharacterINT.SetText(str(valueINT))
            self.CharacterSTR.SetText(str(valueSTR))
            self.CharacterDEX.SetText(str(valueDEX))


            if self.slot == 0:
                self.CharacterFace_0.LoadImage(localeworldard.CharacterFace[race])
                self.DiscFace.LoadImage(localeworldard.DiscFace[race])
                self.CharacterName_0.SetText(name)
                if app.ENABLE_CONQUEROR_LEVEL:
                    if conquerorlevel:
                        self.CharacterLevel_0.SetText("Lv."+str(conquerorlevel))
                        self.CharacterLevel_0.SetPackedFontColor(0xFFBFD9FF)
                    else:
                        self.CharacterLevel_0.SetText("Lv."+str(level))
                else:
                    self.CharacterLevel_0.SetText("Lv."+str(level))
                self.CharacterTime_01.SetText(str(playTime))
                self.CharacterGuild_01.SetText(guildName)
                self.DiscFace.Show()
                self.CharacterFace_0.Show()
                self.Board_Date_1.Show()
                self.Board_Date_2.Hide()
                self.Board_Date_3.Hide()
                self.Board_Date_4.Hide()    
                if guildName:
                    self.CharacterGuild_01.SetText(guildName)
                else:
                    self.CharacterGuild_01.SetText(localeworldard.NotGuild)
                second = int(playTime * 60) ##Minutos a Segundos
                horas = int(second / 3600)
                minutos = int((second - (horas * 3600)) / 60)

                if horas == 0:
                    self.CharacterTime_01.SetText(str(minutos)+localeworldard.Minutos)
                if horas > 0:
                    self.CharacterTime_01.SetText(str(horas)+localeworldard.Horas+str(minutos)+localeworldard.Minutos)            
        
            elif self.slot == 1:
                import time
                self.CharacterFace_1.LoadImage(localeworldard.CharacterFace[race])
                self.DiscFace.LoadImage(localeworldard.DiscFace[race])
                self.CharacterName_1.SetText(name)
                if app.ENABLE_CONQUEROR_LEVEL:
                    if conquerorlevel:
                        self.CharacterLevel_1.SetText("Lv."+str(conquerorlevel))
                        self.CharacterLevel_1.SetPackedFontColor(0xFFBFD9FF)
                    else:
                        self.CharacterLevel_1.SetText("Lv."+str(level))
                else:
                    self.CharacterLevel_1.SetText("Lv."+str(level))
                self.CharacterGuild_02.SetText(guildName)
                self.DiscFace.Show()
                self.Board_Date_1.Hide()
                self.Board_Date_2.Show()
                self.Board_Date_3.Hide()
                self.Board_Date_4.Hide()
                self.CharacterFace_1.Show()
                if guildName:
                    self.CharacterGuild_02.SetText(guildName)
                else:
                    self.CharacterGuild_02.SetText(localeworldard.NotGuild)

                second = int(playTime * 60) ##Minutos a Segundos
                horas = int(second / 3600)
                minutos = int((second - (horas * 3600)) / 60)

                if horas == 0:
                    self.CharacterTime_02.SetText(str(minutos)+localeworldard.Minutos)
                if horas > 0:
                    self.CharacterTime_02.SetText(str(horas)+localeworldard.Horas+str(minutos)+localeworldard.Minutos)
                
            elif self.slot == 2:
                self.CharacterFace_2.LoadImage(localeworldard.CharacterFace[race])
                self.DiscFace.LoadImage(localeworldard.DiscFace[race])
                self.CharacterName_2.SetText(name)
                if app.ENABLE_CONQUEROR_LEVEL:
                    if conquerorlevel:
                        self.CharacterLevel_2.SetText("Lv."+str(conquerorlevel))
                        self.CharacterLevel_2.SetPackedFontColor(0xFFBFD9FF)
                    else:
                        self.CharacterLevel_2.SetText("Lv."+str(level))
                else:
                    self.CharacterLevel_2.SetText("Lv."+str(level))
                self.Board_Date_1.Hide()
                self.Board_Date_2.Hide()
                self.Board_Date_3.Show()
                self.Board_Date_4.Hide()
                self.DiscFace.Show()
                self.CharacterFace_2.Show()
                if guildName:
                    self.CharacterGuild_03.SetText(guildName)
                else:
                    self.CharacterGuild_03.SetText(localeworldard.NotGuild)
                second = int(playTime * 60) ##Minutos a Segundos
                horas = int(second / 3600)
                minutos = int((second - (horas * 3600)) / 60)

                if horas == 0:
                    self.CharacterTime_03.SetText(str(minutos)+localeworldard.Minutos)
                if horas > 0:
                    self.CharacterTime_03.SetText(str(horas)+localeworldard.Horas+str(minutos)+localeworldard.Minutos)
                    
            elif self.slot == 3:
                self.CharacterFace_3.LoadImage(localeworldard.CharacterFace[race])
                self.DiscFace.LoadImage(localeworldard.DiscFace[race])
                self.CharacterName_3.SetText(name)
                if app.ENABLE_CONQUEROR_LEVEL:
                    if conquerorlevel:
                        self.CharacterLevel_3.SetText("Lv."+str(conquerorlevel))
                        self.CharacterLevel_3.SetPackedFontColor(0xFFBFD9FF)
                    else:
                        self.CharacterLevel_3.SetText("Lv."+str(level))
                else:
                    self.CharacterLevel_3.SetText("Lv."+str(level))
                self.DiscFace.Show()
                self.Board_Date_1.Hide()
                self.Board_Date_2.Hide()
                self.Board_Date_3.Hide()
                self.Board_Date_4.Show()
                self.CharacterFace_3.Show()
                if guildName:
                    self.CharacterGuild_04.SetText(guildName)
                else:
                    self.CharacterGuild_04.SetText(localeworldard.NotGuild)
                second = int(playTime * 60) ##Minutos a Segundos
                horas = int(second / 3600)
                minutos = int((second - (horas * 3600)) / 60)

                if horas == 0:
                    self.CharacterTime_04.SetText(str(minutos)+localeworldard.Minutos)
                if horas > 0:
                    self.CharacterTime_04.SetText(str(horas)+localeworldard.Horas+str(minutos)+localeworldard.Minutos)
                

            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.btnStart.Hide()
        self.btnDelete.Disable()
        self.btnDelete.Hide()
        self.btnCreate.Show()
        self.btnCreate.Enable()
        self.CharacterHTH.SetText("")
        self.CharacterINT.SetText("")
        self.CharacterSTR.SetText("")
        self.CharacterDEX.SetText("")
        self.raceName_Text.SetText("")
        self.name_shaman.Hide()
        self.name_assassin.Hide()
        self.name_sura.Hide()
        self.name_warrior.Hide()
        self.name_wolfman.Hide()        
        self.DiscFace.Hide()
        self.Board_Date_1.Hide()
        self.Board_Date_2.Hide()
        self.Board_Date_3.Hide()
        self.Board_Date_4.Hide()
        self.fileListBox.RemoveAllItems()

        id = self.GetCharacterSlotID(0)
        id1 = self.GetCharacterSlotID(1)
        id2 = self.GetCharacterSlotID(2)
        id3 = self.GetCharacterSlotID(3)
        if 0==id:
            self.CharacterName_0.SetText("")
            self.CharacterLevel_0.SetText("")
            self.CharacterFace_0.Hide()
        if 0==id1:
            self.CharacterName_1.SetText("")
            self.CharacterLevel_1.SetText("")
            self.CharacterFace_1.Hide()
        if 0==id2:
            self.CharacterName_2.SetText("")
            self.CharacterLevel_2.SetText("")
            self.CharacterFace_2.Hide()
        if 0==id3:
            self.CharacterName_3.SetText("")
            self.CharacterLevel_3.SetText("")
            self.CharacterFace_3.Hide()
        if self.__AreAllSlotEmpty():
            self.empireName.SetText("")
            self.EmpireImage[1].Hide()
            self.EmpireImage[2].Hide()
            self.EmpireImage[3].Hide()
    ## 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:

            ## Temporary
            ## BackGroundLoading이 지원 될때까지 임시로..
            if app.GetTime() - self.startReservingTime > 3.0:
                if FALSE == self.openLoadingFlag:
                    chrSlot=self.stream.GetCharacterSlot()
                    net.DirectEnter(chrSlot)
                    self.openLoadingFlag = TRUE

                    playTime=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)

                    
                    player.SetPlayTime(playTime)
                    import chat
                    chat.Clear() ## 들어갈때 Chat 을 초기화. 임시 Pos.
            ## Temporary
        #######################################################

    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

 

Edited by Rakancito
  • Love 1
Link to post
  • 0
On 4/27/2021 at 4:00 AM, Rakancito said:

Ok If you are using the shared system you can with my introselect.py because have all Yohara System, I hope it helps for you, just search for:

 

 

 

I apologize from you.

But my introselect.py file is not the same as your file. Therefore I can make mistakes. If I ask you, can you adapt it to me? Really thank you so much. you are very good person.


 

import chr
import grp
import app
import wndMgr
import net
import snd
import musicInfo
import event
import systemSetting
import localeInfo

import ui
import uiToolTip
import uiScriptLocale
import networkModule
import playerSettingModule

####################################
# Module loading sharing for fast execution
####################################

import uiCommon
import uiMapNameShower
import uiAffectShower
import uiPlayerGauge
import uiCharacter
import uiTarget
import interfaceModule
import uiTaskBar
import uiInventory

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

ENABLE_ENGNUM_DELETE_CODE = True

M2_INIT_VALUE = -1
CHARACTER_SLOT_COUNT_MAX = 5

JOB_WARRIOR		= 0
JOB_ASSASSIN	= 1
JOB_SURA		= 2
JOB_SHAMAN		= 3
JOB_WOLFMAN		= 4

M2_CONST_ID = 	(
	(playerSettingModule.RACE_WARRIOR_M, playerSettingModule.RACE_WARRIOR_W),
	(playerSettingModule.RACE_ASSASSIN_M, playerSettingModule.RACE_ASSASSIN_W),
	(playerSettingModule.RACE_SURA_M, playerSettingModule.RACE_SURA_W),
	(playerSettingModule.RACE_SHAMAN_M, playerSettingModule.RACE_SHAMAN_W),
	(playerSettingModule.RACE_WOLFMAN_M, -1),
)


class MyCharacters:
	class MyUnit:
		#def __init__(self, const_id, name, level, race, playtime, guildname, form, hair, acce, stat_str, stat_dex, stat_hth, stat_int, change_name):
		def __init__(self, const_id, name, level, race, playtime, guildname, form, hair, stat_str, stat_dex, stat_hth, stat_int, change_name):
			self.UnitDataDic = {
				"ID" 	: 	const_id,
				"NAME"	:	name,
				"LEVEL"	:	level,
				"RACE"	:	race,
				"PLAYTIME"	:	playtime,
				"GUILDNAME"	:	guildname,
				"FORM"	:	form,
				"HAIR"	:	hair,
				#"ACCE"	:	acce,
				"STR"	:	stat_str,
				"DEX"	:	stat_dex,
				"HTH"	:	stat_hth,
				"INT"	:	stat_int,
				"CHANGENAME"	:	change_name,
			}

		def __del__(self):
			#print self.UnitDataDic["NAME"]
			self.UnitDataDic = None

		def GetUnitData(self):
			return self.UnitDataDic

	def __init__(self, stream):
		self.MainStream = stream
		self.PriorityData = []
		self.myUnitDic = {}
		self.HowManyChar = 0
		self.EmptySlot	=  []
		self.Race 		= [None, None, None, None, None]
		self.Job		= [None, None, None, None, None]
		self.Guild_Name = [None, None, None, None, None]
		self.Play_Time 	= [None, None, None, None, None]
		self.Change_Name= [None, None, None, None, None]
		self.Stat_Point = { 0: None, 1: None, 2: None, 3: None, 4: None }

	def __del__(self):
		self.MainStream = None

		for i in xrange(self.HowManyChar):
			chr.DeleteInstance(i)

		self.PriorityData = None
		self.myUnitDic = None
		self.HowManyChar = None
		self.EmptySlot	= None
		self.Race = None
		self.Job = None
		self.Guild_Name = None
		self.Play_Time = None
		self.Change_Name = None
		self.Stat_Point = None

	def Show(self):
		self.LoadCharacterData()

	def LoadCharacterData(self):
		self.RefreshData()
		self.MainStream.All_ButtonInfoHide()
		PrepareLastPlay = 0
		for i in xrange(CHARACTER_SLOT_COUNT_MAX):
			pid = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_ID)

			if not pid:
				self.EmptySlot.append(i)
				continue

			name 			= net.GetAccountCharacterSlotDataString(i, net.ACCOUNT_CHARACTER_SLOT_NAME)
			level 			= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
			race 			= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_RACE)
			playtime 		= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
			guildname 		= net.GetAccountCharacterSlotDataString(i, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME)
			form 			= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_FORM)
			hair 			= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_HAIR)
			stat_str 		= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_STR)
			stat_dex		= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_DEX)
			stat_hth		= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_HTH)
			stat_int		= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_INT)
			last_playtime	= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_LAST_PLAYTIME) #net.ACCOUNT_CHARACTER_SLOT_LAST_PLAYTIME
			change_name		= net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_CHANGE_NAME_FLAG)
			#acce = net.GetAccountCharacterSlotDataInteger(i, net.ACCOUNT_CHARACTER_SLOT_ACCE)

			if last_playtime <= 0:
				PrepareLastPlay += 1
				self.SetPriorityData(PrepareLastPlay)
				self.myUnitDic[PrepareLastPlay] = self.MyUnit(i, name, level, race, playtime, guildname, form, hair, stat_str, stat_dex, stat_hth, stat_int, change_name) #last_playtimeself.myUnitDic[i] = self.MyUnit(i, name, level, race, playtime, guildname, form, hair, stat_str, stat_dex, stat_hth, stat_int, change_name) #last_playtime
			else:
				self.SetPriorityData(last_playtime)
				self.myUnitDic[last_playtime] = self.MyUnit(i, name, level, race, playtime, guildname, form, hair, stat_str, stat_dex, stat_hth, stat_int, change_name) #last_playtime

			#self.myUnitDic[i] = self.MyUnit(i, name, level, race, playtime, guildname, form, hair, acce, stat_str, stat_dex, stat_hth, stat_int, change_name) #last_playtime
			#self.myUnitDic[i] = self.MyUnit(i, name, level, race, playtime, guildname, form, hair, stat_str, stat_dex, stat_hth, stat_int, change_name) #last_playtime

		try: #python > 2.4
			self.PriorityData.sort(reverse = True)
		except:
			pass

		for index, data in enumerate(self.PriorityData):
			DestDataDic = self.myUnitDic[data].GetUnitData()

			self.SetSortingData(index, DestDataDic["RACE"], DestDataDic["GUILDNAME"], DestDataDic["PLAYTIME"], DestDataDic["STR"], DestDataDic["DEX"], DestDataDic["HTH"], DestDataDic["INT"], DestDataDic["CHANGENAME"])

			#self.MakeCharacter(i, DestDataDic["NAME"], DestDataDic["RACE"], DestDataDic["FORM"], DestDataDic["HAIR"], DestDataDic["ACCE"])
			self.MakeCharacter(index, DestDataDic["NAME"], DestDataDic["RACE"], DestDataDic["FORM"], DestDataDic["HAIR"])

			self.MainStream.InitDataSet(index, DestDataDic["NAME"], DestDataDic["LEVEL"], DestDataDic["ID"])

		## Default Setting ##
		if self.HowManyChar:
			self.MainStream.SelectButton(0)

		return self.HowManyChar

	def SetPriorityData(self, last_playtime):
		self.PriorityData.append(last_playtime)

	#def MakeCharacter(self, slot, name, race, form, hair, acce):
	def MakeCharacter(self, slot, name, race, form, hair):
		chr.CreateInstance(slot)
		chr.SelectInstance(slot)
		chr.SetVirtualID(slot)
		chr.SetNameString(name)

		chr.SetRace(race)
		chr.SetArmor(form)
		chr.SetHair(hair)
		#chr.SetAcce(acce)

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

		if chr.RaceToJob(race) == JOB_WOLFMAN:
			chr.SetScale(0.95,0.95,0.95)

		chr.SetRotation(0.0)
		chr.Hide()

	def SetSortingData(self, slot, race, guildname, playtime, pStr, pDex, pHth, pInt, changename):
		self.HowManyChar += 1
		self.Race[slot] = race
		self.Job[slot] = chr.RaceToJob(race)
		self.Guild_Name[slot] = guildname
		self.Play_Time[slot] = playtime
		self.Change_Name[slot] = changename
		self.Stat_Point[slot] = [pHth, pInt, pStr, pDex]

	def GetRace(self, slot):
		return self.Race[slot]

	def GetJob(self, slot):
		return self.Job[slot]

	def GetMyCharacterCount(self):
		return self.HowManyChar

	def GetEmptySlot(self):
		if not len(self.EmptySlot):
			return M2_INIT_VALUE

		#print "GetEmptySlot %s" % self.EmptySlot[0]
		return self.EmptySlot[0]

	def GetStatPoint(self, slot):
		return self.Stat_Point[slot]

	def GetGuildNamePlayTime(self, slot):
		return self.Guild_Name[slot], self.Play_Time[slot]

	def GetChangeName(self, slot):
		return self.Change_Name[slot]

	def SetChangeNameSuccess(self, slot):
		self.Change_Name[slot] = 0

	def RefreshData(self):
		self.HowManyChar = 0
		self.EmptySlot	=  []
		self.PriorityData = []
		self.Race 		= [None, None, None, None, None]
		self.Guild_Name = [None, None, None, None, None]
		self.Play_Time 	= [None, None, None, None, None]
		self.Change_Name= [None, None, None, None, None]
		self.Stat_Point = { 0: None, 1: None, 2: None, 3: None, 4: None }


class SelectCharacterWindow(ui.Window):
	EMPIRE_NAME = {
		net.EMPIRE_A: localeInfo.EMPIRE_A,
		net.EMPIRE_B: localeInfo.EMPIRE_B,
		net.EMPIRE_C: localeInfo.EMPIRE_C
	}
	EMPIRE_NAME_COLOR = {
		net.EMPIRE_A: (0.7450, 0, 0),
		net.EMPIRE_B: (0.8666, 0.6156, 0.1843),
		net.EMPIRE_C: (0.2235, 0.2549, 0.7490)
	}
	RACE_FACE_PATH = {
		playerSettingModule.RACE_WARRIOR_M		:	"D:/ymir work/ui/intro/public_intro/face/face_warrior_m_0",
		playerSettingModule.RACE_ASSASSIN_W		:	"D:/ymir work/ui/intro/public_intro/face/face_assassin_w_0",
		playerSettingModule.RACE_SURA_M			:	"D:/ymir work/ui/intro/public_intro/face/face_sura_m_0",
		playerSettingModule.RACE_SHAMAN_W		:	"D:/ymir work/ui/intro/public_intro/face/face_shaman_w_0",
		playerSettingModule.RACE_WARRIOR_W		:	"D:/ymir work/ui/intro/public_intro/face/face_warrior_w_0",
		playerSettingModule.RACE_ASSASSIN_M		:	"D:/ymir work/ui/intro/public_intro/face/face_assassin_m_0",
		playerSettingModule.RACE_SURA_W			:	"D:/ymir work/ui/intro/public_intro/face/face_sura_w_0",
		playerSettingModule.RACE_SHAMAN_M		:	"D:/ymir work/ui/intro/public_intro/face/face_shaman_m_0",
		playerSettingModule.RACE_WOLFMAN_M		:	"D:/ymir work/ui/intro/public_intro/face/face_wolfman_m_0",
	}
	DISC_FACE_PATH = {
		playerSettingModule.RACE_WARRIOR_M		:"d:/ymir work/bin/icon/face/warrior_m.tga",
		playerSettingModule.RACE_ASSASSIN_W		:"d:/ymir work/bin/icon/face/assassin_w.tga",
		playerSettingModule.RACE_SURA_M			:"d:/ymir work/bin/icon/face/sura_m.tga",
		playerSettingModule.RACE_SHAMAN_W		:"d:/ymir work/bin/icon/face/shaman_w.tga",
		playerSettingModule.RACE_WARRIOR_W		:"d:/ymir work/bin/icon/face/warrior_w.tga",
		playerSettingModule.RACE_ASSASSIN_M		:"d:/ymir work/bin/icon/face/assassin_m.tga",
		playerSettingModule.RACE_SURA_W			:"d:/ymir work/bin/icon/face/sura_w.tga",
		playerSettingModule.RACE_SHAMAN_M		:"d:/ymir work/bin/icon/face/shaman_m.tga",
		playerSettingModule.RACE_WOLFMAN_M		:"d:/ymir work/bin/icon/face/wolfman_m.tga",
	}
	##Job Description##
	DESCRIPTION_FILE_NAME =	(
		uiScriptLocale.JOBDESC_WARRIOR_PATH,
		uiScriptLocale.JOBDESC_ASSASSIN_PATH,
		uiScriptLocale.JOBDESC_SURA_PATH,
		uiScriptLocale.JOBDESC_SHAMAN_PATH,
		uiScriptLocale.JOBDESC_WOLFMAN_PATH,
	)

	##Job List##
	JOB_LIST = {
		0:	localeInfo.JOB_WARRIOR,
		1:	localeInfo.JOB_ASSASSIN,
		2:	localeInfo.JOB_SURA,
		3:	localeInfo.JOB_SHAMAN,
		4:	localeInfo.JOB_WOLFMAN,
	}


	class DescriptionBox(ui.Window):
		def __init__(self):
			ui.Window.__init__(self)
			self.descIndex = 0
		def __del__(self):
			ui.Window.__del__(self)
		def SetIndex(self, index):
			self.descIndex = index
		def OnRender(self):
			event.RenderEventSet(self.descIndex)


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

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

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

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

			app.SetCenterPosition(0.0, 0.0, 0.0)
			app.SetCamera(1550.0, 15.0, 180.0, 95.0)
			grp.SetPerspective(10.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

		##Init Value##
		self.SelectSlot = M2_INIT_VALUE
		self.SelectEmpire = False
		self.ShowToolTip = False
		self.select_job = M2_INIT_VALUE
		self.select_race = M2_INIT_VALUE
		self.LEN_STATPOINT = 4
		self.descIndex = 0
		self.statpoint = [0, 0, 0, 0]
		self.curGauge  = [0.0, 0.0, 0.0, 0.0]
		self.Name_FontColor_Def	 = grp.GenerateColor(0.7215, 0.7215, 0.7215, 1.0)
		self.Name_FontColor		 = grp.GenerateColor(197.0/255.0, 134.0/255.0, 101.0/255.0, 1.0)
		self.Level_FontColor 	 = grp.GenerateColor(250.0/255.0, 211.0/255.0, 136.0/255.0, 1.0)
		self.Not_SelectMotion = False
		self.MotionStart = False
		self.MotionTime = 0.0
		self.RealSlot = []
		self.Disable = False

		for i in xrange(len(M2_CONST_ID)):
			chr.DeleteInstance(i)

	def __del__(self):
		ui.Window.__del__(self)
		net.SetPhaseWindow(net.PHASE_WINDOW_SELECT, 0)

	def Open(self):
		#print "##---------------------------------------- NEW INTRO SELECT OPEN"
		playerSettingModule.LoadGameData("INIT")

		dlgBoard = ui.ScriptWindow()
		self.dlgBoard = dlgBoard
		pythonScriptLoader = ui.PythonScriptLoader()
		pythonScriptLoader.LoadScriptFile( self.dlgBoard, "UIScript/SelectCharacterWindow.py" )

		getChild = self.dlgBoard.GetChild

		##Background##
		self.backGroundDict = {
			net.EMPIRE_B: "d:/ymir work/ui/intro/empire/background/empire_chunjo.sub",
			net.EMPIRE_C: "d:/ymir work/ui/intro/empire/background/empire_jinno.sub",
		}
		self.backGround = getChild("BackGround")

		##Name List##
		self.NameList = []
		self.NameList.append(getChild("name_warrior"))
		self.NameList.append(getChild("name_assassin"))
		self.NameList.append(getChild("name_sura"))
		self.NameList.append(getChild("name_shaman"))
		self.NameList.append(getChild("name_wolfman"))

		##Empire Flag##
		self.empireName = getChild("EmpireName")
		self.flagDict = {
			net.EMPIRE_B: "d:/ymir work/ui/intro/empire/empireflag_b.sub",
			net.EMPIRE_C: "d:/ymir work/ui/intro/empire/empireflag_c.sub",
		}

		self.flag = getChild("EmpireFlag")

		##Button List##
		self.btnStart		= getChild("start_button")
		self.btnCreate		= getChild("create_button")
		self.btnDelete		= getChild("delete_button")
		self.btnExit		= getChild("exit_button")

		##Face Image##
		self.FaceImage = []
		self.FaceImage.append(getChild("CharacterFace_0"))
		self.FaceImage.append(getChild("CharacterFace_1"))
		self.FaceImage.append(getChild("CharacterFace_2"))
		self.FaceImage.append(getChild("CharacterFace_3"))
		self.FaceImage.append(getChild("CharacterFace_4"))

		##Select Character List##
		self.CharacterButtonList = []
		self.CharacterButtonList.append(getChild("CharacterSlot_0"))
		self.CharacterButtonList.append(getChild("CharacterSlot_1"))
		self.CharacterButtonList.append(getChild("CharacterSlot_2"))
		self.CharacterButtonList.append(getChild("CharacterSlot_3"))
		self.CharacterButtonList.append(getChild("CharacterSlot_4"))

		##ToolTip: GuildName, PlayTime##
		getChild("CharacterSlot_0").ShowToolTip = lambda arg = 0: self.OverInToolTip(arg)
		getChild("CharacterSlot_0").HideToolTip = lambda: self.OverOutToolTip()
		getChild("CharacterSlot_1").ShowToolTip = lambda arg = 1: self.OverInToolTip(arg)
		getChild("CharacterSlot_1").HideToolTip = lambda: self.OverOutToolTip()
		getChild("CharacterSlot_2").ShowToolTip = lambda arg = 2: self.OverInToolTip(arg)
		getChild("CharacterSlot_2").HideToolTip = lambda: self.OverOutToolTip()
		getChild("CharacterSlot_3").ShowToolTip = lambda arg = 3: self.OverInToolTip(arg)
		getChild("CharacterSlot_3").HideToolTip = lambda: self.OverOutToolTip()
		getChild("CharacterSlot_4").ShowToolTip = lambda arg = 4: self.OverInToolTip(arg)
		getChild("CharacterSlot_4").HideToolTip = lambda: self.OverOutToolTip()

		## ToolTip etc: Create, Delete, Start, Exit, Prev, Next ##
		getChild("create_button").ShowToolTip = lambda arg = uiScriptLocale.SELECT_CREATE: self.OverInToolTipETC(arg)
		getChild("create_button").HideToolTip = lambda: self.OverOutToolTip()
		getChild("delete_button").ShowToolTip = lambda arg = uiScriptLocale.SELECT_DELETE: self.OverInToolTipETC(arg)
		getChild("delete_button").HideToolTip = lambda: self.OverOutToolTip()
		getChild("start_button").ShowToolTip = lambda arg = uiScriptLocale.SELECT_SELECT: self.OverInToolTipETC(arg)
		getChild("start_button").HideToolTip = lambda: self.OverOutToolTip()
		getChild("exit_button").ShowToolTip = lambda arg = uiScriptLocale.SELECT_EXIT: self.OverInToolTipETC(arg)
		getChild("exit_button").HideToolTip = lambda: self.OverOutToolTip()
		getChild("prev_button").ShowToolTip = lambda arg = uiScriptLocale.CREATE_PREV: self.OverInToolTipETC(arg)
		getChild("prev_button").HideToolTip = lambda: self.OverOutToolTip()
		getChild("next_button").ShowToolTip = lambda arg = uiScriptLocale.CREATE_NEXT: self.OverInToolTipETC(arg)
		getChild("next_button").HideToolTip = lambda: self.OverOutToolTip()

		##StatPoint Value##
		self.statValue = []
		self.statValue.append(getChild("hth_value"))
		self.statValue.append(getChild("int_value"))
		self.statValue.append(getChild("str_value"))
		self.statValue.append(getChild("dex_value"))

		##Gauge UI##
		self.GaugeList = []
		self.GaugeList.append(getChild("hth_gauge"))
		self.GaugeList.append(getChild("int_gauge"))
		self.GaugeList.append(getChild("str_gauge"))
		self.GaugeList.append(getChild("dex_gauge"))

		##Text##
		self.textBoard = getChild("text_board")
		self.btnPrev = getChild("prev_button")
		self.btnNext = getChild("next_button")

		##DescFace##
		self.discFace = getChild("DiscFace")
		self.raceNameText = getChild("raceName_Text")

		##MyID##
		#self.descPhaseText = getChild("desc_phase_text")
		self.myID = getChild("my_id")
		self.myID.SetText(net.GetLoginID())

		##Button Event##
		self.btnStart.SetEvent(ui.__mem_func__(self.StartGameButton))
		self.btnCreate.SetEvent(ui.__mem_func__(self.CreateCharacterButton))
		self.btnExit.SetEvent(ui.__mem_func__(self.ExitButton))
		self.btnDelete.SetEvent(ui.__mem_func__(self.InputPrivateCode))

		##Select MyCharacter##
		self.CharacterButtonList[0].SetEvent(ui.__mem_func__(self.SelectButton), 0)
		self.CharacterButtonList[1].SetEvent(ui.__mem_func__(self.SelectButton), 1)
		self.CharacterButtonList[2].SetEvent(ui.__mem_func__(self.SelectButton), 2)
		self.CharacterButtonList[3].SetEvent(ui.__mem_func__(self.SelectButton), 3)
		self.CharacterButtonList[4].SetEvent(ui.__mem_func__(self.SelectButton), 4)

		self.FaceImage[0].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_click", 0)
		self.FaceImage[1].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_click", 1)
		self.FaceImage[2].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_click", 2)
		self.FaceImage[3].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_click", 3)
		self.FaceImage[4].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_click", 4)

		self.FaceImage[0].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 0)
		self.FaceImage[1].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 1)
		self.FaceImage[2].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 2)
		self.FaceImage[3].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 3)
		self.FaceImage[4].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_in", 4)

		self.FaceImage[0].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 0)
		self.FaceImage[1].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 1)
		self.FaceImage[2].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 2)
		self.FaceImage[3].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 3)
		self.FaceImage[4].SetEvent(ui.__mem_func__(self.EventProgress), "mouse_over_out", 4)

		##Job Description##
		self.btnPrev.SetEvent(ui.__mem_func__(self.PrevDescriptionPage))
		self.btnNext.SetEvent(ui.__mem_func__(self.NextDescriptionPage))

		##MyCharacter CLASS##
		self.mycharacters = MyCharacters(self)
		self.mycharacters.LoadCharacterData()

		if not self.mycharacters.GetMyCharacterCount():
			self.stream.SetCharacterSlot(self.mycharacters.GetEmptySlot())
			self.SelectEmpire = True

		##Job Description Box##
		self.descriptionBox = self.DescriptionBox()
		self.descriptionBox.Show()

		##Tool Tip(Guild Name, PlayTime)##
		self.toolTip = uiToolTip.ToolTip()
		self.toolTip.ClearToolTip()

		self.dlgBoard.Show()
		self.Show()

		##Empire Flag & Background Setting##
		my_empire = net.GetEmpireID()
		self.SetEmpire(my_empire)
		app.ShowCursor()

		if musicInfo.selectMusic != "":
			snd.SetMusicVolume(systemSetting.GetMusicVolume())
			snd.FadeInMusic("BGM/"+musicInfo.selectMusic)

		##Character Render##
		self.chrRenderer = self.CharacterRenderer()
		self.chrRenderer.SetParent(self.backGround)
		self.chrRenderer.Show()

		##Default Setting##
	def EventProgress(self, event_type, slot) :
		if self.Disable :
			return

		if "mouse_click" == event_type :
			if slot == self.SelectSlot :
				return

			snd.PlaySound("sound/ui/click.wav")
			self.SelectButton(slot)
		elif "mouse_over_in" == event_type :
			for button in self.CharacterButtonList :
				button.SetUp()

			self.CharacterButtonList[slot].Over()
			self.CharacterButtonList[self.SelectSlot].Down()
			self.OverInToolTip(slot)
		elif "mouse_over_out" == event_type :
			for button in self.CharacterButtonList :
				button.SetUp()

			self.CharacterButtonList[self.SelectSlot].Down()
			self.OverOutToolTip()
		else :
			print " New_introSelect.py ::EventProgress : False"

	def SelectButton(self, slot):
		#print "self.RealSlot = %s" % self.RealSlot
		#slot 0 ~ 4
		if slot >= self.mycharacters.GetMyCharacterCount() or slot == self.SelectSlot:
			return

		if self.Not_SelectMotion or self.MotionTime != 0.0:
			self.CharacterButtonList[slot].SetUp()
			self.CharacterButtonList[slot].Over()
			return

		for button in self.CharacterButtonList:
			button.SetUp()

		self.SelectSlot = slot
		self.CharacterButtonList[self.SelectSlot].Down()
		self.stream.SetCharacterSlot(self.RealSlot[self.SelectSlot])

		self.select_job = self.mycharacters.GetJob(self.SelectSlot)

		##Job Descirption##
		event.ClearEventSet(self.descIndex)
		self.descIndex = event.RegisterEventSet(self.DESCRIPTION_FILE_NAME[self.select_job])
		event.SetFontColor(self.descIndex, 0.7843, 0.7843, 0.7843)
		event.SetRestrictedCount(self.descIndex, 35)

		if event.BOX_VISIBLE_LINE_COUNT >= event.GetTotalLineCount(self.descIndex) :
			self.btnPrev.Hide()
			self.btnNext.Hide()
		else :
			self.btnPrev.Show()
			self.btnNext.Show()
		self.ResetStat()

		## Setting ##
		for i in xrange(len(self.NameList)):
			if self.select_job == i	:
				self.NameList[i].SetAlpha(1)
			else:
				self.NameList[i].SetAlpha(0)

		## Face Setting & Font Color Setting ##
		self.select_race = self.mycharacters.GetRace(self.SelectSlot)
		#print "self.mycharacters.GetMyCharacterCount() = %s" % self.mycharacters.GetMyCharacterCount()
		for i in xrange(self.mycharacters.GetMyCharacterCount()):
			if slot == i:
				self.FaceImage[slot].LoadImage(self.RACE_FACE_PATH[self.select_race] + "1.sub")
				self.CharacterButtonList[slot].SetAppendTextColor(0, self.Name_FontColor)
			else:
				self.FaceImage[i].LoadImage(self.RACE_FACE_PATH[self.mycharacters.GetRace(i)] + "2.sub")
				self.CharacterButtonList[i].SetAppendTextColor(0, self.Name_FontColor_Def)

		## Desc Face & raceText Setting ##
		self.discFace.LoadImage(self.DISC_FACE_PATH[self.select_race])
		self.raceNameText.SetText(self.JOB_LIST[self.select_job])

		chr.Hide()
		chr.SelectInstance(self.SelectSlot)
		chr.Show()

	def Close(self):
		#print "##---------------------------------------- NEW INTRO SELECT CLOSE"
		del self.mycharacters
		self.EMPIRE_NAME = None
		self.EMPIRE_NAME_COLOR = None
		self.RACE_FACE_PATH = None
		self.DISC_FACE_PATH = None
		self.DESCRIPTION_FILE_NAME = None
		self.JOB_LIST = None

		##Default Value##
		self.SelectSlot = None
		self.SelectEmpire = None
		self.ShowToolTip = None
		self.LEN_STATPOINT = None
		self.descIndex = None
		self.statpoint = None
		self.curGauge  = None
		self.Name_FontColor_Def	 = None
		self.Name_FontColor		 = None
		self.Level_FontColor 	 = None
		self.Not_SelectMotion = None
		self.MotionStart = None
		self.MotionTime = None
		self.RealSlot = None

		self.select_job = None
		self.select_race = None

		##Open Func##
		self.dlgBoard = None
		self.backGround = None
		self.backGroundDict = None
		self.NameList = None
		self.empireName = None
		self.flag = None
		self.flagDict = None
		self.btnStart = None
		self.btnCreate = None
		self.btnDelete = None
		self.btnExit = None
		self.FaceImage = None
		self.CharacterButtonList = None
		self.statValue = None
		self.GaugeList = None
		self.textBoard = None
		self.btnPrev = None
		self.btnNext = None
		self.raceNameText = None
		#self.descPhaseText = None
		self.myID = None

		self.descriptionBox = None
		self.toolTip = None
		self.Disable = None

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

		self.Hide()
		self.KillFocus()
		app.HideCursor()
		event.Destroy()

	def SetEmpire(self, empire_id):
		self.empireName.SetText(self.EMPIRE_NAME.get(empire_id, ""))
		rgb = self.EMPIRE_NAME_COLOR[empire_id]
		self.empireName.SetFontColor(rgb[0], rgb[1], rgb[2])
		if empire_id != net.EMPIRE_A:
			self.flag.LoadImage(self.flagDict[empire_id])
			self.flag.SetScale(0.45, 0.45)
			self.backGround.LoadImage(self.backGroundDict[empire_id])
			self.backGround.SetScale(float(wndMgr.GetScreenWidth()) / 1024.0, float(wndMgr.GetScreenHeight()) / 768.0)

	def CreateCharacterButton(self):
		slotNumber = self.mycharacters.GetEmptySlot()

		if slotNumber == M2_INIT_VALUE:
			self.stream.popupWindow.Close()
			self.stream.popupWindow.Open(localeInfo.CREATE_FULL, 0, localeInfo.UI_OK)
			return

		pid = self.GetCharacterSlotPID(slotNumber)

		if not pid:
			self.stream.SetCharacterSlot(slotNumber)

			if not self.mycharacters.GetMyCharacterCount():
				self.SelectEmpire = True
			else:
				self.stream.SetCreateCharacterPhase()
				self.Hide()

	def ExitButton(self):
		self.stream.SetLoginPhase()
		self.Hide()

	def StartGameButton(self):
		if not self.mycharacters.GetMyCharacterCount() or self.MotionTime != 0.0:
			return

		self.DisableWindow()

		IsChangeName = self.mycharacters.GetChangeName(self.SelectSlot)
		if IsChangeName:
			self.OpenChangeNameDialog()
			return

		chr.PushOnceMotion(chr.MOTION_INTRO_SELECTED)
		self.MotionStart = True
		self.MotionTime = app.GetTime()

	def OnUpdate(self):
		chr.Update()
		self.ToolTipProgress()

		if self.SelectEmpire:
			self.SelectEmpire = False
			self.stream.SetReselectEmpirePhase()
			self.Hide()

		if self.MotionStart and app.GetTime() - self.MotionTime >= 0.2 :
			self.MotionStart = False
			#print " Start Game "
			chrSlot = self.stream.GetCharacterSlot()

			#print "chrSlot = %s" % chrSlot
			if musicInfo.selectMusic != "":
				snd.FadeLimitOutMusic("BGM/"+musicInfo.selectMusic, systemSetting.GetMusicVolume()*0.05)

			net.DirectEnter(chrSlot)
			playTime = net.GetAccountCharacterSlotDataInteger(chrSlot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)

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

		(xposEventSet, yposEventSet) = self.textBoard.GetGlobalPosition()
		event.UpdateEventSet(self.descIndex, xposEventSet+7, -(yposEventSet+7))
		self.descriptionBox.SetIndex(self.descIndex)

		for i in xrange(self.LEN_STATPOINT):
			self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0)

	# def Refresh(self):
	def GetCharacterSlotPID(self, slotIndex):
		return net.GetAccountCharacterSlotDataInteger(slotIndex, net.ACCOUNT_CHARACTER_SLOT_ID)

	def All_ButtonInfoHide(self):
		for i in xrange(CHARACTER_SLOT_COUNT_MAX):
			self.CharacterButtonList[i].Hide()
			self.FaceImage[i].Hide()

	def InitDataSet(self, slot, name, level, real_slot):
		width = self.CharacterButtonList[slot].GetWidth()
		height = self.CharacterButtonList[slot].GetHeight()

		self.CharacterButtonList[slot].AppendTextLine(name				, localeInfo.UI_DEF_FONT, self.Name_FontColor_Def	, "right", width - 12, height/4 + 2)
		self.CharacterButtonList[slot].AppendTextLine("Lv." + str(level), localeInfo.UI_DEF_FONT, self.Level_FontColor		, "left", width - 42, height*3/4)

		self.CharacterButtonList[slot].Show()
		self.FaceImage[slot].LoadImage(self.RACE_FACE_PATH[self.mycharacters.GetRace(slot)] + "2.sub")
		self.FaceImage[slot].Show()
		self.RealSlot.append(real_slot)

	def InputPrivateCode(self):
		if not self.mycharacters.GetMyCharacterCount():
			return

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

		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

		self.DisableWindow()

		if not self.Not_SelectMotion:
			self.Not_SelectMotion = True
			chr.PushOnceMotion(chr.MOTION_INTRO_NOT_SELECTED, 0.1)

	def AcceptInputPrivateCode(self):
		privateCode = self.privateInputBoard.GetText()
		if not privateCode:
			return

		pid = net.GetAccountCharacterSlotDataInteger(self.RealSlot[self.SelectSlot], net.ACCOUNT_CHARACTER_SLOT_ID)

		if not pid:
			self.PopupMessage(localeInfo.SELECT_EMPTY_SLOT)
			return

		net.SendDestroyCharacterPacket(self.RealSlot[self.SelectSlot], privateCode)
		self.PopupMessage(localeInfo.SELECT_DELEING)

		self.CancelInputPrivateCode()
		return True

	def CancelInputPrivateCode(self):
		self.privateInputBoard = None
		self.Not_SelectMotion = False
		chr.SetLoopMotion(chr.MOTION_INTRO_WAIT)
		self.EnableWindow()
		return True

	def OnDeleteSuccess(self, slot):
		self.PopupMessage(localeInfo.SELECT_DELETED)
		for i in xrange(len(self.RealSlot)):
			chr.DeleteInstance(i)

		self.RealSlot = []
		self.SelectSlot = M2_INIT_VALUE

		for button in self.CharacterButtonList:
			button.AppendTextLineAllClear()

		if not self.mycharacters.LoadCharacterData():
			self.stream.popupWindow.Close()
			self.stream.SetCharacterSlot(self.mycharacters.GetEmptySlot())
			self.SelectEmpire = True

	def OnDeleteFailure(self):
		self.PopupMessage(localeInfo.SELECT_CAN_NOT_DELETE)

	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 RefreshStat(self):
		statSummary = 90.0
		self.curGauge =	[
			float(self.statpoint[0])/statSummary,
			float(self.statpoint[1])/statSummary,
			float(self.statpoint[2])/statSummary,
			float(self.statpoint[3])/statSummary,
		]

		for i in xrange(self.LEN_STATPOINT):
			self.statValue[i].SetText(str(self.statpoint[i]))

	def ResetStat(self):
		myStatPoint = self.mycharacters.GetStatPoint(self.SelectSlot)

		if not myStatPoint:
			return

		for i in xrange(self.LEN_STATPOINT):
			self.statpoint[i] = myStatPoint[i]

		self.RefreshStat()

	##Job Description Prev & Next Button##
	def PrevDescriptionPage(self):
		if True == event.IsWait(self.descIndex):
			if event.GetVisibleStartLine(self.descIndex) - event.BOX_VISIBLE_LINE_COUNT >= 0:
				event.SetVisibleStartLine(self.descIndex, event.GetVisibleStartLine(self.descIndex) - event.BOX_VISIBLE_LINE_COUNT)
				event.Skip(self.descIndex)
		else:
			event.Skip(self.descIndex)

	def NextDescriptionPage(self):
		if True == event.IsWait(self.descIndex):
			event.SetVisibleStartLine(self.descIndex, event.GetVisibleStartLine(self.descIndex) + event.BOX_VISIBLE_LINE_COUNT)
			event.Skip(self.descIndex)
		else:
			event.Skip(self.descIndex)

	##ToolTip: GuildName, PlayTime##
	def OverInToolTip(self, slot):
		GuildName = localeInfo.GUILD_NAME
		myGuildName, myPlayTime = self.mycharacters.GetGuildNamePlayTime(slot)
		pos_x, pos_y = self.CharacterButtonList[slot].GetGlobalPosition()

		if not myGuildName:
			myGuildName = localeInfo.SELECT_NOT_JOIN_GUILD

		guild_name = GuildName + " : " + myGuildName
		play_time = uiScriptLocale.SELECT_PLAYTIME + " :"
		day = myPlayTime / (60 * 24)
		if day:
			play_time = play_time + " " + str(day) + localeInfo.DAY
		hour = (myPlayTime - (day * 60 * 24))/60
		if hour:
			play_time = play_time + " " + str(hour) + localeInfo.HOUR
		min = myPlayTime - (hour * 60) - (day * 60 * 24)

		play_time = play_time + " " + str(min) + localeInfo.MINUTE

		textlen = max(len(guild_name), len(play_time))
		tooltip_width = 6 * textlen + 22

		self.toolTip.ClearToolTip()
		self.toolTip.SetThinBoardSize(tooltip_width)

		self.toolTip.SetToolTipPosition(pos_x + 173 + tooltip_width/2, pos_y + 34)
		self.toolTip.AppendTextLine(guild_name, 0xffe4cb1b, False) 	##YELLOW##
		self.toolTip.AppendTextLine(play_time, 0xffffff00, False) 	##YELLOW##

		self.toolTip.Show()

	def OverInToolTipETC(self, arg):
		arglen = len(str(arg))
		pos_x, pos_y = wndMgr.GetMousePosition()

		self.toolTip.ClearToolTip()
		self.toolTip.SetThinBoardSize(11 * arglen)
		self.toolTip.SetToolTipPosition(pos_x + 50, pos_y + 50)
		self.toolTip.AppendTextLine(arg, 0xffffff00)
		self.toolTip.Show()
		self.ShowToolTip = True

	def OverOutToolTip(self):
		self.toolTip.Hide()
		self.ShowToolTip = False

	def ToolTipProgress(self):
		if self.ShowToolTip:
			pos_x, pos_y = wndMgr.GetMousePosition()
			self.toolTip.SetToolTipPosition(pos_x + 50, pos_y + 50)

	def SameLoginDisconnect(self):
		self.stream.popupWindow.Close()
		self.stream.popupWindow.Open(localeInfo.LOGIN_FAILURE_SAMELOGIN, self.ExitButton, localeInfo.UI_OK)

	def OnKeyDown(self, key):
		if self.MotionTime != 0.0:
			return

		if 1 == key: #ESC
			self.ExitButton()
		elif 2 == key: #1
			self.SelectButton(0)
		elif 3 == key:
			self.SelectButton(1)
		elif 4 == key:
			self.SelectButton(2)
		elif 5 == key:
			self.SelectButton(3)
		elif 6 == key:
			self.SelectButton(4)
		elif 28 == key: #and not self.stream.popupWindow.IsShow():
			self.StartGameButton()
		elif 200 == key or 208 == key:
			self.KeyInputUpDown(key)
		else:
			return True

		return True

	def KeyInputUpDown(self, key):
		idx = self.SelectSlot
		maxValue = self.mycharacters.GetMyCharacterCount()
		if 200 == key: #UP
			idx = idx - 1
			if idx < 0:
				idx = maxValue - 1

		elif 208 == key: #DOWN
			idx = idx + 1
			if idx >= maxValue:
				idx = 0
		else:
			self.SelectButton(0)

		self.SelectButton(idx)

	def OnPressExitKey(self):
		self.ExitButton()
		return True

	def DisableWindow(self):
		self.btnStart.Disable()
		self.btnCreate.Disable()
		self.btnExit.Disable()
		self.btnDelete.Disable()
		self.btnPrev.Disable()
		self.btnNext.Disable()
		self.toolTip.Hide()
		self.ShowToolTip = False
		self.Disable = True
		for button in self.CharacterButtonList:
			button.Disable()

		self.CharacterButtonList[self.SelectSlot].Down()

	def EnableWindow(self):
		self.btnStart.Enable()
		self.btnCreate.Enable()
		self.btnExit.Enable()
		self.btnDelete.Enable()
		self.btnPrev.Enable()
		self.btnNext.Enable()
		self.Disable = False
		for button in self.CharacterButtonList:
			button.Enable()

		self.CharacterButtonList[self.SelectSlot].Down()

	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.RealSlot[self.SelectSlot]
		self.nameInputBoard = nameInputBoard

	def AcceptInputName(self):
		changeName = self.nameInputBoard.GetText()
		if not changeName:
			return

		net.SendChangeNamePacket(self.nameInputBoard.slot, changeName)
		return self.CancelInputName()

	def CancelInputName(self):
		self.nameInputBoard.Close()
		self.nameInputBoard = None
		self.EnableWindow()
		return True

	def OnCreateFailure(self, type):
		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 OnChangeName(self, slot, name):
		for i in xrange(len(self.RealSlot)):
			if self.RealSlot[i] == slot:
				self.ChangeNameButton(i, name)
				self.SelectButton(i)
				self.PopupMessage(localeInfo.SELECT_CHANGED_NAME)
				break

	def ChangeNameButton(self, slot, name):
		self.CharacterButtonList[slot].SetAppendTextChangeText(0, name)
		self.mycharacters.SetChangeNameSuccess(slot)

 

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Activity

    1. 1

      Arabian Camel

    2. 0

      compilling error

    3. 8

      open Allow armor change only every 5 seconds

    4. 1

      Arabian Camel

    5. 0

      K inventory System Help FIx bug

    6. 12

      MDE - Animated Weapons

    7. 12

      MDE - Animated Weapons

    8. 0

      [Graphic-Portfolio] Winders

  • Recently Browsing

    No registered users viewing this page.

×
×
  • 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.