Jump to content

Erro - Character Window - Illumina


Marco
 Share

Recommended Posts

Boas pessoal, ando a tentar instalar a interface " ilumina" comecei pela Character window, tudo normal até que reparei numa coisa, tudo bem até lv 99,  a lv 100 a exp necessária fica negativa e a exp em si aparece esquisita como podem ver nas imagens a baixo.

http://prntscr.com/gozuxz

 

Citar

import ui
import uiScriptLocale
import app
import net
import dbg
import snd
import player
import mouseModule
import wndMgr
import skill
import playerSettingModule
import quest
import localeInfo
import uiToolTip
import constInfo
import emotion
import chr

postac = 1
status = 0
skills = 0
emotions = 0
quests = 0

SHOW_ONLY_ACTIVE_SKILL = FALSE
SHOW_LIMIT_SUPPORT_SKILL_LIST = []
HIDE_SUPPORT_SKILL_POINT = TRUE

#HIDE_SUPPORT_SKILL_POINT = TRUE    
#SHOW_LIMIT_SUPPORT_SKILL_LIST = [121, 122, 123, 124, 127, 129, 128, 131, 137, 138, 139, 140,]
SHOW_LIMIT_SUPPORT_SKILL_LIST = [121, 122, 123, 124, 126, 127, 129, 128, 131, 137, 138, 139, 140,141,142]


FACE_IMAGE_DICT = {
    playerSettingModule.RACE_WARRIOR_M    : "illumina/faces/warrior_m.tga",
    playerSettingModule.RACE_WARRIOR_W    : "illumina/faces/warrior_w.tga",
    playerSettingModule.RACE_ASSASSIN_M    : "illumina/faces/ninja_m.tga",
    playerSettingModule.RACE_ASSASSIN_W    : "illumina/faces/ninja_w.tga",
    playerSettingModule.RACE_SURA_M        : "illumina/faces/sura_m.tga",
    playerSettingModule.RACE_SURA_W        : "illumina/faces/sura_w.tga",
    playerSettingModule.RACE_SHAMAN_M    : "illumina/faces/shaman_m.tga",
    playerSettingModule.RACE_SHAMAN_W    : "illumina/faces/shaman_w.tga",
}
def unsigned32(n):
    return n & 0xFFFFFFFFL
    
class CharacterWindow(ui.ScriptWindow):

    ACTIVE_PAGE_SLOT_COUNT = 8
    SUPPORT_PAGE_SLOT_COUNT = 12

    PAGE_SLOT_COUNT = 12
    PAGE_HORSE = 2

    SKILL_GROUP_NAME_DICT = {
        playerSettingModule.JOB_WARRIOR    : { 1 : localeInfo.SKILL_GROUP_WARRIOR_1,    2 : localeInfo.SKILL_GROUP_WARRIOR_2, },
        playerSettingModule.JOB_ASSASSIN    : { 1 : localeInfo.SKILL_GROUP_ASSASSIN_1,    2 : localeInfo.SKILL_GROUP_ASSASSIN_2, },
        playerSettingModule.JOB_SURA        : { 1 : localeInfo.SKILL_GROUP_SURA_1,        2 : localeInfo.SKILL_GROUP_SURA_2, },
        playerSettingModule.JOB_SHAMAN        : { 1 : localeInfo.SKILL_GROUP_SHAMAN_1,    2 : localeInfo.SKILL_GROUP_SHAMAN_2, },
    }

    STAT_DESCRIPTION =    {
        "HTH" : localeInfo.STAT_TOOLTIP_CON,
        "INT" : localeInfo.STAT_TOOLTIP_INT,
        "STR" : localeInfo.STAT_TOOLTIP_STR,
        "DEX" : localeInfo.STAT_TOOLTIP_DEX,
    }


    STAT_MINUS_DESCRIPTION = localeInfo.STAT_MINUS_DESCRIPTION

    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.state = "STATUS"
        self.isLoaded = 0

        self.toolTipSkill = 0
                
        self.__Initialize()
        self.__LoadWindow()

        self.statusPlusCommandDict={
            "HTH" : "/stat ht",
            "INT" : "/stat iq",
            "STR" : "/stat st",
            "DEX" : "/stat dx",
        }

        self.statusMinusCommandDict={
            "HTH-" : "/stat- ht",
            "INT-" : "/stat- iq",
            "STR-" : "/stat- st",
            "DEX-" : "/stat- dx",
        }

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

    def __Initialize(self):
        self.refreshToolTip = 0
        self.curSelectedSkillGroup = 0
        self.canUseHorseSkill = -1

        self.toolTip = None
        self.toolTipJob = None
        self.toolTipAlignment = None
        self.toolTipSkill = None

        #self.faceImage = None
        self.activeSlot = None
        self.tabButtonDict = None
        self.pageDict = None
        self.titleBarDict = None
        self.statusPlusButtonDict = None
        self.statusMinusButtonDict = None

        self.skillPageDict = None
        self.questShowingStartIndex = 0
        self.questScrollBar = None
        self.questSlot = None
        self.questNameList = None
        self.questLastTimeList = None
        self.questLastCountList = None
        self.skillGroupButton = ()

        self.activeSlot = None
        self.activeSkillPointValue = None
        self.skillGroupButton1 = None
        self.skillGroupButton2 = None
        self.activeSkillGroupName = None

        self.guildNameSlot = None
        self.guildNameValue = None
        self.characterNameSlot = None
        self.characterNameValue = None

        self.emotionToolTip = None
        self.soloEmotionSlot = None
        self.dualEmotionSlot = None

    def Show(self):
        self.__LoadWindow()

        ui.ScriptWindow.Show(self)

    def __LoadScript(self, fileName):
        pyScrLoader = ui.PythonScriptLoader()
        pyScrLoader.LoadScriptFile(self, fileName)    
        
    def __BindObject(self):
        self.toolTip = uiToolTip.ToolTip()
        self.toolTipJob = uiToolTip.ToolTip()
        self.toolTipAlignment = uiToolTip.ToolTip(130)        

        #self.faceImage = self.GetChild("Face_Image")

        #faceSlot=self.GetChild("Face_Slot")
        #if 949 == app.GetDefaultCodePage():
        #    faceSlot.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowJobToolTip)
        #    faceSlot.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideJobToolTip)
        
        self.Refreshing()        

        self.characterNameSlot = self.GetChild("NazwaGraczaSlot")            
        self.characterNameValue = self.GetChild("NazwaGracza")
        self.guildNameSlot = self.GetChild("NazwaGildiiSlot")
        self.guildNameValue = self.GetChild("NazwaGildii")
        self.characterNameSlot.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowAlignmentToolTip)
        self.characterNameSlot.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideAlignmentToolTip)

        self.activeSlot = self.GetChild("Skill_Active_Slot")
        self.activeSkillPointValue = self.GetChild("Active_Skill_Point_Value")
        self.skillGroupButton1 = self.GetChild("Skill_Group_Button_1")
        self.skillGroupButton2 = self.GetChild("Skill_Group_Button_2")
        self.activeSkillGroupName = self.GetChild("Active_Skill_Group_Name")
        self.GetChild("SwitchButton1").SetEvent(self.WysunOkno)
        self.GetChild("SwitchButton2").SetEvent(self.ZasunOkno)
        self.GetChild("SwitchButton2").Hide()
        self.TabButton1 = self.GetChild("Tab_Button_01")
        self.TabButton2 = self.GetChild("Tab_Button_02")
        self.TabButton3 = self.GetChild("Tab_Button_03")
        self.TabButton4 = self.GetChild("Tab_Button_04")
        self.TabButton5 = self.GetChild("Tab_Button_05")
        
        self.IkonaPostaci = self.GetChild("ChrIcon")
        
        self.Button1Text = self.GetChild("Button1_Name")
        self.Button1Text.Hide()
        self.Button2Text = self.GetChild("Button2_Name")
        self.Button2Text.Hide()
        self.Button3Text = self.GetChild("Button3_Name")
        self.Button3Text.Hide()
        self.Button4Text = self.GetChild("Button4_Name")
        self.Button4Text.Hide()
        self.Button5Text = self.GetChild("Button5_Name")
        self.Button5Text.Hide()

        self.tabButtonDict = {
            "STATUS"    : self.GetChild("Tab_Button_01"),
            "STATUS2"        : self.GetChild("Tab_Button_02"),
            "SKILL"        : self.GetChild("Tab_Button_03"),
            "EMOTICON"    : self.GetChild("Tab_Button_04"),
            "QUEST"        : self.GetChild("Tab_Button_05")
        }

        self.pageDict = {
            "STATUS"    : self.GetChild("Character_Page"),
            "STATUS2"    : self.GetChild("Stats_Page"),
            "SKILL"        : self.GetChild("Skill_Page"),
            "EMOTICON"    : self.GetChild("Emoticon_Page"),
            "QUEST"        : self.GetChild("Quest_Page")
        }

        self.titleBarDict = {
            "STATUS"    : self.GetChild("Character_TitleBar"),
            "STATUS2"    : self.GetChild("Stats_TitleBar"),
            "SKILL"        : self.GetChild("Skill_TitleBar"),
            "EMOTICON"    : self.GetChild("Emoticon_TitleBar"),
            "QUEST"        : self.GetChild("Quest_TitleBar")
        }

        self.statusPlusButtonDict = {
            "HTH"        : self.GetChild("HTH_Plus"),
            "INT"        : self.GetChild("INT_Plus"),
            "STR"        : self.GetChild("STR_Plus"),
            "DEX"        : self.GetChild("DEX_Plus"),
        }

        self.statusMinusButtonDict = {
            "HTH-"        : self.GetChild("HTH_Minus"),
            "INT-"        : self.GetChild("INT_Minus"),
            "STR-"        : self.GetChild("STR_Minus"),
            "DEX-"        : self.GetChild("DEX_Minus"),
        }

        self.skillPageDict = {
            "ACTIVE" : self.GetChild("Skill_Active_Slot"),
            "SUPPORT" : self.GetChild("Skill_ETC_Slot"),
            "HORSE" : self.GetChild("Skill_Active_Slot"),
        }

        self.skillPageStatDict = {
            "SUPPORT"    : player.SKILL_SUPPORT,
            "ACTIVE"    : player.SKILL_ACTIVE,
            "HORSE"        : player.SKILL_HORSE,
        }

        self.skillGroupButton = (
            self.GetChild("Skill_Group_Button_1"),
            self.GetChild("Skill_Group_Button_2"),
        )

        
        global SHOW_ONLY_ACTIVE_SKILL
        global HIDE_SUPPORT_SKILL_POINT

        self.soloEmotionSlot = self.GetChild("SoloEmotionSlot")
        self.dualEmotionSlot = self.GetChild("DualEmotionSlot")
        self.__SetEmotionSlot()

        self.questShowingStartIndex = 0
        self.questScrollBar = self.GetChild("Quest_ScrollBar")
        self.questScrollBar.SetScrollEvent(ui.__mem_func__(self.OnQuestScroll))
        self.questSlot = self.GetChild("Quest_Slot")
        for i in xrange(quest.QUEST_MAX_NUM):
            self.questSlot.HideSlotBaseImage(i)
            self.questSlot.SetCoverButton(i,\
                                            "d:/ymir work/ui/game/quest/slot_button_01.sub",\
                                            "d:/ymir work/ui/game/quest/slot_button_02.sub",\
                                            "d:/ymir work/ui/game/quest/slot_button_03.sub",\
                                            "d:/ymir work/ui/game/quest/slot_button_03.sub", TRUE)

        self.questNameList = []
        self.questLastTimeList = []
        self.questLastCountList = []
        for i in xrange(quest.QUEST_MAX_NUM):
            self.questNameList.append(self.GetChild("Quest_Name_0" + str(i)))
            self.questLastTimeList.append(self.GetChild("Quest_LastTime_0" + str(i)))
            self.questLastCountList.append(self.GetChild("Quest_LastCount_0" + str(i)))

    def WysunOkno(self):
        szerokosc = self.GetChild("board").GetWidth()
        szerokosc2 = self.GetChild("TabButtonsBoard").GetWidth()
        if szerokosc < 467:
            szerokosc = szerokosc+2
            szerokosc2 = szerokosc2+2
            self.SetSize(szerokosc,393)
            self.GetChild("board").SetSize(szerokosc,393)
            self.GetChild("TabButtonsBoard").SetSize(szerokosc2,350)
            self.GetChild("Skill_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("Emoticon_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("Quest_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("Stats_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("Character_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("SwitchButton1").SetPosition(szerokosc-15-70, 15)
            self.GetChild("SwitchButton2").SetPosition(szerokosc-15-70, 15)
            self.Czekaj = WaitingDialog()
            self.Czekaj.Open(0.0)
            self.Czekaj.SAFE_SetTimeOverEvent(self.WysunOkno)
        else:
            self.TabButton1.SetOverVisual("illumina/chrbutton_big_a.tga")
            self.TabButton1.SetDownVisual("illumina/chrbutton_big_a.tga")
            self.TabButton2.SetOverVisual("illumina/chrbutton_big_a.tga")
            self.TabButton2.SetDownVisual("illumina/chrbutton_big_a.tga")
            self.TabButton3.SetOverVisual("illumina/chrbutton_big_a.tga")
            self.TabButton3.SetDownVisual("illumina/chrbutton_big_a.tga")
            self.TabButton4.SetOverVisual("illumina/chrbutton_big_a.tga")
            self.TabButton4.SetDownVisual("illumina/chrbutton_big_a.tga")
            self.TabButton5.SetOverVisual("illumina/chrbutton_big_a.tga")
            self.TabButton5.SetDownVisual("illumina/chrbutton_big_a.tga")
            if postac == 1:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_a.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_n.tga")
            if status == 1:
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_a.tga")
            else:
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_n.tga")
            if skills == 1:
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_a.tga")
            else:
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_n.tga")
            if emotions == 1:
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_a.tga")
            else:
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_n.tga")
            if quests == 1:
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_a.tga")
            else:
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_n.tga")
            self.Button1Text.Show()
            self.Button2Text.Show()
            self.Button3Text.Show()
            self.Button4Text.Show()
            self.Button5Text.Show()
            self.GetChild("SwitchButton2").Show()
            self.GetChild("SwitchButton1").Hide()

    def ZasunOkno(self):
        szerokosc = self.GetChild("board").GetWidth()
        szerokosc2 = self.GetChild("TabButtonsBoard").GetWidth()
        self.TabButton1.SetOverVisual("illumina/chrbutton_small_a.tga")
        self.TabButton1.SetDownVisual("illumina/chrbutton_small_a.tga")
        self.TabButton2.SetOverVisual("illumina/chrbutton_small_a.tga")
        self.TabButton2.SetDownVisual("illumina/chrbutton_small_a.tga")
        self.TabButton3.SetOverVisual("illumina/chrbutton_small_a.tga")
        self.TabButton3.SetDownVisual("illumina/chrbutton_small_a.tga")
        self.TabButton4.SetOverVisual("illumina/chrbutton_small_a.tga")
        self.TabButton4.SetDownVisual("illumina/chrbutton_small_a.tga")
        self.TabButton5.SetOverVisual("illumina/chrbutton_small_a.tga")
        self.TabButton5.SetDownVisual("illumina/chrbutton_small_a.tga")
        if postac == 1:
            self.TabButton1.SetUpVisual("illumina/chrbutton_small_a.tga")
        else:
            self.TabButton1.SetUpVisual("illumina/chrbutton_small_n.tga")
        if status == 1:
            self.TabButton2.SetUpVisual("illumina/chrbutton_small_a.tga")
        else:
            self.TabButton2.SetUpVisual("illumina/chrbutton_small_n.tga")
        if skills == 1:
            self.TabButton3.SetUpVisual("illumina/chrbutton_small_a.tga")
        else:
            self.TabButton3.SetUpVisual("illumina/chrbutton_small_n.tga")
        if emotions == 1:
            self.TabButton4.SetUpVisual("illumina/chrbutton_small_a.tga")
        else:
            self.TabButton4.SetUpVisual("illumina/chrbutton_small_n.tga")
        if quests == 1:
            self.TabButton5.SetUpVisual("illumina/chrbutton_small_a.tga")
        else:
            self.TabButton5.SetUpVisual("illumina/chrbutton_small_n.tga")
        self.Button1Text.Hide()
        self.Button2Text.Hide()
        self.Button3Text.Hide()
        self.Button4Text.Hide()
        self.Button5Text.Hide()
        if szerokosc>340:
            szerokosc = szerokosc-2
            szerokosc2 = szerokosc2-2
            self.SetSize(szerokosc,393)
            self.GetChild("board").SetSize(szerokosc,393)
            self.GetChild("TabButtonsBoard").SetSize(szerokosc2,350)
            self.GetChild("Skill_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("Emoticon_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("Quest_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("Stats_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("Character_TitleBar").SetWidth(szerokosc-15)
            self.GetChild("SwitchButton1").SetPosition(szerokosc-15-70, 15)
            self.GetChild("SwitchButton2").SetPosition(szerokosc-15-70, 15)
            self.Czekaj = WaitingDialog()
            self.Czekaj.Open(0.0)
            self.Czekaj.SAFE_SetTimeOverEvent(self.ZasunOkno)
        else:
            self.GetChild("SwitchButton1").Show()
            self.GetChild("SwitchButton2").Hide()
            

    def __SetSkillSlotEvent(self):
        for skillPageValue in self.skillPageDict.itervalues():
            skillPageValue.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
            skillPageValue.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectSkill))
            skillPageValue.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
            skillPageValue.SetUnselectItemSlotEvent(ui.__mem_func__(self.ClickSkillSlot))
            skillPageValue.SetUseSlotEvent(ui.__mem_func__(self.ClickSkillSlot))
            skillPageValue.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
            skillPageValue.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
            skillPageValue.SetPressedSlotButtonEvent(ui.__mem_func__(self.OnPressedSlotButton))
            skillPageValue.AppendSlotButton("d:/ymir work/ui/game/windows/btn_plus_up.sub",\
                                            "d:/ymir work/ui/game/windows/btn_plus_over.sub",\
                                            "d:/ymir work/ui/game/windows/btn_plus_down.sub")

    def __SetEmotionSlot(self):

        self.emotionToolTip = uiToolTip.ToolTip()

        for slot in (self.soloEmotionSlot, self.dualEmotionSlot):
            slot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
            slot.SetSelectItemSlotEvent(ui.__mem_func__(self.__SelectEmotion))
            slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.__ClickEmotionSlot))
            slot.SetUseSlotEvent(ui.__mem_func__(self.__ClickEmotionSlot))
            slot.SetOverInItemEvent(ui.__mem_func__(self.__OverInEmotion))
            slot.SetOverOutItemEvent(ui.__mem_func__(self.__OverOutEmotion))
            slot.AppendSlotButton("d:/ymir work/ui/game/windows/btn_plus_up.sub",\
                                            "d:/ymir work/ui/game/windows/btn_plus_over.sub",\
                                            "d:/ymir work/ui/game/windows/btn_plus_down.sub")

        for slotIdx, datadict in emotion.EMOTION_DICT.items():
            emotionIdx = slotIdx

            slot = self.soloEmotionSlot
            if slotIdx > 50:
                slot = self.dualEmotionSlot

            slot.SetEmotionSlot(slotIdx, emotionIdx)
            slot.SetCoverButton(slotIdx)

    def __SelectEmotion(self, slotIndex):
        if not slotIndex in emotion.EMOTION_DICT:
            return

        if app.IsPressed(app.DIK_LCONTROL):
            player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_EMOTION, slotIndex)
            return

        mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_EMOTION, slotIndex, slotIndex)

    def __ClickEmotionSlot(self, slotIndex):
        print "click emotion"
        if not slotIndex in emotion.EMOTION_DICT:
            return

        print "check acting"
        if player.IsActingEmotion():
            return

        command = emotion.EMOTION_DICT[slotIndex]["command"]
        print "command", command

        if slotIndex > 50:
            vid = player.GetTargetVID()

            if 0 == vid or vid == player.GetMainCharacterIndex() or chr.IsNPC(vid) or chr.IsEnemy(vid):
                import chat
                chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.EMOTION_CHOOSE_ONE)
                return

            command += " " + chr.GetNameByVID(vid)

        print "send_command", command
        net.SendChatPacket(command)

    def ActEmotion(self, emotionIndex):
        self.__ClickEmotionSlot(emotionIndex)

    def __OverInEmotion(self, slotIndex):
        if self.emotionToolTip:

            if not slotIndex in emotion.EMOTION_DICT:
                return

            self.emotionToolTip.ClearToolTip()
            self.emotionToolTip.SetTitle(emotion.EMOTION_DICT[slotIndex]["name"])
            self.emotionToolTip.AlignHorizonalCenter()
            self.emotionToolTip.ShowToolTip()

    def __OverOutEmotion(self):
        if self.emotionToolTip:
            self.emotionToolTip.HideToolTip()

    def __BindEvent(self):
        for i in xrange(len(self.skillGroupButton)):
            self.skillGroupButton.SetEvent(lambda arg=i: self.__SelectSkillGroup(arg))

        self.RefreshQuest()
        self.__HideJobToolTip()

        for (tabKey, tabButton) in self.tabButtonDict.items():
            tabButton.SetEvent(ui.__mem_func__(self.__OnClickTabButton), tabKey)

        for (statusPlusKey, statusPlusButton) in self.statusPlusButtonDict.items():
            statusPlusButton.SAFE_SetEvent(self.__OnClickStatusPlusButton, statusPlusKey)
            statusPlusButton.ShowToolTip = lambda arg=statusPlusKey: self.__OverInStatButton(arg)
            statusPlusButton.HideToolTip = lambda arg=statusPlusKey: self.__OverOutStatButton()

        for (statusMinusKey, statusMinusButton) in self.statusMinusButtonDict.items():
            statusMinusButton.SAFE_SetEvent(self.__OnClickStatusMinusButton, statusMinusKey)
            statusMinusButton.ShowToolTip = lambda arg=statusMinusKey: self.__OverInStatMinusButton(arg)
            statusMinusButton.HideToolTip = lambda arg=statusMinusKey: self.__OverOutStatMinusButton()

        for titleBarValue in self.titleBarDict.itervalues():
            titleBarValue.SetCloseEvent(ui.__mem_func__(self.Hide))

        self.questSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.__SelectQuest))

    def __LoadWindow(self):
        if self.isLoaded == 1:
            return

        self.isLoaded = 1

        try:
            self.__LoadScript("UIScript/CharacterWindow.py")
                
            self.__BindObject()
            self.__BindEvent()
        except:
            import exception
            exception.Abort("CharacterWindow.__LoadWindow")

        #self.tabButtonDict["EMOTICON"].Disable()
        self.SetState("STATUS")

    def Refreshing(self):
        curEXP = player.GetStatus(player.EXP)
        nextEXP = player.GetStatus(player.NEXT_EXP)
        self.GetChild("ExpImgFull").SetPercentage(curEXP, nextEXP)
        #self.GetChild("Level_Value").SetText(str(player.GetStatus(player.LEVEL)))
        self.GetChild("LevelText").SetText("|cfff8d090"+str(player.GetStatus(player.LEVEL)))
        
        self.GetChild("PercentExp").SetText("%s%.2f%%" % ("|cfff8d09E", float(curEXP) / max(1, float(nextEXP)) * 100))
        self.GetChild("PlayerExp").SetText("|cffa08784EXP: %d" % (float(curEXP)))
        self.GetChild("NextLvlExp").SetText("|cffa08784Wym.: %d" % (float(nextEXP)))
        
        self.GetChild("PlayerHpText").SetText("|cffa07970"+str(player.GetStatus(player.HP)) + '/' + str(player.GetStatus(player.MAX_HP)))
        self.GetChild("PlayerPeText").SetText("|cffa07970"+str(player.GetStatus(player.SP)) + '/' + str(player.GetStatus(player.MAX_SP)))

        self.GetChild("StrPointsText").SetText("|cffa07970"+str(player.GetStatus(player.ST)))
        self.GetChild("ZrePointsText").SetText("|cffa07970"+str(player.GetStatus(player.DX)))
        self.GetChild("WitPointsText").SetText("|cffa07970"+str(player.GetStatus(player.HT)))
        self.GetChild("IntPointsText").SetText("|cffa07970"+str(player.GetStatus(player.IQ)))

        self.GetChild("AttackValue").SetText("|cffa07970"+self.__GetTotalAtkText())
        self.GetChild("DefValue").SetText("|cffa07970"+self.__GetTotalDefText())

        self.GetChild("MagicAttackValue").SetText("|cffa07970"+self.__GetTotalMagAtkText())
        #self.GetChild("MATT_Value").SetText(str(player.GetStatus(player.MAG_ATT)))
    
        self.GetChild("StatusPoints").SetText("|cffa08784Dostepne punkty [|cfff8d090"+str(player.GetStatus(player.STAT))+"|cffa08784]")

        self.GetChild("MagicDefValue").SetText("|cffa07970"+str(player.GetStatus(player.MAG_DEF)))
        self.GetChild("AttackSpeedValue").SetText("|cffa07970"+str(player.GetStatus(player.ATT_SPEED)))
        self.GetChild("MoveSpeedValue").SetText("|cffa07970"+str(player.GetStatus(player.MOVING_SPEED)))
        self.GetChild("MagicSpeedValue").SetText("|cffa07970"+str(player.GetStatus(player.CASTING_SPEED)))
        self.GetChild("UnikiValue").SetText("|cffa07970"+str(player.GetStatus(player.EVADE_RATE)))
        
        for i in xrange(1,5):
            self.GetChild("TitleName"+str(i)).SetHorizontalAlignCenter()

        #self.__RefreshStatusPlusButtonList()
        #self.__RefreshStatusMinusButtonList()
        #self.RefreshCharacter()
        
        #self.RefreshSkill()
        #self.RefreshSkillPlusButtonList()
        
        #self.ref = WaitingDialog()
        #self.ref.Open(0.1)
        #self.ref.SAFE_SetTimeOverEvent(self.Refreshing)

    def Destroy(self):
        self.ClearDictionary()

        self.__Initialize()

    def Close(self):
        if 0 != self.toolTipSkill:
            self.toolTipSkill.Hide()

        self.Hide()

    def SetSkillToolTip(self, toolTipSkill):
        self.toolTipSkill = toolTipSkill

    def __OnClickStatusPlusButton(self, statusKey):
        try:
            statusPlusCommand=self.statusPlusCommandDict[statusKey]
            net.SendChatPacket(statusPlusCommand)
        except KeyError, msg:
            dbg.TraceError("CharacterWindow.__OnClickStatusPlusButton KeyError: %s", msg)

    def __OnClickStatusMinusButton(self, statusKey):
        try:
            statusMinusCommand=self.statusMinusCommandDict[statusKey]
            net.SendChatPacket(statusMinusCommand)
        except KeyError, msg:
            dbg.TraceError("CharacterWindow.__OnClickStatusMinusButton KeyError: %s", msg)


    def __OnClickTabButton(self, stateKey):
        global postac,status,skills,emotions,quests
        szerokosc = self.GetWidth()
        if stateKey == "STATUS":
            postac = 1
            status = 0
            skills = 0
            emotions = 0
            quests = 0
            self.Button1Text.SetText("|cfff8d090Postaæ")
            self.Button2Text.SetText("Statystyki")
            self.Button3Text.SetText("Umiejetnoœci")
            self.Button4Text.SetText("Emocje")
            self.Button5Text.SetText("Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_a.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_n.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_a.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_n.tga")
        if stateKey == "STATUS2":
            postac = 0
            status = 1
            skills = 0
            emotions = 0
            quests = 0
            self.Button1Text.SetText("Postaæ")
            self.Button2Text.SetText("|cfff8d090Statystyki")
            self.Button3Text.SetText("Umiejetnoœci")
            self.Button4Text.SetText("Emocje")
            self.Button5Text.SetText("Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_a.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_n.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_a.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_n.tga")
        if stateKey == "SKILL":
            postac = 0
            status = 0
            skills = 1
            emotions = 0
            quests = 0
            self.Button1Text.SetText("Postaæ")
            self.Button2Text.SetText("Statystyki")
            self.Button3Text.SetText("|cfff8d090Umiejetnoœci")
            self.Button4Text.SetText("Emocje")
            self.Button5Text.SetText("Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_a.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_n.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_a.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_n.tga")
        if stateKey == "EMOTICON":
            postac = 0
            status = 0
            skills = 0
            emotions = 1
            quests = 0
            self.Button1Text.SetText("Postaæ")
            self.Button2Text.SetText("Statystyki")
            self.Button3Text.SetText("Umiejetnoœci")
            self.Button4Text.SetText("|cfff8d090Emocje")
            self.Button5Text.SetText("Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_a.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_n.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_a.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_n.tga")
        if stateKey == "QUEST":
            postac = 0
            status = 0
            skills = 0
            emotions = 0
            quests = 1
            self.Button1Text.SetText("Postaæ")
            self.Button2Text.SetText("Statystyki")
            self.Button3Text.SetText("Umiejetnoœci")
            self.Button4Text.SetText("Emocje")
            self.Button5Text.SetText("|cfff8d090Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_a.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_a.tga")
        self.SetState(stateKey)

    def SetState(self, stateKey):
        global postac,status,skills,emotions,quests
        
        szerokosc = self.GetWidth()
        
        self.state = stateKey
        

        if stateKey == "STATUS":
            postac = 1
            status = 0
            skills = 0
            emotions = 0
            quests = 0
            self.Button1Text.SetText("|cfff8d090Postaæ")
            self.Button2Text.SetText("Statystyki")
            self.Button3Text.SetText("Umiejetnoœci")
            self.Button4Text.SetText("Emocje")
            self.Button5Text.SetText("Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_a.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_n.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_a.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_n.tga")
        if stateKey == "STATUS2":
            postac = 0
            status = 1
            skills = 0
            emotions = 0
            quests = 0
            self.Button1Text.SetText("Postaæ")
            self.Button2Text.SetText("|cfff8d090Statystyki")
            self.Button3Text.SetText("Umiejetnoœci")
            self.Button4Text.SetText("Emocje")
            self.Button5Text.SetText("Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_a.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_n.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_a.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_n.tga")
        if stateKey == "SKILL":
            postac = 0
            status = 0
            skills = 1
            emotions = 0
            quests = 0
            self.Button1Text.SetText("Postaæ")
            self.Button2Text.SetText("Statystyki")
            self.Button3Text.SetText("|cfff8d090Umiejetnoœci")
            self.Button4Text.SetText("Emocje")
            self.Button5Text.SetText("Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_a.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_n.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_a.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_n.tga")
        if stateKey == "EMOTICON":
            postac = 0
            status = 0
            skills = 0
            emotions = 1
            quests = 0
            self.Button1Text.SetText("Postaæ")
            self.Button2Text.SetText("Statystyki")
            self.Button3Text.SetText("Umiejetnoœci")
            self.Button4Text.SetText("|cfff8d090Emocje")
            self.Button5Text.SetText("Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_a.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_n.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_a.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_n.tga")
        if stateKey == "QUEST":
            postac = 0
            status = 0
            skills = 0
            emotions = 0
            quests = 1
            self.Button1Text.SetText("Postaæ")
            self.Button2Text.SetText("Statystyki")
            self.Button3Text.SetText("Umiejetnoœci")
            self.Button4Text.SetText("Emocje")
            self.Button5Text.SetText("|cfff8d090Zadania")
            if szerokosc == 468:
                self.TabButton1.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_big_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_big_a.tga")
            else:
                self.TabButton1.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton2.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton3.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton4.SetUpVisual("illumina/chrbutton_small_n.tga")
                self.TabButton5.SetUpVisual("illumina/chrbutton_small_a.tga")

        for (tabKey, tabButton) in self.tabButtonDict.items():
            if stateKey!=tabKey:
                tabButton.SetUp()

        for pageValue in self.pageDict.itervalues():
            pageValue.Hide()

        for titleBarValue in self.titleBarDict.itervalues():
            titleBarValue.Hide()

        self.titleBarDict[stateKey].Show()
        self.pageDict[stateKey].Show()
        

    def GetState(self):
        return self.state

    def __GetTotalAtkText(self):
        minAtk=player.GetStatus(player.ATT_MIN)
        maxAtk=player.GetStatus(player.ATT_MAX)
        atkBonus=player.GetStatus(player.ATT_BONUS)
        attackerBonus=player.GetStatus(player.ATTACKER_BONUS)

        if minAtk==maxAtk:
            return "%d" % (minAtk+atkBonus+attackerBonus)
        else:
            return "%d-%d" % (minAtk+atkBonus+attackerBonus, maxAtk+atkBonus+attackerBonus)

    def __GetTotalMagAtkText(self):
        minMagAtk=player.GetStatus(player.MAG_ATT)+player.GetStatus(player.MIN_MAGIC_WEP)
        maxMagAtk=player.GetStatus(player.MAG_ATT)+player.GetStatus(player.MAX_MAGIC_WEP)

        if minMagAtk==maxMagAtk:
            return "%d" % (minMagAtk)
        else:
            return "%d-%d" % (minMagAtk, maxMagAtk)

    def __GetTotalDefText(self):
        defValue=player.GetStatus(player.DEF_GRADE)
        if constInfo.ADD_DEF_BONUS_ENABLE:
            defValue+=player.GetStatus(player.DEF_BONUS)
        return "%d" % (defValue)
    
    def RefreshStatus(self):
        self.__RefreshStatusPlusButtonList()
        self.__RefreshStatusMinusButtonList()
        self.RefreshAlignment()

        if self.refreshToolTip:
            self.refreshToolTip()

    def __RefreshStatusPlusButtonList(self):
        statusPlusPoint=player.GetStatus(player.STAT)

        if statusPlusPoint>0:
            self.ShowStatusPlusButtonList()
        else:
            self.HideStatusPlusButtonList()

    def __RefreshStatusMinusButtonList(self):
        statusMinusPoint=self.__GetStatMinusPoint()

        if statusMinusPoint>0:
            self.__ShowStatusMinusButtonList()
        else:
            self.__HideStatusMinusButtonList()

    def RefreshAlignment(self):
        point, grade = player.GetAlignmentData()

        import colorInfo
        COLOR_DICT = {    0 : colorInfo.TITLE_RGB_GOOD_4,
                        1 : colorInfo.TITLE_RGB_GOOD_3,
                        2 : colorInfo.TITLE_RGB_GOOD_2,
                        3 : colorInfo.TITLE_RGB_GOOD_1,
                        4 : colorInfo.TITLE_RGB_NORMAL,
                        5 : colorInfo.TITLE_RGB_EVIL_1,
                        6 : colorInfo.TITLE_RGB_EVIL_2,
                        7 : colorInfo.TITLE_RGB_EVIL_3,
                        8 : colorInfo.TITLE_RGB_EVIL_4, }
        colorList = COLOR_DICT.get(grade, colorInfo.TITLE_RGB_NORMAL)
        gradeColor = ui.GenerateColor(colorList[0], colorList[1], colorList[2])

        self.toolTipAlignment.ClearToolTip()
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.TITLE_NAME_LIST[grade], gradeColor)
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGNMENT_NAME + str(point))
        self.toolTipAlignment.AlignHorizonalCenter()

    def __ShowStatusMinusButtonList(self):
        for (stateMinusKey, statusMinusButton) in self.statusMinusButtonDict.items():
            statusMinusButton.Show()

    def __HideStatusMinusButtonList(self):
        for (stateMinusKey, statusMinusButton) in self.statusMinusButtonDict.items():
            statusMinusButton.Hide()

    def ShowStatusPlusButtonList(self):
        for (statePlusKey, statusPlusButton) in self.statusPlusButtonDict.items():
            statusPlusButton.Show()

    def HideStatusPlusButtonList(self):
        for (statePlusKey, statusPlusButton) in self.statusPlusButtonDict.items():
            statusPlusButton.Hide()

    def SelectSkill(self, skillSlotIndex):

        mouseController = mouseModule.mouseController

        if FALSE == mouseController.isAttached():

            srcSlotIndex = self.__RealSkillSlotToSourceSlot(skillSlotIndex)
            selectedSkillIndex = player.GetSkillIndex(srcSlotIndex)

            if skill.CanUseSkill(selectedSkillIndex):

                if app.IsPressed(app.DIK_LCONTROL):

                    player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_SKILL, srcSlotIndex)
                    return

                mouseController.AttachObject(self, player.SLOT_TYPE_SKILL, srcSlotIndex, selectedSkillIndex)

        else:

            mouseController.DeattachObject()

    def SelectEmptySlot(self, SlotIndex):
        mouseModule.mouseController.DeattachObject()

    ## ToolTip
    def OverInItem(self, slotNumber):

        if mouseModule.mouseController.isAttached():
            return

        if 0 == self.toolTipSkill:
            return

        srcSlotIndex = self.__RealSkillSlotToSourceSlot(slotNumber)
        skillIndex = player.GetSkillIndex(srcSlotIndex)
        skillLevel = player.GetSkillLevel(srcSlotIndex)
        skillGrade = player.GetSkillGrade(srcSlotIndex)
        skillType = skill.GetSkillType(skillIndex)

        ## ACTIVE
        if skill.SKILL_TYPE_ACTIVE == skillType:
            overInSkillGrade = self.__GetSkillGradeFromSlot(slotNumber)

            if overInSkillGrade == skill.SKILL_GRADE_COUNT-1 and skillGrade == skill.SKILL_GRADE_COUNT:
                self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, skillGrade, skillLevel)
            elif overInSkillGrade == skillGrade:
                self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, overInSkillGrade, skillLevel)
            else:
                self.toolTipSkill.SetSkillOnlyName(srcSlotIndex, skillIndex, overInSkillGrade)

        else:
            self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, skillGrade, skillLevel)

    def OverOutItem(self):
        if 0 != self.toolTipSkill:
            self.toolTipSkill.HideToolTip()

    ## Quest
    def __SelectQuest(self, slotIndex):
        questIndex = quest.GetQuestIndex(self.questShowingStartIndex+slotIndex)

        import event
        event.QuestButtonClick(-2147483648 + questIndex)

    def RefreshQuest(self):

        if self.isLoaded==0:
            return

        questCount = quest.GetQuestCount()
        questRange = range(quest.QUEST_MAX_NUM)

        if questCount > quest.QUEST_MAX_NUM:
            self.questScrollBar.Show()
        else:
            self.questScrollBar.Hide()

        for i in questRange[:questCount]:
            (questName, questIcon, questCounterName, questCounterValue) = quest.GetQuestData(self.questShowingStartIndex+i)

            self.questNameList.SetText(questName)
            self.questNameList.Show()
            self.questLastCountList.Show()
            self.questLastTimeList.Show()

            if len(questCounterName) > 0:
                self.questLastCountList.SetText("%s : %d" % (questCounterName, questCounterValue))
            else:
                self.questLastCountList.SetText("")

            ## Icon
            self.questSlot.SetSlot(i, i, 1, 1, questIcon)

        for i in questRange[questCount:]:
            self.questNameList.Hide()
            self.questLastTimeList.Hide()
            self.questLastCountList.Hide()
            self.questSlot.ClearSlot(i)
            self.questSlot.HideSlotBaseImage(i)

        self.__UpdateQuestClock()

    def __UpdateQuestClock(self):
        # QUEST_LIMIT_COUNT_BUG_FIX
        for i in xrange(min(quest.GetQuestCount(), quest.QUEST_MAX_NUM)):
        # END_OF_QUEST_LIMIT_COUNT_BUG_FIX
            (lastName, lastTime) = quest.GetQuestLastTime(i)

            clockText = localeInfo.QUEST_UNLIMITED_TIME
            if len(lastName) > 0:

                if lastTime <= 0:
                    clockText = localeInfo.QUEST_TIMEOVER

                else:
                    questLastMinute = lastTime / 60
                    questLastSecond = lastTime % 60

                    clockText = lastName + " : "

                    if questLastMinute > 0:
                        clockText += str(questLastMinute) + localeInfo.QUEST_MIN
                        if questLastSecond > 0:
                            clockText += " "

                    if questLastSecond > 0:
                        clockText += str(questLastSecond) + localeInfo.QUEST_SEC

            self.questLastTimeList.SetText(clockText)

    def __GetStatMinusPoint(self):
        POINT_STAT_RESET_COUNT = 112
        return player.GetStatus(POINT_STAT_RESET_COUNT)

    def __OverInStatMinusButton(self, stat):
        try:
            self.__ShowStatToolTip(self.STAT_MINUS_DESCRIPTION[stat] % self.__GetStatMinusPoint())
        except KeyError:
            pass

        self.refreshToolTip = lambda arg=stat: self.__OverInStatMinusButton(arg) 

    def __OverOutStatMinusButton(self):
        self.__HideStatToolTip()
        self.refreshToolTip = 0

    def __OverInStatButton(self, stat):    
        try:
            self.__ShowStatToolTip(self.STAT_DESCRIPTION[stat])
        except KeyError:
            pass

    def __OverOutStatButton(self):
        self.__HideStatToolTip()

    def __ShowStatToolTip(self, statDesc):
        self.toolTip.ClearToolTip()
        self.toolTip.AppendTextLine(statDesc)
        self.toolTip.Show()

    def __HideStatToolTip(self):
        self.toolTip.Hide()

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

    def OnUpdate(self):
        cbmrace = net.GetMainActorRace()
        self.IkonaPostaci.Show()
        if cbmrace == 0:        
            self.IkonaPostaci.LoadImage("illumina/faces/warrior_m.tga")
            self.IkonaPostaci.SetScale(0.9, 0.9)
        elif cbmrace == 1:        
            self.IkonaPostaci.LoadImage("illumina/faces/ninja_w.tga")
            self.IkonaPostaci.SetScale(0.9, 0.9)
        elif cbmrace == 2:        
            self.IkonaPostaci.LoadImage("illumina/faces/sura_m.tga")
            self.IkonaPostaci.SetScale(0.9, 0.9)
        elif cbmrace == 3:        
            self.IkonaPostaci.LoadImage("illumina/faces/shaman_w.tga")
            self.IkonaPostaci.SetScale(0.9, 0.9)
        elif cbmrace == 4:        
            self.IkonaPostaci.LoadImage("illumina/faces/warrior_w.tga")
            self.IkonaPostaci.SetScale(0.9, 0.9)
        elif cbmrace == 5:        
            self.IkonaPostaci.LoadImage("illumina/faces/ninja_m.tga")
            self.IkonaPostaci.SetScale(0.9, 0.9)
        elif cbmrace == 6:        
            self.IkonaPostaci.LoadImage("illumina/faces/sura_w.tga")
            self.IkonaPostaci.SetScale(0.9, 0.9)
        elif cbmrace == 7:        
            self.IkonaPostaci.LoadImage("illumina/faces/shaman_m.tga")
            self.IkonaPostaci.SetScale(0.9, 0.9)
        else:
            self.IkonaPostaci.Hide()
    
        self.Refreshing()
        self.__UpdateQuestClock()

    ## Skill Process
    def __RefreshSkillPage(self, name, slotCount):
        global SHOW_LIMIT_SUPPORT_SKILL_LIST

        skillPage = self.skillPageDict[name]

        startSlotIndex = skillPage.GetStartIndex()
        if "ACTIVE" == name:
            if self.PAGE_HORSE == self.curSelectedSkillGroup:
                startSlotIndex += slotCount

        getSkillType=skill.GetSkillType
        getSkillIndex=player.GetSkillIndex
        getSkillGrade=player.GetSkillGrade
        getSkillLevel=player.GetSkillLevel
        getSkillLevelUpPoint=skill.GetSkillLevelUpPoint
        getSkillMaxLevel=skill.GetSkillMaxLevel
        for i in xrange(slotCount+1):

            slotIndex = i + startSlotIndex
            skillIndex = getSkillIndex(slotIndex)

            for j in xrange(skill.SKILL_GRADE_COUNT):
                skillPage.ClearSlot(self.__GetRealSkillSlot(j, i))

            if 0 == skillIndex:
                continue

            skillGrade = getSkillGrade(slotIndex)
            skillLevel = getSkillLevel(slotIndex)
            skillType = getSkillType(skillIndex)

            ## ½A¸¶ ½ºA³ ¿¹¿U A³¸®
            if player.SKILL_INDEX_RIDING == skillIndex:
                if 1 == skillGrade:
                    skillLevel += 19
                elif 2 == skillGrade:
                    skillLevel += 29
                elif 3 == skillGrade:
                    skillLevel = 40

                skillPage.SetSkillSlotNew(slotIndex, skillIndex, max(skillLevel-1, 0), skillLevel)
                skillPage.SetSlotCount(slotIndex, skillLevel)

            ## ACTIVE
            elif skill.SKILL_TYPE_ACTIVE == skillType:
                for j in xrange(skill.SKILL_GRADE_COUNT):
                    realSlotIndex = self.__GetRealSkillSlot(j, slotIndex)
                    skillPage.SetSkillSlotNew(realSlotIndex, skillIndex, j, skillLevel)
                    skillPage.SetCoverButton(realSlotIndex)

                    if (skillGrade == skill.SKILL_GRADE_COUNT) and j == (skill.SKILL_GRADE_COUNT-1):
                        skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)
                    elif (not self.__CanUseSkillNow()) or (skillGrade != j):
                        skillPage.SetSlotCount(realSlotIndex, 0)
                        skillPage.DisableCoverButton(realSlotIndex)
                    else:
                        skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)

            ## ±×¿U
            else:
                if not SHOW_LIMIT_SUPPORT_SKILL_LIST or skillIndex in SHOW_LIMIT_SUPPORT_SKILL_LIST:
                    realSlotIndex = self.__GetETCSkillRealSlotIndex(slotIndex)
                    skillPage.SetSkillSlot(realSlotIndex, skillIndex, skillLevel)
                    skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)

                    if skill.CanUseSkill(skillIndex):
                        skillPage.SetCoverButton(realSlotIndex)

            skillPage.RefreshSlot()


    def RefreshSkill(self):

        if self.isLoaded==0:
            return

        if self.__IsChangedHorseRidingSkillLevel():
            self.RefreshCharacter()
            return


        global SHOW_ONLY_ACTIVE_SKILL
        if SHOW_ONLY_ACTIVE_SKILL:
            self.__RefreshSkillPage("ACTIVE", self.ACTIVE_PAGE_SLOT_COUNT)
        else:
            self.__RefreshSkillPage("ACTIVE", self.ACTIVE_PAGE_SLOT_COUNT)
            self.__RefreshSkillPage("SUPPORT", self.SUPPORT_PAGE_SLOT_COUNT)

        self.RefreshSkillPlusButtonList()

    def CanShowPlusButton(self, skillIndex, skillLevel, curStatPoint):

        ## ½ºA³AI AOA¸¸e
        if 0 == skillIndex:
            return FALSE

        ## ·¹º§¾÷ A¶°CA≫ ¸¸A·CN´U¸e
        if not skill.CanLevelUpSkill(skillIndex, skillLevel):
            return FALSE

        return TRUE

    def __RefreshSkillPlusButton(self, name):
        global HIDE_SUPPORT_SKILL_POINT
        if HIDE_SUPPORT_SKILL_POINT and "SUPPORT" == name:
            return

        slotWindow = self.skillPageDict[name]
        slotWindow.HideAllSlotButton()

        slotStatType = self.skillPageStatDict[name]
        if 0 == slotStatType:
            return

        statPoint = player.GetStatus(slotStatType)
        startSlotIndex = slotWindow.GetStartIndex()
        if "HORSE" == name:
            startSlotIndex += self.ACTIVE_PAGE_SLOT_COUNT

        if statPoint > 0:
            for i in xrange(self.PAGE_SLOT_COUNT):
                slotIndex = i + startSlotIndex
                skillIndex = player.GetSkillIndex(slotIndex)
                skillGrade = player.GetSkillGrade(slotIndex)
                skillLevel = player.GetSkillLevel(slotIndex)

                if skillIndex == 0:
                    continue
                if skillGrade != 0:
                    continue

                if name == "HORSE":
                    if player.GetStatus(player.LEVEL) >= skill.GetSkillLevelLimit(skillIndex):
                        if skillLevel < 20:
                            slotWindow.ShowSlotButton(self.__GetETCSkillRealSlotIndex(slotIndex))

                else:
                    if "SUPPORT" == name:                        
                        if not SHOW_LIMIT_SUPPORT_SKILL_LIST or skillIndex in SHOW_LIMIT_SUPPORT_SKILL_LIST:
                            if self.CanShowPlusButton(skillIndex, skillLevel, statPoint):
                                slotWindow.ShowSlotButton(slotIndex)
                    else:
                        if self.CanShowPlusButton(skillIndex, skillLevel, statPoint):
                            slotWindow.ShowSlotButton(slotIndex)
                    

    def RefreshSkillPlusButtonList(self):

        if self.isLoaded==0:
            return

        self.RefreshSkillPlusPointLabel()

        if not self.__CanUseSkillNow():
            return

        try:
            if self.PAGE_HORSE == self.curSelectedSkillGroup:
                self.__RefreshSkillPlusButton("HORSE")
            else:
                self.__RefreshSkillPlusButton("ACTIVE")

            self.__RefreshSkillPlusButton("SUPPORT")

        except:
            import exception
            exception.Abort("CharacterWindow.RefreshSkillPlusButtonList.BindObject")

    def RefreshSkillPlusPointLabel(self):
        if self.isLoaded==0:
            return

        if self.PAGE_HORSE == self.curSelectedSkillGroup:
            self.activeSkillPointValue.SetText("|cffa08784Dostepne punkty [|cfff8d090"+str(player.GetStatus(player.SKILL_HORSE))+"|cffa08784]")

        else:
            self.activeSkillPointValue.SetText("|cffa08784Dostepne punkty [|cfff8d090"+str(player.GetStatus(player.SKILL_ACTIVE))+"|cffa08784]")

    ## Skill Level Up Button
    def OnPressedSlotButton(self, slotNumber):
        srcSlotIndex = self.__RealSkillSlotToSourceSlot(slotNumber)

        skillIndex = player.GetSkillIndex(srcSlotIndex)
        curLevel = player.GetSkillLevel(srcSlotIndex)
        maxLevel = skill.GetSkillMaxLevel(skillIndex)

        net.SendChatPacket("/skillup " + str(skillIndex))

    ## Use Skill
    def ClickSkillSlot(self, slotIndex):

        srcSlotIndex = self.__RealSkillSlotToSourceSlot(slotIndex)
        skillIndex = player.GetSkillIndex(srcSlotIndex)
        skillType = skill.GetSkillType(skillIndex)

        if not self.__CanUseSkillNow():
            if skill.SKILL_TYPE_ACTIVE == skillType:
                return

        for slotWindow in self.skillPageDict.values():
            if slotWindow.HasSlot(slotIndex):
                if skill.CanUseSkill(skillIndex):
                    player.ClickSkillSlot(srcSlotIndex)
                    return

        mouseModule.mouseController.DeattachObject()

    ## FIXME : ½ºA³A≫ ≫c¿eCßA≫¶§ ½½·O ¹øE£¸| °¡Ao°i CØ´c ½½·OA≫ A£¾Æ¼­ ¾÷μ¥AIÆ® CN´U.
    ##         ¸A¿i ºOCO¸®. ±¸A¶ AUA¼¸| °³¼±CØ¾ß COμi.
    def OnUseSkill(self, slotIndex, coolTime):

        skillIndex = player.GetSkillIndex(slotIndex)
        skillType = skill.GetSkillType(skillIndex)

        ## ACTIVE
        if skill.SKILL_TYPE_ACTIVE == skillType:
            skillGrade = player.GetSkillGrade(slotIndex)
            slotIndex = self.__GetRealSkillSlot(skillGrade, slotIndex)
        ## ETC
        else:
            slotIndex = self.__GetETCSkillRealSlotIndex(slotIndex)

        for slotWindow in self.skillPageDict.values():
            if slotWindow.HasSlot(slotIndex):
                slotWindow.SetSlotCoolTime(slotIndex, coolTime)
                return

    def OnActivateSkill(self, slotIndex):

        skillGrade = player.GetSkillGrade(slotIndex)
        slotIndex = self.__GetRealSkillSlot(skillGrade, slotIndex)

        for slotWindow in self.skillPageDict.values():
            if slotWindow.HasSlot(slotIndex):
                slotWindow.ActivateSlot(slotIndex)
                return

    def OnDeactivateSkill(self, slotIndex):

        skillGrade = player.GetSkillGrade(slotIndex)
        slotIndex = self.__GetRealSkillSlot(skillGrade, slotIndex)

        for slotWindow in self.skillPageDict.values():
            if slotWindow.HasSlot(slotIndex):
                slotWindow.DeactivateSlot(slotIndex)
                return

    def __ShowJobToolTip(self):
        self.toolTipJob.ShowToolTip()

    def __HideJobToolTip(self):
        self.toolTipJob.HideToolTip()

    def __SetJobText(self, mainJob, subJob):
        if player.GetStatus(player.LEVEL)<5:
            subJob=0

        if 949 == app.GetDefaultCodePage():
            self.toolTipJob.ClearToolTip()

            try:
                jobInfoTitle=localeInfo.JOBINFO_TITLE[mainJob][subJob]
                jobInfoData=localeInfo.JOBINFO_DATA_LIST[mainJob][subJob]
            except IndexError:
                print "uiCharacter.CharacterWindow.__SetJobText(mainJob=%d, subJob=%d)" % (mainJob, subJob)
                return

            self.toolTipJob.AutoAppendTextLine(jobInfoTitle)
            self.toolTipJob.AppendSpace(5)

            for jobInfoDataLine in jobInfoData:
                self.toolTipJob.AutoAppendTextLine(jobInfoDataLine)

            self.toolTipJob.AlignHorizonalCenter()

    def __ShowAlignmentToolTip(self):
        self.toolTipAlignment.ShowToolTip()

    def __HideAlignmentToolTip(self):
        self.toolTipAlignment.HideToolTip()

    def RefreshCharacter(self):

        if self.isLoaded==0:
            return

        ## Name
        try:
            characterName = player.GetName()
            guildName = player.GetGuildName()
            self.characterNameValue.SetText("|cffa07970"+characterName)
            if guildName == "":
                self.guildNameValue.SetText("|cffa07970Brak gildii")
            else:
                self.guildNameValue.SetText("|cffa07970"+guildName)
            self.guildNameSlot.Show()
        except:
            import exception
            exception.Abort("CharacterWindow.RefreshCharacter.BindObject")

        race = net.GetMainActorRace()
        group = net.GetMainActorSkillGroup()
        empire = net.GetMainActorEmpire()

        ## Job Text
        job = chr.RaceToJob(race)
        self.__SetJobText(job, group)

        ## FaceImage
        #try:
        #    faceImageName = FACE_IMAGE_DICT[race]

        #    try:
        #        self.faceImage.LoadImage(faceImageName)
        #    except:
        #        print "CharacterWindow.RefreshCharacter(race=%d, faceImageName=%s)" % (race, faceImageName)
        #        self.faceImage.Hide()

        #except KeyError:
        #    self.faceImage.Hide()

        ## GroupName
        self.__SetSkillGroupName(race, group)

        ## Skill
        if 0 == group:
            self.__SelectSkillGroup(0)

        else:
            self.__SetSkillSlotData(race, group, empire)

            if self.__CanUseHorseSkill():
                self.__SelectSkillGroup(0)

    def __SetSkillGroupName(self, race, group):

        job = chr.RaceToJob(race)

        if not self.SKILL_GROUP_NAME_DICT.has_key(job):
            return

        nameList = self.SKILL_GROUP_NAME_DICT[job]

        if 0 == group:
            self.skillGroupButton1.SetText(nameList[1])
            self.skillGroupButton2.SetText(nameList[2])
            self.skillGroupButton1.Show()
            self.skillGroupButton2.Show()
            self.activeSkillGroupName.Hide()

        else:

            if self.__CanUseHorseSkill():
                self.activeSkillGroupName.Hide()
                self.skillGroupButton1.SetText(nameList.get(group, "Noname"))
                self.skillGroupButton2.SetText(localeInfo.SKILL_GROUP_HORSE)
                self.skillGroupButton1.Show()
                self.skillGroupButton2.Show()

            else:
                self.activeSkillGroupName.SetText(nameList.get(group, "Noname"))
                self.activeSkillGroupName.Show()
                self.skillGroupButton1.Hide()
                self.skillGroupButton2.Hide()

    def __SetSkillSlotData(self, race, group, empire=0):

        ## SkillIndex
        playerSettingModule.RegisterSkill(race, group, empire)

        ## Event
        self.__SetSkillSlotEvent()

        ## Refresh
        self.RefreshSkill()

    def __SelectSkillGroup(self, index):
        for btn in self.skillGroupButton:
            btn.SetUp()
        self.skillGroupButton[index].Down()

        if self.__CanUseHorseSkill():
            if 0 == index:
                index = net.GetMainActorSkillGroup()-1
            elif 1 == index:
                index = self.PAGE_HORSE

        self.curSelectedSkillGroup = index
        self.__SetSkillSlotData(net.GetMainActorRace(), index+1, net.GetMainActorEmpire())

    def __CanUseSkillNow(self):
        if 0 == net.GetMainActorSkillGroup():
            return FALSE

        return TRUE

    def __CanUseHorseSkill(self):

        slotIndex = player.GetSkillSlotIndex(player.SKILL_INDEX_RIDING)

        if not slotIndex:
            return FALSE

        grade = player.GetSkillGrade(slotIndex)
        level = player.GetSkillLevel(slotIndex)
        if level < 0:
            level *= -1
        if grade >= 1 and level >= 1:
            return TRUE

        return FALSE

    def __IsChangedHorseRidingSkillLevel(self):
        ret = FALSE

        if -1 == self.canUseHorseSkill:
            self.canUseHorseSkill = self.__CanUseHorseSkill()

        if self.canUseHorseSkill != self.__CanUseHorseSkill():
            ret = TRUE

        self.canUseHorseSkill = self.__CanUseHorseSkill()
        return ret

    def __GetRealSkillSlot(self, skillGrade, skillSlot):
        return skillSlot + min(skill.SKILL_GRADE_COUNT-1, skillGrade)*skill.SKILL_GRADE_STEP_COUNT

    def __GetETCSkillRealSlotIndex(self, skillSlot):
        if skillSlot > 100:
            return skillSlot
        return skillSlot % self.ACTIVE_PAGE_SLOT_COUNT

    def __RealSkillSlotToSourceSlot(self, realSkillSlot):
        if realSkillSlot > 100:
            return realSkillSlot
        if self.PAGE_HORSE == self.curSelectedSkillGroup:
            return realSkillSlot + self.ACTIVE_PAGE_SLOT_COUNT
        return realSkillSlot % skill.SKILL_GRADE_STEP_COUNT

    def __GetSkillGradeFromSlot(self, skillSlot):
        return int(skillSlot / skill.SKILL_GRADE_STEP_COUNT)

    def SelectSkillGroup(self, index):
        self.__SelectSkillGroup(index)

    def OnQuestScroll(self):
        questCount = quest.GetQuestCount()
        scrollLineCount = max(0, questCount - quest.QUEST_MAX_NUM)
        startIndex = int(scrollLineCount * self.questScrollBar.GetPos())

        if startIndex != self.questShowingStartIndex:
            self.questShowingStartIndex = startIndex
            self.RefreshQuest()

class WaitingDialog(ui.ScriptWindow):
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.eventTimeOver = lambda *arg: None
        self.eventExit = lambda *arg: None

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

    def Open(self, waitTime):
        import time
        curTime = time.clock()
        self.endTime = curTime + waitTime

        self.Show()        

    def Close(self):
        self.Hide()

    def Destroy(self):
        self.Hide()

    def SAFE_SetTimeOverEvent(self, event):
        self.eventTimeOver = ui.__mem_func__(event)

    def SAFE_SetExitEvent(self, event):
        self.eventExit = ui.__mem_func__(event)
        
    def OnUpdate(self):
        import time
        lastTime = max(0, self.endTime - time.clock())
        if 0 == lastTime:
            self.Close()
            self.eventTimeOver()
        else:
            return
        
        
    def OnPressExitKey(self):
        self.Close()
        return TRUE
 

Se alguém tiver alguma noção do que possa ser, irei deixar o uicharater aqui.
Cumprimentos,

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...