Discussione AIUTO ERRORE CLIENT

Stato
Discussione chiusa ad ulteriori risposte.

God_Cyber

Utente Silver
15 Aprile 2013
93
30
19
93
Ultima modifica:
Ciao ragazzi, mi sono fatto passare un client già protetto con crypt pack.
Ora nel syser mi da questo errore:
Codice:
networkModule.py(line:194) SetSelectCharacterPhasesystem.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:23) ?
system.py(line:130) __pack_import
system.py(line:110) _process_result
uiAffectShower.py(line:347) ?
uiAffectShower.py(line:353) AffectShower
---------------------------------------------------------------------------------------------------------------------------------------------------------------
networkModule.py(line:194)

PHP:
###################################################################################################
# Network

import app
import chr
import dbg
import net
import snd

import chr
import chrmgr
import background
import player
import playerSettingModule

import ui
import uiPhaseCurtain

import locale

class PopupDialog(ui.ScriptWindow):

    def __init__(self):
        print "NEW POPUP DIALOG ----------------------------------------------------------------------------"
        ui.ScriptWindow.__init__(self)
        self.CloseEvent = 0

    def __del__(self):
        print "---------------------------------------------------------------------------- DELETE POPUP DIALOG "
        ui.ScriptWindow.__del__(self)

    def LoadDialog(self):
        PythonScriptLoader = ui.PythonScriptLoader()
        PythonScriptLoader.LoadScriptFile(self, "UIScript/PopupDialog.py")

    def Open(self, Message, event = 0, ButtonName = locale.UI_CANCEL):

        if TRUE == self.IsShow():
            self.Close()

        self.Lock()
        self.SetTop()
        self.CloseEvent = event

        AcceptButton = self.GetChild("accept")
        AcceptButton.SetText(ButtonName)
        AcceptButton.SetEvent(ui.__mem_func__(self.Close))

        self.GetChild("message").SetText(Message)
        self.Show()

    def Close(self):

        if FALSE == self.IsShow():
            self.CloseEvent = 0
            return

        self.Unlock()
        self.Hide()

        if 0 != self.CloseEvent:
            self.CloseEvent()
            self.CloseEvent = 0

    def Destroy(self):
        self.Close()
        self.ClearDictionary()

    def OnPressEscapeKey(self):
        self.Close()
        return TRUE

    def OnIMEReturn(self):
        self.Close()
        return TRUE

##
## Main Stream
##
class MainStream(object):
    isChrData=0    

    def __init__(self):
        print "NEWMAIN STREAM ----------------------------------------------------------------------------"
        net.SetHandler(self)
        net.SetTCPRecvBufferSize(64*1024)
        net.SetTCPSendBufferSize(1024)
        net.SetUDPRecvBufferSize(4096)

        self.id=""
        self.pwd=""
        self.addr=""
        self.port=0
        self.account_addr=0
        self.account_port=0
        self.slot=0
        self.isAutoSelect=0
        self.isAutoLogin=0

        self.curtain = 0
        self.curPhaseWindow = 0
        self.newPhaseWindow = 0

    def __del__(self):
        print "---------------------------------------------------------------------------- DELETE MAIN STREAM "

    def Destroy(self):
        if self.curPhaseWindow:
            self.curPhaseWindow.Close()
            self.curPhaseWindow = 0

        if self.newPhaseWindow:
            self.newPhaseWindow.Close()
            self.newPhaseWindow = 0

        self.popupWindow.Destroy()
        self.popupWindow = 0

        self.curtain = 0

    def Create(self):
        self.CreatePopupDialog()

        self.curtain = uiPhaseCurtain.PhaseCurtain()

    def SetPhaseWindow(self, newPhaseWindow):
        if self.newPhaseWindow:
            #print "ÀÌ¹Ì »õ·Î¿î À©µµ¿ì·Î ¹Ù²Û»óÅ¿¡¼­ ¶Ç ¹Ù²Þ", newPhaseWindow
            self.__ChangePhaseWindow()

        self.newPhaseWindow=newPhaseWindow

        if self.curPhaseWindow:
            #print "ÆäÀÌµå ¾Æ¿ôµÇ¸é ¹Ù²Þ"
            self.curtain.FadeOut(self.__ChangePhaseWindow)
        else:
            #print "ÇöÀç À©µµ¿ì°¡ ¾ø´Â »óŶó ¹Ù·Î ¹Ù²Þ"
            self.__ChangePhaseWindow()

    def __ChangePhaseWindow(self):
        oldPhaseWindow=self.curPhaseWindow
        newPhaseWindow=self.newPhaseWindow
        self.curPhaseWindow=0
        self.newPhaseWindow=0

        if oldPhaseWindow:
            oldPhaseWindow.Close()

        if newPhaseWindow:
            newPhaseWindow.Open()

        self.curPhaseWindow=newPhaseWindow
    
        if self.curPhaseWindow:
            self.curtain.FadeIn()
        else:
            app.Exit()

    def CreatePopupDialog(self):
        self.popupWindow = PopupDialog()
        self.popupWindow.LoadDialog()
        self.popupWindow.SetCenterPosition()
        self.popupWindow.Hide()


    ## SelectPhase
    ##########################################################################################    
    def SetLoginPhase(self):
        net.Disconnect()

        import introLogin
        self.SetPhaseWindow(introLogin.LoginWindow(self))

    def SetSelectEmpirePhase(self):
        try:
            import introEmpire    
            self.SetPhaseWindow(introEmpire.SelectEmpireWindow(self))
        except:
            import exception
            exception.Abort("networkModule.SetSelectEmpirePhase")


    def SetReselectEmpirePhase(self):
        try:
            import introEmpire
            self.SetPhaseWindow(introEmpire.ReselectEmpireWindow(self))
        except:
            import exception
            exception.Abort("networkModule.SetReselectEmpirePhase")

    def SetSelectCharacterPhase(self):
        try:
            locale.LoadLocaleData()
            import introSelect
            self.popupWindow.Close()
            self.SetPhaseWindow(introSelect.SelectCharacterWindow(self))
        except:
            import exception
            exception.Abort("networkModule.SetSelectCharacterPhase")

    def SetCreateCharacterPhase(self):
        try:
            import introCreate
            self.SetPhaseWindow(introCreate.CreateCharacterWindow(self))
        except:
            import exception
            exception.Abort("networkModule.SetCreateCharacterPhase")

    def SetTestGamePhase(self, x, y):
        try:
            import introLoading
            loadingPhaseWindow=introLoading.LoadingWindow(self)
            loadingPhaseWindow.LoadData(x, y)
            self.SetPhaseWindow(loadingPhaseWindow)
        except:
            import exception
            exception.Abort("networkModule.SetLoadingPhase")



    def SetLoadingPhase(self):
        try:
            import introLoading
            self.SetPhaseWindow(introLoading.LoadingWindow(self))
        except:
            import exception
            exception.Abort("networkModule.SetLoadingPhase")

    def SetGamePhase(self):
        try:
            import game
            self.popupWindow.Close()
            self.SetPhaseWindow(game.GameWindow(self))
        except:
            raise
            import exception
            exception.Abort("networkModule.SetGamePhase")

    ################################
    # Functions used in python

    ## Login
    def Connect(self):        
        import constInfo
        if constInfo.KEEP_ACCOUNT_CONNETION_ENABLE:
            net.ConnectToAccountServer(self.addr, self.port, self.account_addr, self.account_port)
        else:
            net.ConnectTCP(self.addr, self.port)

        #net.ConnectUDP(IP, Port)

    def SetConnectInfo(self, addr, port, account_addr=0, account_port=0):
        self.addr = addr
        self.port = port
        self.account_addr = account_addr
        self.account_port = account_port

    def GetConnectAddr(self):
        return self.addr

    def SetLoginInfo(self, id, pwd):
        self.id = id
        self.pwd = pwd
        net.SetLoginInfo(id, pwd)

    def CancelEnterGame(self):
        pass

    ## Select
    def SetCharacterSlot(self, slot):
        self.slot=slot

    def GetCharacterSlot(self):
        return self.slot

    ## Empty
    def EmptyFunction(self):
        pass


system.py(line:130)


PHP:
import sys
import app
import dbg

sys.path.append("lib")

class TraceFile:
    def write(self, msg):
        dbg.Trace(msg)

class TraceErrorFile:
    def write(self, msg):
        dbg.TraceError(msg)
        dbg.RegisterExceptionString(msg)

class LogBoxFile:
    def __init__(self):
        self.stderrSave = sys.stderr
        self.msg = ""

    def __del__(self):
        self.restore()

    def restore(self):
        sys.stderr = self.stderrSave

    def write(self, msg):
        self.msg = self.msg + msg

    def show(self):
        dbg.LogBox(self.msg,"Error")

sys.stdout = TraceFile()
sys.stderr = TraceErrorFile()

#
# pack file support (must move to system.py, systemrelease.pyc)
#

import marshal
import imp
import pack

class pack_file_iterator(object):
    def __init__(self, packfile):
        self.pack_file = packfile
        
    def next(self):
        tmp = self.pack_file.readline()
        if tmp:
            return tmp
        raise StopIteration

_chr = __builtins__.chr

class pack_file(object):

    def __init__(self, filename, mode = 'rb'):
        assert mode in ('r', 'rb')
        if not pack.Exist(filename):
            raise IOError, 'No file or directory'
        self.data = pack.Get(filename)
        if mode == 'r':
            self.data=_chr(10).join(self.data.split(_chr(13)+_chr(10)))

    def __iter__(self):
        return pack_file_iterator(self)

    def read(self, len = None):
        if not self.data:
            return ''
        if len:
            tmp = self.data[:len]
            self.data = self.data[len:]
            return tmp
        else:
            tmp = self.data
            self.data = ''
            return tmp

    def readline(self):
        return self.read(self.data.find(_chr(10))+1)

    def readlines(self):
        return [x for x in self]

__builtins__.pack_open = pack_open = pack_file

_ModuleType = type(sys)

old_import = __import__
def _process_result(code, fqname):
    # did get_code() return an actual module? (rather than a code object)
    is_module = isinstance(code, _ModuleType)

    # use the returned module, or create a new one to exec code into
    if is_module:
        module = code
    else:
        module = imp.new_module(fqname)

    # insert additional values into the module (before executing the code)
    #module.__dict__.update(values)

    # the module is almost ready... make it visible
    sys.modules[fqname] = module

    # execute the code within the module's namespace
    if not is_module:
        exec code in module.__dict__

    # fetch from sys.modules instead of returning module directly.
    # also make module's __name__ agree with fqname, in case
    # the "exec code in module.__dict__" played games on us.
    module = sys.modules[fqname]
    module.__name__ = fqname
    return module

module_do = lambda x:None

def __pack_import(name,globals=None,locals=None,fromlist=None):
    if name in sys.modules:
        return sys.modules[name]

    filename = name + '.py'

    if pack.Exist(filename):
        dbg.Trace('importing from pack %s\\n' % name)

        newmodule = _process_result(compile(pack_file(filename,'r').read(),filename,'exec'),name)        

        module_do(newmodule)
        return newmodule
        #return imp.load_module(name, pack_file(filename,'r'),filename,('.py','r',imp.PY_SOURCE))
    else:
        dbg.Trace('importing from lib %s\\n' % name)
        return old_import(name,globals,locals,fromlist)

def splitext(p):
    root, ext = '', ''
    for c in p:
        if c in ['/']:
            root, ext = root + ext + c, ''
        elif c == '.':
            if ext:
                root, ext = root + ext, c
            else:
                ext = c
        elif ext:
            ext = ext + c
        else:
            root = root + c
    return root, ext

class PythonExecutioner: 

    def Run(kPESelf, sFileName, kDict): 
        if kPESelf.__IsCompiledFile__(sFileName): 
            kCode=kPESelf.__LoadCompiledFile__(sFileName) 
        else: 
            kCode=kPESelf.__LoadTextFile__(sFileName) 

        exec(kCode, kDict) 

    def __IsCompiledFile__(kPESelf, sFileName): 

        sBase, sExt = splitext(sFileName) 
        sExt=sExt.lower() 

        if sExt==".pyc" or sExt==".pyo": 
            return 1 
        else: 
            return 0 

    def __LoadTextFile__(kPESelf, sFileName): 
        sText=pack_open(sFileName,'r').read() 
        return compile(sText, sFileName, "exec") 

    def __LoadCompiledFile__(kPESelf, sFileName): 
        kFile=pack_open(sFileName)

        if kFile.read(4)!=imp.get_magic(): 
            raise 

        kFile.read(4) 

        kData=kFile.read() 
        return marshal.loads(kData) 

def execfile(fileName, dict): 
    kPE=PythonExecutioner() 
    kPE.Run(fileName, dict) 

def exec_add_module_do(mod):
    global execfile
    mod.__dict__['execfile'] = execfile

import __builtin__
__builtin__.__import__ = __pack_import
module_do = exec_add_module_do

"""
#
# PSYCO installation (must move to system.py, systemrelease.pyc)
#
try:
    import psyco
    #from psyco.classes import *

    def bind_me(bindable_list):
        try:
            for x in bindable_list:
                try:
                    psyco.bind(x)
                except:
                    pass
        except:
            pass        

    _prev_psyco_old_module_do = module_do
    def module_bind(module):
        _prev_psyco_old_module_do(module)
        #print 'start binding' + str(module)
        try:
            psyco.bind(module)
        except:
            pass
        for x in module.__dict__.itervalues():
            try:
                psyco.bind(x)
            except:
                pass        
        #print 'end binding'

    dbg.Trace("PSYCO installed\\n")

except Exception, msg:
    bind_me = lambda x:None
    dbg.Trace("No PSYCO support : %s\\n" % msg)
"""

def GetExceptionString(excTitle):
    (excType, excMsg, excTraceBack)=sys.exc_info()
    excText=""
    excText+=_chr(10)

    import traceback
    traceLineList=traceback.extract_tb(excTraceBack)

    for traceLine in traceLineList:
        if traceLine[3]:
            excText+="%s(line:%d) %s - %s" % (traceLine[0], traceLine[1], traceLine[2], traceLine[3])
        else:
            excText+="%s(line:%d) %s"  % (traceLine[0], traceLine[1], traceLine[2])

        excText+=_chr(10)
    
    excText+=_chr(10)
    excText+="%s - %s:%s" % (excTitle, excType, excMsg)        
    excText+=_chr(10)

    return excText

def ShowException(excTitle):
    excText=GetExceptionString(excTitle)
    dbg.TraceError(excText)
    app.Abort()

    return 0

def RunMainScript(name):
    try:        
        execfile(name, __main__.__dict__)
    except RuntimeError, msg:
        msg = str(msg)

        import locale
        if locale.error:
            msg = locale.error.get(msg, msg)

        dbg.LogBox(msg)
        app.Abort()

    except:    
        msg = GetExceptionString("Run")
        dbg.LogBox(msg)
        app.Abort()
    
import debugInfo
debugInfo.SetDebugMode(__DEBUG__)

loginMark = "-cs"

app.__COMMAND_LINE__ = __COMMAND_LINE__
RunMainScript("prototype.py")


introSelect.py(line:23)


PHP:
import chr
import grp
import app
import math
import wndMgr
import snd
import net
import systemSetting
import locale
import chr

import ui
import uiScriptLocale
import networkModule
import musicInfo
import playerSettingModule

####################################
# ºü¸¥ ½ÇÇàÀ» À§ÇÑ ¸ðµâ ·Îµù ºÐ´ã
####################################
import uiCommon                    
import uiMapNameShower             
import uiAffectShower              
import uiPlayerGauge               
import uiCharacter                 
import uiTarget                    
import consoleModule               
import interfaceModule             
import uiTaskBar                   
import uiInventory

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

LEAVE_BUTTON_FOR_POTAL = FALSE
NOT_NEED_DELETE_CODE = FALSE
ENABLE_ENGNUM_DELETE_CODE = FALSE

if locale.IsJAPAN():
    NOT_NEED_DELETE_CODE = TRUE
elif locale.IsHONGKONG():
    ENABLE_ENGNUM_DELETE_CODE = TRUE
elif locale.IsNEWCIBN() or locale.IsCIBN10():
    ENABLE_ENGNUM_DELETE_CODE = TRUE
elif locale.IsEUROPE():
    ENABLE_ENGNUM_DELETE_CODE = TRUE


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

class SelectCharacterWindow(ui.Window):

    # SLOT4
    #SLOT_ROTATION = ( 140.0, 260.0, 20.0 )    
    #SLOT_COUNT = 3
    SLOT_ROTATION = [135.0, 225.0, 315.0, 45.0]
    SLOT_COUNT = 4
    CHARACTER_TYPE_COUNT = 4

    EMPIRE_NAME = { 
        net.EMPIRE_A : locale.EMPIRE_A, 
        net.EMPIRE_B : locale.EMPIRE_B, 
        net.EMPIRE_C : locale.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(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
        self.slot = self.stream.GetCharacterSlot()

        self.openLoadingFlag = FALSE
        self.startIndex = -1
        self.startReservingTime = 0

        self.flagDict = {}
        self.curRotation = []
        self.destRotation = []
        for rot in self.SLOT_ROTATION:
            self.curRotation.append(rot)
            self.destRotation.append(rot)

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

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

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

        self.startIndex = -1
        self.isLoad = 0

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

    def Open(self):
        if not self.__LoadBoardDialog(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.Enable()
        self.btnDelete.Enable()
        self.btnExit.Enable()
        self.btnLeft.Enable()
        self.btnRight.Enable()

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

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

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

        app.SetCenterPosition(0.0, 0.0, 0.0)
        app.SetCamera(1550.0, 15.0, 180.0, 95.0)

        self.isLoad=1
        self.Refresh()

        if self.stream.isAutoSelect:
            chrSlot=self.stream.GetCharacterSlot()
            self.SelectSlot(chrSlot)
            self.StartGame()

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

        app.ShowCursor()

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

        self.stream.popupWindow.Close()

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

        self.empireName = None
        self.flagDict = {}
        self.dlgBoard = None
        self.btnStart = None
        self.btnCreate = None
        self.btnDelete = None
        self.btnExit = None
        self.btnLeft = None
        self.btnRight = None
        self.backGround = None

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

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

        self.Hide()
        self.KillFocus()

        app.HideCursor()

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

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

        # SLOT4
        indexArray = (3, 2, 1, 0)
        for index in indexArray:
            id=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_ID)
            race=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_RACE)
            form=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_FORM)
            name=net.GetAccountCharacterSlotDataString(index, net.ACCOUNT_CHARACTER_SLOT_NAME)
            hair=net.GetAccountCharacterSlotDataInteger(index, net.ACCOUNT_CHARACTER_SLOT_HAIR)

            if id:
                self.MakeCharacter(index, id, name, race, form, hair)
                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(locale.SELECT_DO_YOU_DELETE_REALLY)
        self.dlgQuestionAcceptButton.SetEvent(ui.__mem_func__(self.RequestDeleteCharacter))
        self.dlgQuestionCancelButton.SetEvent(ui.__mem_func__(self.dlgQuestion.Hide))
        return 1

    def __LoadBoardDialog(self, fileName):
        self.dlgBoard = ui.ScriptWindow()

        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self.dlgBoard, fileName)
        except:
            import exception
            exception.Abort("SelectCharacterWindow.LoadBoardDialog.LoadScript")

        try:
            GetObject=self.dlgBoard.GetChild

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

            self.CharacterName    = GetObject("character_name_value")
            self.CharacterLevel = GetObject("character_level_value")
            self.PlayTime        = GetObject("character_play_time_value")
            self.CharacterHTH    = GetObject("character_hth_value")
            self.CharacterINT    = GetObject("character_int_value")
            self.CharacterSTR    = GetObject("character_str_value")
            self.CharacterDEX    = GetObject("character_dex_value")
            self.GuildName        = GetObject("GuildName")

            self.NameList = []
            self.NameList.append(GetObject("name_warrior"))
            self.NameList.append(GetObject("name_assassin"))
            self.NameList.append(GetObject("name_sura"))
            self.NameList.append(GetObject("name_shaman"))

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

            self.btnLeft = GetObject("left_button")
            self.btnRight = GetObject("right_button")

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

            self.backGround = GetObject("BackGround")

        except:
            import exception
            exception.Abort("SelectCharacterWindow.LoadBoardDialog.BindObject")

        for name in self.NameList:
            name.SetAlpha(0.0)

        self.btnStart.SetEvent(ui.__mem_func__(self.StartGame))
        self.btnCreate.SetEvent(ui.__mem_func__(self.CreateCharacter))
        self.btnExit.SetEvent(ui.__mem_func__(self.ExitSelect))

        

        if NOT_NEED_DELETE_CODE:
            self.btnDelete.SetEvent(ui.__mem_func__(self.PopupDeleteQuestion))
        else:
            self.btnDelete.SetEvent(ui.__mem_func__(self.InputPrivateCode))

        self.btnLeft.SetEvent(ui.__mem_func__(self.DecreaseSlotIndex))
        self.btnRight.SetEvent(ui.__mem_func__(self.IncreaseSlotIndex))

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

        return 1

    def MakeCharacter(self, index, id, name, race, form, hair):
        if 0 == id:
            return

        chr.CreateInstance(index)
        chr.SelectInstance(index)
        chr.SetVirtualID(index)
        chr.SetNameString(name)

        chr.SetRace(race)
        chr.SetArmor(form)
        chr.SetHair(hair)

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

        chr.SetRotation(0.0)

    ## 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.btnLeft.SetUp()
        self.btnRight.SetUp()

        self.btnStart.Disable()
        self.btnCreate.Disable()
        self.btnDelete.Disable()
        self.btnExit.Disable()
        self.btnLeft.Disable()
        self.btnRight.Disable()
        self.dlgQuestion.Hide()

        self.stream.SetCharacterSlot(self.slot)

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

        for i in xrange(self.SLOT_COUNT):

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

            chr.SelectInstance(i)

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

            chr.PushOnceMotion(chr.MOTION_INTRO_NOT_SELECTED, 0.1)

    def OpenChangeNameDialog(self):
        import uiCommon
        nameInputBoard = uiCommon.InputDialogWithDescription()
        nameInputBoard.SetTitle(locale.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(locale.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(locale.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(locale.SELECT_CHANGE_FAILURE_STRANGE_NAME)
        elif 1 == type:
            self.PopupMessage(locale.SELECT_CHANGE_FAILURE_ALREADY_EXIST_NAME)
        elif 100 == type:
            self.PopupMessage(locale.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(locale.SELECT_EMPTY_SLOT)
            return

        net.SendDestroyCharacterPacket(self.slot, "1234567")
        self.PopupMessage(locale.SELECT_DELEING)

    def InputPrivateCode(self):
        
        import uiCommon
        privateInputBoard = uiCommon.InputDialogWithDescription()
        privateInputBoard.SetTitle(locale.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(locale.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(locale.SELECT_EMPTY_SLOT)
            return

        net.SendDestroyCharacterPacket(self.slot, privateCode)
        self.PopupMessage(locale.SELECT_DELEING)

        self.CancelInputPrivateCode()
        return TRUE

    def CancelInputPrivateCode(self):
        self.privateInputBoard = None
        return TRUE

    def OnDeleteSuccess(self, slot):
        self.PopupMessage(locale.SELECT_DELETED)
        self.DeleteCharacter(slot)

    def OnDeleteFailure(self):
        self.PopupMessage(locale.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

        self.slot = index

        chr.SelectInstance(self.slot)

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

        for i in xrange(self.SLOT_COUNT):
            self.destRotation[(i+self.slot)%self.SLOT_COUNT] = self.SLOT_ROTATION[i]

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

            playTime=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_PLAYTIME)
            level=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
            race=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_RACE)
            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)
            name=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_NAME)
            guildID=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_ID)
            guildName=net.GetAccountCharacterSlotDataString(self.slot, net.ACCOUNT_CHARACTER_SLOT_GUILD_NAME)
            self.changeNameFlag=net.GetAccountCharacterSlotDataInteger(self.slot, net.ACCOUNT_CHARACTER_SLOT_CHANGE_NAME_FLAG)

            job = chr.RaceToJob(race)
            if job >= 0 and job < self.CHARACTER_TYPE_COUNT:
                self.destNameAlpha[job] = 1.0

            self.CharacterName.SetText(name)
            self.CharacterLevel.SetText(str(level))

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

            if guildName:
                self.GuildName.SetText(guildName)
            else:
                self.GuildName.SetText(locale.SELECT_NOT_JOIN_GUILD)

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

        self.CharacterName.SetText("")
        self.CharacterLevel.SetText("")
        self.PlayTime.SetText("")
        self.CharacterHTH.SetText("")
        self.CharacterINT.SetText("")
        self.CharacterSTR.SetText("")
        self.CharacterDEX.SetText("")
        self.GuildName.SetText(locale.SELECT_NOT_JOIN_GUILD)

    ## 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.CHARACTER_TYPE_COUNT):
            self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0
            self.NameList[i].SetAlpha(self.curNameAlpha[i])

        for i in xrange(self.SLOT_COUNT):

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

            chr.SelectInstance(i)

            distance = 50.0
            rotRadian = self.curRotation[i] * (math.pi*2) / 360.0
            x = distance*math.sin(rotRadian) + distance*math.cos(rotRadian)
            y = distance*math.cos(rotRadian) - distance*math.sin(rotRadian)
            chr.SetPixelPosition(int(x), int(y), 30)

            #####

            dir = app.GetRotatingDirection(self.destRotation[i], self.curRotation[i])
            rot = app.GetDegreeDifference(self.destRotation[i], self.curRotation[i])

            if app.DEGREE_DIRECTION_RIGHT == dir:
                self.curRotation[i] += rot / 10.0
            elif app.DEGREE_DIRECTION_LEFT == dir:
                self.curRotation[i] -= rot / 10.0

            self.curRotation[i] = (self.curRotation[i] + 360.0) % 360.0

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

                    import player
                    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, locale.UI_OK)

    def OnPressExitKey(self):
        self.ExitSelect()
        return TRUE


uiAffectShower.py(line:353)
uiAffectShower.py(line:347)


PHP:
import ui
import locale
import chr
import item
import app
import skill
import player
import uiToolTip
import math

# WEDDING
class LovePointImage(ui.ExpandedImageBox):

    FILE_PATH = "d:/ymir work/ui/pattern/LovePoint/"
    FILE_DICT = {
        0 : FILE_PATH + "01.dds",
        1 : FILE_PATH + "02.dds",
        2 : FILE_PATH + "02.dds",
        3 : FILE_PATH + "03.dds",
        4 : FILE_PATH + "04.dds",
        5 : FILE_PATH + "05.dds",
    }

    def __init__(self):
        ui.ExpandedImageBox.__init__(self)

        self.loverName = ""
        self.lovePoint = 0

        self.toolTip = uiToolTip.ToolTip(100)
        self.toolTip.HideToolTip()

    def __del__(self):
        ui.ExpandedImageBox.__del__(self)

    def SetLoverInfo(self, name, lovePoint):
        self.loverName = name
        self.lovePoint = lovePoint
        self.__Refresh()

    def OnUpdateLovePoint(self, lovePoint):
        self.lovePoint = lovePoint
        self.__Refresh()

    def __Refresh(self):
        self.lovePoint = max(0, self.lovePoint)
        self.lovePoint = min(100, self.lovePoint)

        if 0 == self.lovePoint:
            loveGrade = 0
        else:
            loveGrade = self.lovePoint / 25 + 1
        fileName = self.FILE_DICT.get(loveGrade, self.FILE_PATH+"00.dds")

        try:
            self.LoadImage(fileName)
        except:
            import dbg
            dbg.TraceError("LovePointImage.SetLoverInfo(lovePoint=%d) - LoadError %s" % (lovePoint, fileName))

        self.SetScale(0.7, 0.7)

        self.toolTip.ClearToolTip()
        self.toolTip.SetTitle(self.loverName)
        self.toolTip.AppendTextLine(locale.AFF_LOVE_POINT % (self.lovePoint))
        self.toolTip.ResizeToolTip()

    def OnMouseOverIn(self):
        self.toolTip.ShowToolTip()

    def OnMouseOverOut(self):
        self.toolTip.HideToolTip()
# END_OF_WEDDING


class HorseImage(ui.ExpandedImageBox):

    FILE_PATH = "d:/ymir work/ui/pattern/HorseState/"

    FILE_DICT = {
        00 : FILE_PATH+"00.dds",
        01 : FILE_PATH+"00.dds",
        02 : FILE_PATH+"00.dds",
        03 : FILE_PATH+"00.dds",
        10 : FILE_PATH+"10.dds",
        11 : FILE_PATH+"11.dds",
        12 : FILE_PATH+"12.dds",
        13 : FILE_PATH+"13.dds",
        20 : FILE_PATH+"20.dds",
        21 : FILE_PATH+"21.dds",
        22 : FILE_PATH+"22.dds",
        23 : FILE_PATH+"23.dds",
        30 : FILE_PATH+"30.dds",
        31 : FILE_PATH+"31.dds",
        32 : FILE_PATH+"32.dds",
        33 : FILE_PATH+"33.dds",
    }

    def __init__(self):
        ui.ExpandedImageBox.__init__(self)

        #self.textLineList = []
        self.toolTip = uiToolTip.ToolTip(100)
        self.toolTip.HideToolTip()

    def __GetHorseGrade(self, level):
        if 0 == level:
            return 0

        return (level-1)/10 + 1

    def SetState(self, level, health, battery):
        #self.textLineList=[]
        self.toolTip.ClearToolTip()

        if level>0:

            try:
                grade = self.__GetHorseGrade(level)
                self.__AppendText(locale.LEVEL_LIST[grade])
            except IndexError:
                print "HorseImage.SetState(level=%d, health=%d, battery=%d) - Unknown Index" % (level, health, battery)
                return

            try:
                healthName=locale.HEALTH_LIST[health]
                if len(healthName)>0:
                    self.__AppendText(healthName)
            except IndexError:
                print "HorseImage.SetState(level=%d, health=%d, battery=%d) - Unknown Index" % (level, health, battery)
                return

            if health>0:
                if battery==0:
                    self.__AppendText(locale.NEEFD_REST)

            try:
                fileName=self.FILE_DICT[health*10+battery]
            except KeyError:
                print "HorseImage.SetState(level=%d, health=%d, battery=%d) - KeyError" % (level, health, battery)

            try:
                self.LoadImage(fileName)
            except:
                print "HorseImage.SetState(level=%d, health=%d, battery=%d) - LoadError %s" % (level, health, battery, fileName)

        self.SetScale(0.7, 0.7)

    def __AppendText(self, text):

        self.toolTip.AppendTextLine(text)
        self.toolTip.ResizeToolTip()

        #x=self.GetWidth()/2
        #textLine = ui.TextLine()
        #textLine.SetParent(self)
        #textLine.SetSize(0, 0)
        #textLine.SetOutline()
        #textLine.Hide()
        #textLine.SetPosition(x, 40+len(self.textLineList)*16)
        #textLine.SetText(text)
        #self.textLineList.append(textLine)

    def OnMouseOverIn(self):
        #for textLine in self.textLineList:
        #    textLine.Show()

        self.toolTip.ShowToolTip()

    def OnMouseOverOut(self):
        #for textLine in self.textLineList:
        #    textLine.Hide()

        self.toolTip.HideToolTip()


# AUTO_POTION
class AutoPotionImage(ui.ExpandedImageBox):

    FILE_PATH_HP = "d:/ymir work/ui/pattern/auto_hpgauge/"
    FILE_PATH_SP = "d:/ymir work/ui/pattern/auto_spgauge/"

    def __init__(self):
        ui.ExpandedImageBox.__init__(self)

        self.loverName = ""
        self.lovePoint = 0
        self.potionType = player.AUTO_POTION_TYPE_HP
        self.filePath = ""

        self.toolTip = uiToolTip.ToolTip(100)
        self.toolTip.HideToolTip()

    def __del__(self):
        ui.ExpandedImageBox.__del__(self)

    def SetPotionType(self, type):
        self.potionType = type
        
        if player.AUTO_POTION_TYPE_HP == type:
            self.filePath = self.FILE_PATH_HP
        elif player.AUTO_POTION_TYPE_SP == type:
            self.filePath = self.FILE_PATH_SP
            

    def OnUpdateAutoPotionImage(self):
        self.__Refresh()

    def __Refresh(self):
        print "__Refresh"
    
        isActivated, currentAmount, totalAmount, slotIndex = player.GetAutoPotionInfo(self.potionType)
        
        amountPercent = (float(currentAmount) / totalAmount) * 100.0
        grade = math.ceil(amountPercent / 20)
        
        if 5.0 > amountPercent:
            grade = 0
            
        if 80.0 < amountPercent:
            grade = 4
            if 90.0 < amountPercent:
                grade = 5            

        fmt = self.filePath + "%.2d.dds"
        fileName = fmt % grade
        
        print self.potionType, amountPercent, fileName

        try:
            self.LoadImage(fileName)
        except:
            import dbg
            dbg.TraceError("AutoPotionImage.__Refresh(potionType=%d) - LoadError %s" % (self.potionType, fileName))

        self.SetScale(0.7, 0.7)

        self.toolTip.ClearToolTip()
        
        if player.AUTO_POTION_TYPE_HP == type:
            self.toolTip.SetTitle(locale.TOOLTIP_AUTO_POTION_HP)
        else:
            self.toolTip.SetTitle(locale.TOOLTIP_AUTO_POTION_SP)
            
        self.toolTip.AppendTextLine(locale.TOOLTIP_AUTO_POTION_REST    % (amountPercent))
        self.toolTip.ResizeToolTip()

    def OnMouseOverIn(self):
        self.toolTip.ShowToolTip()

    def OnMouseOverOut(self):
        self.toolTip.HideToolTip()
# END_OF_AUTO_POTION


class AffectImage(ui.ExpandedImageBox):

    def __init__(self):
        ui.ExpandedImageBox.__init__(self)

        self.toolTipText = None
        self.isSkillAffect = TRUE
        self.description = None
        self.endTime = 0
        self.affect = None

    def SetAffect(self, affect):
        self.affect = affect

    def GetAffect(self):
        return self.affect

    def SetToolTipText(self, text, x = 0, y = -19):

        if not self.toolTipText:
            textLine = ui.TextLine()
            textLine.SetParent(self)
            textLine.SetSize(0, 0)
            textLine.SetOutline()
            textLine.Hide()
            self.toolTipText = textLine
            self.toolTipText.SetPosition(x + self.GetWidth()/2 - 20, y)

        self.toolTipText.SetText(text)

    def SetDescription(self, description):
        self.description = description

    def SetDuration(self, duration):
        self.endTime = 0
        if duration > 0:
            self.endTime = app.GetGlobalTimeStamp() + duration

    def UpdateAutoPotionDescription(self):        
        
        potionType = 0
        if self.affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
            potionType = player.AUTO_POTION_TYPE_HP
        else:
            potionType = player.AUTO_POTION_TYPE_SP    
        
        isActivated, currentAmount, totalAmount, slotIndex = player.GetAutoPotionInfo(potionType)
        
        #print "UpdateAutoPotionDescription ", isActivated, currentAmount, totalAmount, slotIndex
        
        amountPercent = 0.0
        
        try:
            amountPercent = (float(currentAmount) / totalAmount) * 100.0        
        except:
            amountPercent = 100.0
        
        self.SetToolTipText(self.description % amountPercent, 0, 40)
                
    def UpdateDescription(self):
        if not self.description:
            return
            
        toolTip = self.description
        if self.endTime > 0:
            leftTime = locale.SecondToDHM(self.endTime - app.GetGlobalTimeStamp())
            toolTip += " (%s : %s)" % (locale.LEFT_TIME, leftTime)
        self.SetToolTipText(toolTip, 0, 40)
        
    #µ¶ÀϹöÀü¿¡¼­ ½Ã°£À» Á¦°ÅÇϱâ À§Çؼ­ »ç¿ë 
    def UpdateDescription2(self):
        if not self.description:
            return

        toolTip = self.description
        self.SetToolTipText(toolTip, 0, 40)

    def SetSkillAffectFlag(self, flag):
        self.isSkillAffect = flag

    def IsSkillAffect(self):
        return self.isSkillAffect

    def OnMouseOverIn(self):
        if self.toolTipText:
            self.toolTipText.Show()

    def OnMouseOverOut(self):
        if self.toolTipText:
            self.toolTipText.Hide()

class AffectShower(ui.Window):

    MALL_DESC_IDX_START = 1000
    IMAGE_STEP = 25
    AFFECT_MAX_NUM = 32

    AFFECT_DATA_DICT =    {
            chr.AFFECT_POISON : (locale.SKILL_TOXICDIE, "d:/ymir work/ui/skill/common/affect/poison.sub"),
            chr.AFFECT_SLOW : (locale.SKILL_SLOW, "d:/ymir work/ui/skill/common/affect/slow.sub"),
            chr.AFFECT_STUN : (locale.SKILL_STUN, "d:/ymir work/ui/skill/common/affect/stun.sub"),

            chr.AFFECT_ATT_SPEED_POTION : (locale.SKILL_INC_ATKSPD, "d:/ymir work/ui/skill/common/affect/Increase_Attack_Speed.sub"),
            chr.AFFECT_MOV_SPEED_POTION : (locale.SKILL_INC_MOVSPD, "d:/ymir work/ui/skill/common/affect/Increase_Move_Speed.sub"),
            chr.AFFECT_FISH_MIND : (locale.SKILL_FISHMIND, "d:/ymir work/ui/skill/common/affect/fishmind.sub"),

            chr.AFFECT_JEONGWI : (locale.SKILL_JEONGWI, "d:/ymir work/ui/skill/warrior/jeongwi_03.sub",),
            chr.AFFECT_GEOMGYEONG : (locale.SKILL_GEOMGYEONG, "d:/ymir work/ui/skill/warrior/geomgyeong_03.sub",),
            chr.AFFECT_CHEONGEUN : (locale.SKILL_CHEONGEUN, "d:/ymir work/ui/skill/warrior/cheongeun_03.sub",),
            chr.AFFECT_GYEONGGONG : (locale.SKILL_GYEONGGONG, "d:/ymir work/ui/skill/assassin/gyeonggong_03.sub",),
            chr.AFFECT_EUNHYEONG : (locale.SKILL_EUNHYEONG, "d:/ymir work/ui/skill/assassin/eunhyeong_03.sub",),
            chr.AFFECT_GWIGEOM : (locale.SKILL_GWIGEOM, "d:/ymir work/ui/skill/sura/gwigeom_03.sub",),
            chr.AFFECT_GONGPO : (locale.SKILL_GONGPO, "d:/ymir work/ui/skill/sura/gongpo_03.sub",),
            chr.AFFECT_JUMAGAP : (locale.SKILL_JUMAGAP, "d:/ymir work/ui/skill/sura/jumagap_03.sub"),
            chr.AFFECT_HOSIN : (locale.SKILL_HOSIN, "d:/ymir work/ui/skill/shaman/hosin_03.sub",),
            chr.AFFECT_BOHO : (locale.SKILL_BOHO, "d:/ymir work/ui/skill/shaman/boho_03.sub",),
            chr.AFFECT_KWAESOK : (locale.SKILL_KWAESOK, "d:/ymir work/ui/skill/shaman/kwaesok_03.sub",),
            chr.AFFECT_HEUKSIN : (locale.SKILL_HEUKSIN, "d:/ymir work/ui/skill/sura/heuksin_03.sub",),
            chr.AFFECT_MUYEONG : (locale.SKILL_MUYEONG, "d:/ymir work/ui/skill/sura/muyeong_03.sub",),
            chr.AFFECT_GICHEON : (locale.SKILL_GICHEON, "d:/ymir work/ui/skill/shaman/gicheon_03.sub",),
            chr.AFFECT_JEUNGRYEOK : (locale.SKILL_JEUNGRYEOK, "d:/ymir work/ui/skill/shaman/jeungryeok_03.sub",),
            chr.AFFECT_PABEOP : (locale.SKILL_PABEOP, "d:/ymir work/ui/skill/sura/pabeop_03.sub",),
            chr.AFFECT_FALLEN_CHEONGEUN : (locale.SKILL_CHEONGEUN, "d:/ymir work/ui/skill/warrior/cheongeun_03.sub",),
            28 : (locale.SKILL_FIRE, "d:/ymir work/ui/skill/sura/hwayeom_03.sub",),
            chr.AFFECT_CHINA_FIREWORK : (locale.SKILL_POWERFUL_STRIKE, "d:/ymir work/ui/skill/common/affect/powerfulstrike.sub",),

            #64 - END
            chr.NEW_AFFECT_EXP_BONUS : (locale.TOOLTIP_MALL_EXPBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/exp_bonus.sub",),

            chr.NEW_AFFECT_ITEM_BONUS : (locale.TOOLTIP_MALL_ITEMBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/item_bonus.sub",),
            chr.NEW_AFFECT_SAFEBOX : (locale.TOOLTIP_MALL_SAFEBOX, "d:/ymir work/ui/skill/common/affect/safebox.sub",),
            chr.NEW_AFFECT_AUTOLOOT : (locale.TOOLTIP_MALL_AUTOLOOT, "d:/ymir work/ui/skill/common/affect/autoloot.sub",),
            chr.NEW_AFFECT_FISH_MIND : (locale.TOOLTIP_MALL_FISH_MIND, "d:/ymir work/ui/skill/common/affect/fishmind.sub",),
            chr.NEW_AFFECT_MARRIAGE_FAST : (locale.TOOLTIP_MALL_MARRIAGE_FAST, "d:/ymir work/ui/skill/common/affect/marriage_fast.sub",),
            chr.NEW_AFFECT_GOLD_BONUS : (locale.TOOLTIP_MALL_GOLDBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/gold_bonus.sub",),

            chr.NEW_AFFECT_NO_DEATH_PENALTY : (locale.TOOLTIP_APPLY_NO_DEATH_PENALTY, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
            chr.NEW_AFFECT_SKILL_BOOK_BONUS : (locale.TOOLTIP_APPLY_SKILL_BOOK_BONUS, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
            chr.NEW_AFFECT_SKILL_BOOK_NO_DELAY : (locale.TOOLTIP_APPLY_SKILL_BOOK_NO_DELAY, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
            
            # ÀÚµ¿¹°¾à hp, sp
            chr.NEW_AFFECT_AUTO_HP_RECOVERY : (locale.TOOLTIP_AUTO_POTION_REST, "d:/ymir work/ui/pattern/auto_hpgauge/05.dds"),            
            chr.NEW_AFFECT_AUTO_SP_RECOVERY : (locale.TOOLTIP_AUTO_POTION_REST, "d:/ymir work/ui/pattern/auto_spgauge/05.dds"),
            #chr.NEW_AFFECT_AUTO_HP_RECOVERY : (locale.TOOLTIP_AUTO_POTION_REST, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),            
            #chr.NEW_AFFECT_AUTO_SP_RECOVERY : (locale.TOOLTIP_AUTO_POTION_REST, "d:/ymir work/ui/skill/common/affect/gold_bonus.sub"),            

            MALL_DESC_IDX_START+player.POINT_MALL_ATTBONUS : (locale.TOOLTIP_MALL_ATTBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/att_bonus.sub",),
            MALL_DESC_IDX_START+player.POINT_MALL_DEFBONUS : (locale.TOOLTIP_MALL_DEFBONUS_STATIC, "d:/ymir work/ui/skill/common/affect/def_bonus.sub",),
            MALL_DESC_IDX_START+player.POINT_MALL_EXPBONUS : (locale.TOOLTIP_MALL_EXPBONUS, "d:/ymir work/ui/skill/common/affect/exp_bonus.sub",),
            MALL_DESC_IDX_START+player.POINT_MALL_ITEMBONUS : (locale.TOOLTIP_MALL_ITEMBONUS, "d:/ymir work/ui/skill/common/affect/item_bonus.sub",),
            MALL_DESC_IDX_START+player.POINT_MALL_GOLDBONUS : (locale.TOOLTIP_MALL_GOLDBONUS, "d:/ymir work/ui/skill/common/affect/gold_bonus.sub",),
            MALL_DESC_IDX_START+player.POINT_CRITICAL_PCT : (locale.TOOLTIP_APPLY_CRITICAL_PCT,"d:/ymir work/ui/skill/common/affect/critical.sub"),
            MALL_DESC_IDX_START+player.POINT_PENETRATE_PCT : (locale.TOOLTIP_APPLY_PENETRATE_PCT, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
            MALL_DESC_IDX_START+player.POINT_MAX_HP_PCT : (locale.TOOLTIP_MAX_HP_PCT, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),
            MALL_DESC_IDX_START+player.POINT_MAX_SP_PCT : (locale.TOOLTIP_MAX_SP_PCT, "d:/ymir work/ui/skill/common/affect/gold_premium.sub"),    

            MALL_DESC_IDX_START+player.POINT_PC_BANG_EXP_BONUS : (locale.TOOLTIP_MALL_EXPBONUS_P_STATIC, "d:/ymir work/ui/skill/common/affect/EXP_Bonus_p_on.sub",),
            MALL_DESC_IDX_START+player.POINT_PC_BANG_DROP_BONUS: (locale.TOOLTIP_MALL_ITEMBONUS_P_STATIC, "d:/ymir work/ui/skill/common/affect/Item_Bonus_p_on.sub",),
    }

    def __init__(self):
        ui.Window.__init__(self)

        self.serverPlayTime=0
        self.clientPlayTime=0
        
        self.lastUpdateTime=0
        self.affectImageDict={}
        self.horseImage=None
        self.lovePointImage=None
        self.autoPotionImageHP = AutoPotionImage()
        self.autoPotionImageSP = AutoPotionImage()
        self.SetPosition(10, 10)
        self.Show()

    def ClearAllAffects(self):
        self.horseImage=None
        self.lovePointImage=None
        self.affectImageDict={}
        self.__ArrangeImageList()

    def ClearAffects(self): ## ½ºÅ³ ÀÌÆåÆ®¸¸ ¾ø¾Û´Ï´Ù.
        self.living_affectImageDict={}
        for key, image in self.affectImageDict.items():
            if not image.IsSkillAffect():
                self.living_affectImageDict[key] = image
        self.affectImageDict = self.living_affectImageDict
        self.__ArrangeImageList()

    def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):

        print "BINARY_NEW_AddAffect", type, pointIdx, value, duration

        if type < 500:
            return

        if type == chr.NEW_AFFECT_MALL:
            affect = self.MALL_DESC_IDX_START + pointIdx
        else:
            affect = type

        if self.affectImageDict.has_key(affect):
            return

        if not self.AFFECT_DATA_DICT.has_key(affect):
            return

        ## ¿ë½ÅÀÇ °¡È£, ¼±ÀÎÀÇ ±³ÈÆÀº Duration À» 0 À¸·Î ¼³Á¤ÇÑ´Ù.
        if affect == chr.NEW_AFFECT_NO_DEATH_PENALTY or\
           affect == chr.NEW_AFFECT_SKILL_BOOK_BONUS or\
           affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or\
           affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY or\
           affect == chr.NEW_AFFECT_SKILL_BOOK_NO_DELAY:
            duration = 0

        affectData = self.AFFECT_DATA_DICT[affect]
        description = affectData[0]
        filename = affectData[1]

        if pointIdx == player.POINT_MALL_ITEMBONUS or\
           pointIdx == player.POINT_MALL_GOLDBONUS:
            value = 1 + float(value) / 100.0

        trashValue = 123
        #if affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
        if trashValue == 1:
            try:
                #image = AutoPotionImage()
                #image.SetParent(self)
                image = None
                
                if affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY:
                    image.SetPotionType(player.AUTO_POTION_TYPE_SP)
                    image = self.autoPotionImageSP
                    #self.autoPotionImageSP = image;
                else:
                    image.SetPotionType(player.AUTO_POTION_TYPE_HP)
                    image = self.autoPotionImageHP
                    #self.autoPotionImageHP = image;
                
                image.SetParent(self)
                image.Show()
                image.OnUpdateAutoPotionImage()
                
                self.affectImageDict[affect] = image
                self.__ArrangeImageList()
                
            except Exception, e:
                print "except Aff auto potion affect ", e
                pass                
            
        else:
            if affect != chr.NEW_AFFECT_AUTO_SP_RECOVERY and affect != chr.NEW_AFFECT_AUTO_HP_RECOVERY:
                description = description(float(value))

            try:
                print "Add affect %s" % affect
                image = AffectImage()
                image.SetParent(self)
                image.LoadImage(filename)
                image.SetDescription(description)
                image.SetDuration(duration)
                image.SetAffect(affect)
                if affect == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE or\
                    affect == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE_UNDER_15:
                    image.UpdateDescription2()
                elif affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
                    image.UpdateAutoPotionDescription()
                else:
                    image.UpdateDescription()
                    
                image.SetScale(0.7, 0.7)
                image.SetSkillAffectFlag(FALSE)
                image.Show()
                self.affectImageDict[affect] = image
                self.__ArrangeImageList()
            except Exception, e:
                print "except Aff affect "
                pass

    def BINARY_NEW_RemoveAffect(self, type, pointIdx):
        if type == chr.NEW_AFFECT_MALL:
            affect = self.MALL_DESC_IDX_START + pointIdx
        else:
            affect = type
    
        print "Remove Affect %s %s" % ( type , pointIdx )
        self.__RemoveAffect(affect)
        self.__ArrangeImageList()

    def SetAffect(self, affect):
        self.__AppendAffect(affect)
        self.__ArrangeImageList()

    def ResetAffect(self, affect):
        self.__RemoveAffect(affect)
        self.__ArrangeImageList()

    def SetLoverInfo(self, name, lovePoint):
        image = LovePointImage()
        image.SetParent(self)
        image.SetLoverInfo(name, lovePoint)
        self.lovePointImage = image
        self.__ArrangeImageList()

    def ShowLoverState(self):
        if self.lovePointImage:
            self.lovePointImage.Show()
            self.__ArrangeImageList()

    def HideLoverState(self):
        if self.lovePointImage:
            self.lovePointImage.Hide()
            self.__ArrangeImageList()

    def ClearLoverState(self):
        self.lovePointImage = None
        self.__ArrangeImageList()

    def OnUpdateLovePoint(self, lovePoint):
        if self.lovePointImage:
            self.lovePointImage.OnUpdateLovePoint(lovePoint)

    def SetHorseState(self, level, health, battery):
        if level==0:
            self.horseImage=None
        else:
            image = HorseImage()
            image.SetParent(self)
            image.SetState(level, health, battery)
            image.Show()

            self.horseImage=image
            self.__ArrangeImageList()

    def SetPlayTime(self, playTime):
        self.serverPlayTime = playTime
        self.clientPlayTime = app.GetTime()
        
        if locale.IsVIETNAM():        
            image = PlayTimeImage()
            image.SetParent(self)
            image.SetPlayTime(playTime)
            image.Show()

            self.playTimeImage=image
            self.__ArrangeImageList()

    def __AppendAffect(self, affect):

        if self.affectImageDict.has_key(affect):
            return

        try:
            affectData = self.AFFECT_DATA_DICT[affect]
        except KeyError:
            return

        name = affectData[0]
        filename = affectData[1]

        skillIndex = player.AffectIndexToSkillIndex(affect)
        if 0 != skillIndex:
            name = skill.GetSkillName(skillIndex)

        image = AffectImage()
        image.SetParent(self)
        image.SetSkillAffectFlag(TRUE)

        try:
            image.LoadImage(filename)
        except:
            pass

        image.SetToolTipText(name, 0, 40)
        image.SetScale(0.7, 0.7)
        image.Show()
        self.affectImageDict[affect] = image

    def __RemoveAffect(self, affect):
        """
        if affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY:
            self.autoPotionImageSP.Hide()

        if affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
            self.autoPotionImageHP.Hide()
        """
            
        if not self.affectImageDict.has_key(affect):
            print "__RemoveAffect %s ( No Affect )" % affect
            return

        print "__RemoveAffect %s ( Affect )" % affect
        del self.affectImageDict[affect]
        
        self.__ArrangeImageList()

    def __ArrangeImageList(self):

        width = len(self.affectImageDict) * self.IMAGE_STEP
        if self.lovePointImage:
            width+=self.IMAGE_STEP
        if self.horseImage:
            width+=self.IMAGE_STEP

        self.SetSize(width, 26)

        xPos = 0

        if self.lovePointImage:
            if self.lovePointImage.IsShow():
                self.lovePointImage.SetPosition(xPos, 0)
                xPos += self.IMAGE_STEP

        if self.horseImage:
            self.horseImage.SetPosition(xPos, 0)
            xPos += self.IMAGE_STEP

        for image in self.affectImageDict.values():
            image.SetPosition(xPos, 0)
            xPos += self.IMAGE_STEP

    def OnUpdate(self):        
        try:
            if app.GetGlobalTime() - self.lastUpdateTime > 500:
            #if 0 < app.GetGlobalTime():
                self.lastUpdateTime = app.GetGlobalTime()

                for image in self.affectImageDict.values():
                    if image.GetAffect() == chr.NEW_AFFECT_AUTO_HP_RECOVERY or image.GetAffect() == chr.NEW_AFFECT_AUTO_SP_RECOVERY:
                        image.UpdateAutoPotionDescription()
                        continue
                        
                    if not image.IsSkillAffect():
                        if image.GetAffect() == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE or\
                            image.GetAffect() == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE_UNDER_15:
                            image.UpdateDescription2()
                        else:
                            image.UpdateDescription()
        except Exception, e:
            print "AffectShower::OnUpdate error : ", e

Per favore non so come risolvere!
potete anche contattarmi su skype:
game.over419

- - - Updated - - -

Nessuno che mi puo dare una mano?

- - - Updated - - -

Risolto! GRAZIE A BLACKWOLF!! è STATO GENTILISSIMO!!! E ME LA RISOLTO IN MENO DI 2 MINUTI.
CONSIGLIO A TUTTI DI CHIEDERE AIUTO A LUI, SE è DISPONIBILE NON CI PENSA 2 VOLTE A AIUTARVI!!
QUESTO è IL SUO SITO!

http://blackwolf96blog.wordpress.com/380-2/
 
Stato
Discussione chiusa ad ulteriori risposte.
Indietro
Top Bottom