Guest User

Untitled

a guest
Jul 14th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 66.26 KB | None | 0 0
  1. import ui
  2. import uiScriptLocale
  3. import app
  4. import net
  5. import dbg
  6. import snd
  7. import player
  8. import mouseModule
  9. import wndMgr
  10. import skill
  11. import uibonuss
  12. import playersettingmodule
  13. import quest
  14. import localeInfo
  15. import uiToolTip
  16. import constInfo
  17. import emotion
  18. import chr
  19. import grp
  20. #REDDEV_MULTI_BONUS_SHOWER
  21. import item
  22. import chat
  23. #ENDOF_REDDEV_MULTI_BONUS_SHOWER
  24. if app.ENABLE_QUEST_RENEWAL:
  25.     import math, uiQuest
  26.  
  27. SHOW_ONLY_ACTIVE_SKILL = False
  28. SHOW_LIMIT_SUPPORT_SKILL_LIST = []
  29. HIDE_SUPPORT_SKILL_POINT = False
  30.  
  31. if localeInfo.IsYMIR():
  32.     SHOW_LIMIT_SUPPORT_SKILL_LIST = [121, 122, 123, 124, 126, 127, 129, 128, 131, 137, 138, 139, 140,141,142]
  33.     if not localeInfo.IsCHEONMA():
  34.         HIDE_SUPPORT_SKILL_POINT = True
  35.         SHOW_LIMIT_SUPPORT_SKILL_LIST = [121, 122, 123, 124, 126, 127, 129, 128, 131, 137, 138, 139, 140,141,142]
  36. elif localeInfo.IsJAPAN() or   (localeInfo.IsEUROPE() and app.GetLocalePath() != "locale/ca") and (localeInfo.IsEUROPE() and app.GetLocalePath() != "locale/br"):
  37.     HIDE_SUPPORT_SKILL_POINT = True
  38.     SHOW_LIMIT_SUPPORT_SKILL_LIST = [121, 122, 123, 124, 126, 127, 129, 128, 131, 137, 138, 139, 140]
  39. else:
  40.     HIDE_SUPPORT_SKILL_POINT = True
  41.  
  42. FACE_IMAGE_DICT = {
  43.     playersettingmodule.RACE_WARRIOR_M  : "icon/face/warrior_m.tga",
  44.     playersettingmodule.RACE_WARRIOR_W  : "icon/face/warrior_w.tga",
  45.     playersettingmodule.RACE_ASSASSIN_M : "icon/face/assassin_m.tga",
  46.     playersettingmodule.RACE_ASSASSIN_W : "icon/face/assassin_w.tga",
  47.     playersettingmodule.RACE_SURA_M     : "icon/face/sura_m.tga",
  48.     playersettingmodule.RACE_SURA_W     : "icon/face/sura_w.tga",
  49.     playersettingmodule.RACE_SHAMAN_M   : "icon/face/shaman_m.tga",
  50.     playersettingmodule.RACE_SHAMAN_W   : "icon/face/shaman_w.tga",
  51. }
  52. # if app.ENABLE_WOLFMAN_CHARACTER:
  53.     # FACE_IMAGE_DICT.update({playersettingmodule.RACE_WOLFMAN_M  : "icon/face/wolfman_m.tga",})
  54.  
  55. if app.ENABLE_QUEST_RENEWAL:
  56.     quest_slot_listbar = {
  57.         "name" : "Quest_Slot",
  58.         "type" : "listbar",
  59.  
  60.         "x" : 0,
  61.         "y" : 0,
  62.  
  63.         "width" : 210,
  64.         "height" : 20,
  65.  
  66.         "text" : "Quest title",
  67.         "align" : "left",
  68.  
  69.         "horizontal_align" : "left",
  70.         "vertical_align" : "left",
  71.         "text_horizontal_align" : "left",
  72.         "all_align" : "left",
  73.  
  74.         "text_height": 40
  75.     }
  76.  
  77.     quest_lable_expend_img_path_dict = {
  78.         0: "d:/ymir work/ui/quest_re/tabcolor_1_main.tga",
  79.         1: "d:/ymir work/ui/quest_re/tabcolor_2_sub.tga",
  80.         2: "d:/ymir work/ui/quest_re/tabcolor_3_levelup.tga",
  81.         3: "d:/ymir work/ui/quest_re/tabcolor_4_event.tga",
  82.         4: "d:/ymir work/ui/quest_re/tabcolor_5_collection.tga",
  83.         5: "d:/ymir work/ui/quest_re/tabcolor_6_system.tga",
  84.         6: "d:/ymir work/ui/quest_re/tabcolor_7_scroll.tga",
  85.         7: "d:/ymir work/ui/quest_re/tabcolor_8_daily.tga"
  86.     }
  87.  
  88.     quest_label_dict = {
  89.         0 : localeInfo.QUEST_CATEGORY_00,
  90.         1 : localeInfo.QUEST_CATEGORY_01,
  91.         2 : localeInfo.QUEST_CATEGORY_02,
  92.         3 : localeInfo.QUEST_CATEGORY_03,
  93.         4 : localeInfo.QUEST_CATEGORY_04,
  94.         5 : localeInfo.QUEST_CATEGORY_05,
  95.         6 : localeInfo.QUEST_CATEGORY_06,
  96.         7 : localeInfo.QUEST_CATEGORY_07,
  97.     }
  98.  
  99. def unsigned32(n):
  100.     return n & 0xFFFFFFFFL
  101.  
  102. class CharacterWindow(ui.ScriptWindow):
  103.  
  104.     ACTIVE_PAGE_SLOT_COUNT = 8
  105.     SUPPORT_PAGE_SLOT_COUNT = 12
  106.  
  107.     PAGE_SLOT_COUNT = 12
  108.     PAGE_HORSE = 2
  109.  
  110.     SKILL_GROUP_NAME_DICT = {
  111.         playersettingmodule.JOB_WARRIOR : { 1 : localeInfo.SKILL_GROUP_WARRIOR_1,   2 : localeInfo.SKILL_GROUP_WARRIOR_2, },
  112.         playersettingmodule.JOB_ASSASSIN    : { 1 : localeInfo.SKILL_GROUP_ASSASSIN_1,  2 : localeInfo.SKILL_GROUP_ASSASSIN_2, },
  113.         playersettingmodule.JOB_SURA        : { 1 : localeInfo.SKILL_GROUP_SURA_1,      2 : localeInfo.SKILL_GROUP_SURA_2, },
  114.         playersettingmodule.JOB_SHAMAN      : { 1 : localeInfo.SKILL_GROUP_SHAMAN_1,    2 : localeInfo.SKILL_GROUP_SHAMAN_2, },
  115.     }
  116.     # if app.ENABLE_WOLFMAN_CHARACTER:
  117.         # SKILL_GROUP_NAME_DICT.update({playersettingmodule.JOB_WOLFMAN     : { 1 : localeInfo.JOB_WOLFMAN1,    2 : localeInfo.JOB_WOLFMAN2, },})
  118.  
  119.     STAT_DESCRIPTION =  {
  120.         "HTH" : localeInfo.STAT_TOOLTIP_CON,
  121.         "INT" : localeInfo.STAT_TOOLTIP_INT,
  122.         "STR" : localeInfo.STAT_TOOLTIP_STR,
  123.         "DEX" : localeInfo.STAT_TOOLTIP_DEX,
  124.     }
  125.  
  126.  
  127.     if app.ENABLE_QUEST_RENEWAL:
  128.         MAX_QUEST_PAGE_HEIGHT = 293.5
  129.  
  130.     STAT_MINUS_DESCRIPTION = localeInfo.STAT_MINUS_DESCRIPTION
  131.  
  132.     def __init__(self):
  133.         ui.ScriptWindow.__init__(self)
  134.         if app.ENABLE_QUEST_RENEWAL:
  135.             self.isQuestCategoryLoad = False
  136.         self.state = "STATUS"
  137.         self.isLoaded = 0
  138.         self.interface = None
  139.  
  140.         self.toolTipSkill = 0
  141.         self.lastUpdate3 = 0
  142.  
  143.         self.__Initialize()
  144.         self.__LoadWindow()
  145.  
  146.         self.statusPlusCommandDict={
  147.             "HTH" : "/stat ht",
  148.             "INT" : "/stat iq",
  149.             "STR" : "/stat st",
  150.             "DEX" : "/stat dx",
  151.         }
  152.  
  153.         self.statusMinusCommandDict={
  154.             "HTH-" : "/stat- ht",
  155.             "INT-" : "/stat- iq",
  156.             "STR-" : "/stat- st",
  157.             "DEX-" : "/stat- dx",
  158.         }
  159.  
  160.     def __del__(self):
  161.         ui.ScriptWindow.__del__(self)
  162.  
  163.     def __Initialize(self):
  164.         self.refreshToolTip = 0
  165.         self.curSelectedSkillGroup = 0
  166.         self.canUseHorseSkill = -1
  167.  
  168.         self.toolTip = None
  169.         self.toolTipJob = None
  170.         self.toolTipAlignment = None
  171.         self.toolTipSkill = None
  172.  
  173.         self.faceImage = None
  174.         self.statusPlusLabel = None
  175.         self.statusPlusValue = None
  176.         self.activeSlot = None
  177.         self.tabDict = None
  178.         self.tabButtonDict = None
  179.         self.pageDict = None
  180.         self.titleBarDict = None
  181.         self.statusPlusButtonDict = None
  182.         self.statusMinusButtonDict = None
  183.         self.uibonuss = None
  184.  
  185.         self.skillPageDict = None
  186.         if app.ENABLE_QUEST_RENEWAL:
  187.             self.questScrollBar = None
  188.             self.questLastScrollPosition = 0
  189.             self.questPage = None
  190.             self.questTitleBar = None
  191.             self.questSlotList = []
  192.             self.questCategory = {}
  193.             self.questCategoryList = []
  194.  
  195.             self.questColorList = {
  196.                 "green" : 0xFF83C055,
  197.                 "blue": 0xFF45678D,
  198.                 "golden": 0xFFCAB62F,
  199.                 "default_title": 0xFFCEC6B5
  200.             }
  201.  
  202.             self.questOpenedCategories = []
  203.             self.questMaxOpenedCategories = 1
  204.  
  205.             self.questClicked = []
  206.             self.questIndexMap = {}
  207.             self.questCounterList = []
  208.             self.questClockList = []
  209.             self.questSeparatorList = []
  210.  
  211.             self.displayY = 0
  212.             self.baseCutY = 0
  213.             self.questCategoryRenderPos = []
  214.  
  215.             self.questSlideWnd = {}
  216.             self.questSlideWndNewKey = 0
  217.         else:
  218.             self.questShowingStartIndex = 0
  219.             self.questScrollBar = None
  220.             self.questSlot = None
  221.             self.questNameList = None
  222.             self.questLastTimeList = None
  223.             self.questLastCountList = None
  224.         #REDDEV_NEW_QUEST_LISTING
  225.         self.actualQuestList = {}
  226.         self.additionalY = 0
  227.         self.countersList = []
  228.         self.timersList = []
  229.         self.markedQuests = []
  230.         #ENDOF_REDDEV_NEW_QUEST_LISTING
  231.         self.skillGroupButton = ()
  232.  
  233.         self.activeSlot = None
  234.         self.activeSkillPointValue = None
  235.         self.supportSkillPointValue = None
  236.         self.skillGroupButton1 = None
  237.         self.skillGroupButton2 = None
  238.         self.activeSkillGroupName = None
  239.  
  240.         self.guildNameSlot = None
  241.         self.guildNameValue = None
  242.         self.characterNameSlot = None
  243.         self.characterNameValue = None
  244.  
  245.         self.emotionToolTip = None
  246.         self.soloEmotionSlot = None
  247.         self.dualEmotionSlot = None
  248.        
  249.         self.boardWindow = None
  250.         #REDDEV_MULTIBONUS_SHOW
  251.         self.actualSubPage = 0
  252.         #ENDOF_REDDEV_MULTIBONUS
  253.  
  254.     def Show(self):
  255.         self.__LoadWindow()
  256.  
  257.         ui.ScriptWindow.Show(self)
  258.  
  259.     def __LoadScript(self, fileName):
  260.         pyScrLoader = ui.PythonScriptLoader()
  261.         pyScrLoader.LoadScriptFile(self, fileName)
  262.  
  263.     def __BindObject(self):
  264.         self.toolTip = uiToolTip.ToolTip()
  265.         self.toolTipJob = uiToolTip.ToolTip()
  266.         self.toolTipAlignment = uiToolTip.ToolTip(130)
  267.  
  268.         self.faceImage = self.GetChild("Face_Image")
  269.  
  270.         GetObject = self.GetChild
  271.         self.onBonusButton = self.GetChild("Bonus_Button_01")
  272.         self.onBonusButton.SAFE_SetEvent(self.__OnClickBonusButton)
  273.  
  274.         faceSlot=self.GetChild("Face_Slot")
  275.         if 949 == app.GetDefaultCodePage():
  276.             faceSlot.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowJobToolTip)
  277.             faceSlot.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideJobToolTip)
  278.  
  279.         self.statusPlusLabel = self.GetChild("Status_Plus_Label")
  280.         self.statusPlusValue = self.GetChild("Status_Plus_Value")
  281.  
  282.         self.characterNameSlot = self.GetChild("Character_Name_Slot")
  283.         self.characterNameValue = self.GetChild("Character_Name")
  284.         self.guildNameSlot = self.GetChild("Guild_Name_Slot")
  285.         self.guildNameValue = self.GetChild("Guild_Name")
  286.         self.characterNameSlot.SAFE_SetStringEvent("MOUSE_OVER_IN", self.__ShowAlignmentToolTip)
  287.         self.characterNameSlot.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideAlignmentToolTip)
  288.  
  289.         self.activeSlot = self.GetChild("Skill_Active_Slot")
  290.         self.activeSkillPointValue = self.GetChild("Active_Skill_Point_Value")
  291.         self.supportSkillPointValue = self.GetChild("Support_Skill_Point_Value")
  292.         self.skillGroupButton1 = self.GetChild("Skill_Group_Button_1")
  293.         self.skillGroupButton2 = self.GetChild("Skill_Group_Button_2")
  294.         self.activeSkillGroupName = self.GetChild("Active_Skill_Group_Name")
  295.  
  296.         if app.ENABLE_QUEST_RENEWAL:
  297.             self.questScrollBar = self.GetChild("Quest_ScrollBar")
  298.             self.questPage = self.GetChild("Quest_Page")
  299.             self.questTitleBar = self.GetChild("Quest_TitleBar")
  300.             self.quest_page_board_window = self.GetChild("quest_page_board_window")
  301.             self.quest_object_board_window = self.GetChild("quest_object_board_window")
  302.  
  303.         self.tabDict = {
  304.             "STATUS"    : self.GetChild("Tab_01"),
  305.             "SKILL"     : self.GetChild("Tab_02"),
  306.             "EMOTICON"  : self.GetChild("Tab_03"),
  307.             "QUEST"     : self.GetChild("Tab_04"),
  308.         }
  309.  
  310.         self.tabButtonDict = {
  311.             "STATUS"    : self.GetChild("Tab_Button_01"),
  312.             "SKILL"     : self.GetChild("Tab_Button_02"),
  313.             "EMOTICON"  : self.GetChild("Tab_Button_03"),
  314.             "QUEST"     : self.GetChild("Tab_Button_04")
  315.         }
  316.  
  317.         self.pageDict = {
  318.             "STATUS"    : self.GetChild("Character_Page"),
  319.             "SKILL"     : self.GetChild("Skill_Page"),
  320.             "EMOTICON"  : self.GetChild("Emoticon_Page"),
  321.             "QUEST"     : self.GetChild("Quest_Page")
  322.         }
  323.  
  324.         self.titleBarDict = {
  325.             "STATUS"    : self.GetChild("Character_TitleBar"),
  326.             "SKILL"     : self.GetChild("Skill_TitleBar"),
  327.             "EMOTICON"  : self.GetChild("Emoticon_TitleBar"),
  328.             "QUEST"     : self.GetChild("Quest_TitleBar")
  329.         }
  330.  
  331.         self.statusPlusButtonDict = {
  332.             "HTH"       : self.GetChild("HTH_Plus"),
  333.             "INT"       : self.GetChild("INT_Plus"),
  334.             "STR"       : self.GetChild("STR_Plus"),
  335.             "DEX"       : self.GetChild("DEX_Plus"),
  336.         }
  337.  
  338.         self.statusMinusButtonDict = {
  339.             "HTH-"      : self.GetChild("HTH_Minus"),
  340.             "INT-"      : self.GetChild("INT_Minus"),
  341.             "STR-"      : self.GetChild("STR_Minus"),
  342.             "DEX-"      : self.GetChild("DEX_Minus"),
  343.         }
  344.  
  345.         self.skillPageDict = {
  346.             "ACTIVE" : self.GetChild("Skill_Active_Slot"),
  347.             "SUPPORT" : self.GetChild("Skill_ETC_Slot"),
  348.             "HORSE" : self.GetChild("Skill_Active_Slot"),
  349.         }
  350.  
  351.         self.skillPageStatDict = {
  352.             "SUPPORT"   : player.SKILL_SUPPORT,
  353.             "ACTIVE"    : player.SKILL_ACTIVE,
  354.             "HORSE"     : player.SKILL_HORSE,
  355.         }
  356.  
  357.         self.skillGroupButton = (
  358.             self.GetChild("Skill_Group_Button_1"),
  359.             self.GetChild("Skill_Group_Button_2"),
  360.         )
  361.  
  362.  
  363.         global SHOW_ONLY_ACTIVE_SKILL
  364.         global HIDE_SUPPORT_SKILL_POINT
  365.         if SHOW_ONLY_ACTIVE_SKILL or HIDE_SUPPORT_SKILL_POINT:
  366.             self.GetChild("Support_Skill_Point_Label").Hide()
  367.  
  368.         self.soloEmotionSlot = self.GetChild("SoloEmotionSlot")
  369.         self.dualEmotionSlot = self.GetChild("DualEmotionSlot")
  370.         self.__SetEmotionSlot()
  371.  
  372.         if app.ENABLE_QUEST_RENEWAL:
  373.             self.questScrollBar.SetParent(self.quest_page_board_window)
  374.             for i in xrange(quest.QUEST_CATEGORY_MAX_NUM):
  375.                 self.questCategory = ui.SubTitleBar()
  376.                 self.questCategory.SetParent(self.questPage)
  377.                 self.questCategory.MakeSubTitleBar(210, "red")
  378.                 self.questCategory.SetText(quest_label_dict[i])
  379.                 self.questCategory.SetSize(210, 16)
  380.                 self.questCategory.SetPosition(13, 0)
  381.                 self.questCategoryList.append(self.questCategory)
  382.  
  383.                 self.questCategoryRenderPos.append(0)
  384.  
  385.             self.questScrollBar.SetParent(self.questPage)
  386.             self.RearrangeQuestCategories(xrange(quest.QUEST_CATEGORY_MAX_NUM))
  387.         else:
  388.             self.questShowingStartIndex = 0
  389.             self.questScrollBar = self.GetChild("Quest_ScrollBar")
  390.             self.questScrollBar.SetScrollEvent(ui.__mem_func__(self.OnQuestScroll))
  391.             self.questSlot = self.GetChild("Quest_Slot")
  392.             for i in xrange(quest.QUEST_MAX_NUM):
  393.                 self.questSlot.HideSlotBaseImage(i)
  394.                 self.questSlot.SetCoverButton(i,\
  395.                     "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  396.                     "d:/ymir work/ui/game/quest/slot_button_02.sub",\
  397.                     "d:/ymir work/ui/game/quest/slot_button_03.sub",\
  398.                     "d:/ymir work/ui/game/quest/slot_button_03.sub", True)
  399.  
  400.             self.questNameList = []
  401.             self.questLastTimeList = []
  402.             self.questLastCountList = []
  403.             for i in xrange(quest.QUEST_MAX_NUM):
  404.                 self.questNameList.append(self.GetChild("Quest_Name_0" + str(i)))
  405.                 self.questLastTimeList.append(self.GetChild("Quest_LastTime_0" + str(i)))
  406.                 self.questLastCountList.append(self.GetChild("Quest_LastCount_0" + str(i)))
  407.  
  408.         #REDDEV_MULTIBONUS
  409.         self.subPageText01 = ui.TextLine()
  410.         self.subPageText01.SetFontName(localeInfo.UI_DEF_FONT_BTN)
  411.         self.subPageText01.SetPackedFontColor(0xffffffff)
  412.         self.subPageText01.SetParent(self.GetChild("Status_Extent"))
  413.         self.subPageText01.SetPosition(11,35)
  414.        
  415.         self.subPageText02 = ui.TextLine()
  416.         self.subPageText02.SetFontName(localeInfo.UI_DEF_FONT_BTN)
  417.         self.subPageText02.SetPackedFontColor(0xffffffff)
  418.         self.subPageText02.SetParent(self.GetChild("Status_Extent"))
  419.         self.subPageText02.SetPosition(11,33+23+2)
  420.        
  421.         self.subPageText03 = ui.TextLine()
  422.         self.subPageText03.SetFontName(localeInfo.UI_DEF_FONT_BTN)
  423.         self.subPageText03.SetPackedFontColor(0xffffffff)
  424.         self.subPageText03.SetParent(self.GetChild("Status_Extent"))
  425.         self.subPageText03.SetPosition(11,33+46+2)
  426.        
  427.         self.subPageText04 = ui.TextLine()
  428.         self.subPageText04.SetFontName(localeInfo.UI_DEF_FONT_BTN)
  429.         self.subPageText04.SetPackedFontColor(0xffffffff)
  430.         self.subPageText04.SetParent(self.GetChild("Status_Extent"))
  431.         self.subPageText04.SetPosition(128,35)
  432.        
  433.         self.subPageText05 = ui.TextLine()
  434.         self.subPageText05.SetFontName(localeInfo.UI_DEF_FONT_BTN)
  435.         self.subPageText05.SetPackedFontColor(0xffffffff)
  436.         self.subPageText05.SetParent(self.GetChild("Status_Extent"))
  437.         self.subPageText05.SetPosition(128,33+23+2)
  438.        
  439.         self.subPageText06 = ui.TextLine()
  440.         self.subPageText06.SetFontName(localeInfo.UI_DEF_FONT_BTN)
  441.         self.subPageText06.SetPackedFontColor(0xffffffff)
  442.         self.subPageText06.SetParent(self.GetChild("Status_Extent"))
  443.         self.subPageText06.SetPosition(128,33+46+2)
  444.         #ENDOF_REDDEV_MULTI_BONUS_SHOWER
  445.  
  446.     def __SetSkillSlotEvent(self):
  447.         for skillPageValue in self.skillPageDict.itervalues():
  448.             skillPageValue.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  449.             skillPageValue.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectSkill))
  450.             skillPageValue.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  451.             skillPageValue.SetUnselectItemSlotEvent(ui.__mem_func__(self.ClickSkillSlot))
  452.             skillPageValue.SetUseSlotEvent(ui.__mem_func__(self.ClickSkillSlot))
  453.             skillPageValue.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  454.             skillPageValue.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  455.             skillPageValue.SetPressedSlotButtonEvent(ui.__mem_func__(self.OnPressedSlotButton))
  456.             skillPageValue.AppendSlotButton("d:/ymir work/ui/game/windows/btn_plus_up.sub",\
  457.                                             "d:/ymir work/ui/game/windows/btn_plus_over.sub",\
  458.                                             "d:/ymir work/ui/game/windows/btn_plus_down.sub")
  459.  
  460.     def __SetEmotionSlot(self):
  461.  
  462.         self.emotionToolTip = uiToolTip.ToolTip()
  463.  
  464.         for slot in (self.soloEmotionSlot, self.dualEmotionSlot):
  465.             slot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  466.             slot.SetSelectItemSlotEvent(ui.__mem_func__(self.__SelectEmotion))
  467.             slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.__ClickEmotionSlot))
  468.             slot.SetUseSlotEvent(ui.__mem_func__(self.__ClickEmotionSlot))
  469.             slot.SetOverInItemEvent(ui.__mem_func__(self.__OverInEmotion))
  470.             slot.SetOverOutItemEvent(ui.__mem_func__(self.__OverOutEmotion))
  471.             slot.AppendSlotButton("d:/ymir work/ui/game/windows/btn_plus_up.sub",\
  472.                                             "d:/ymir work/ui/game/windows/btn_plus_over.sub",\
  473.                                             "d:/ymir work/ui/game/windows/btn_plus_down.sub")
  474.  
  475.         for slotIdx, datadict in emotion.EMOTION_DICT.items():
  476.             emotionIdx = slotIdx
  477.  
  478.             slot = self.soloEmotionSlot
  479.             if slotIdx > 50:
  480.                 slot = self.dualEmotionSlot
  481.  
  482.             slot.SetEmotionSlot(slotIdx, emotionIdx)
  483.             slot.SetCoverButton(slotIdx)
  484.  
  485.     def __SelectEmotion(self, slotIndex):
  486.         if not slotIndex in emotion.EMOTION_DICT:
  487.             return
  488.  
  489.         if app.IsPressed(app.DIK_LCONTROL):
  490.             player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_EMOTION, slotIndex)
  491.             return
  492.  
  493.         mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_EMOTION, slotIndex, slotIndex)
  494.  
  495.     def __ClickEmotionSlot(self, slotIndex):
  496.         print "click emotion"
  497.         if not slotIndex in emotion.EMOTION_DICT:
  498.             return
  499.  
  500.         print "check acting"
  501.         if player.IsActingEmotion():
  502.             return
  503.        
  504.         command = emotion.EMOTION_DICT[slotIndex]["command"]
  505.         print "command", command
  506.         if self.lastUpdate3 < app.GetGlobalTime():
  507.             self.lastUpdate3=app.GetGlobalTime()+5000 # 5 secunde  
  508.             if slotIndex > 50:
  509.                 vid = player.GetTargetVID()
  510.    
  511.                 if 0 == vid or vid == player.GetMainCharacterIndex() or chr.IsNPC(vid) or chr.IsEnemy(vid):
  512.                     import chat
  513.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.EMOTION_CHOOSE_ONE)
  514.                     return
  515.    
  516.                 command += " " + chr.GetNameByVID(vid)
  517.    
  518.             print "send_command", command
  519.             net.SendChatPacket(command)
  520.             import chat
  521.             chat.AppendChat(chat.CHAT_TYPE_INFO, "Asteapta 5 secunde pentru a folosi emotia din nou.")
  522.  
  523.     def ActEmotion(self, emotionIndex):
  524.         self.__ClickEmotionSlot(emotionIndex)
  525.  
  526.     def __OverInEmotion(self, slotIndex):
  527.         if self.emotionToolTip:
  528.  
  529.             if not slotIndex in emotion.EMOTION_DICT:
  530.                 return
  531.  
  532.             self.emotionToolTip.ClearToolTip()
  533.             self.emotionToolTip.SetTitle(emotion.EMOTION_DICT[slotIndex]["name"])
  534.             self.emotionToolTip.AlignHorizonalCenter()
  535.             self.emotionToolTip.ShowToolTip()
  536.  
  537.     def __OverOutEmotion(self):
  538.         if self.emotionToolTip:
  539.             self.emotionToolTip.HideToolTip()
  540.  
  541.     def __BindEvent(self):
  542.         for i in xrange(len(self.skillGroupButton)):
  543.             self.skillGroupButton[i].SetEvent(lambda arg=i: self.__SelectSkillGroup(arg))
  544.  
  545.         self.RefreshQuest()
  546.         self.__HideJobToolTip()
  547.  
  548.         for (tabKey, tabButton) in self.tabButtonDict.items():
  549.             tabButton.SetEvent(ui.__mem_func__(self.__OnClickTabButton), tabKey)
  550.  
  551.         for (statusPlusKey, statusPlusButton) in self.statusPlusButtonDict.items():
  552.             statusPlusButton.SAFE_SetEvent(self.__OnClickStatusPlusButton, statusPlusKey)
  553.             statusPlusButton.ShowToolTip = lambda arg=statusPlusKey: self.__OverInStatButton(arg)
  554.             statusPlusButton.HideToolTip = lambda arg=statusPlusKey: self.__OverOutStatButton()
  555.  
  556.         for (statusMinusKey, statusMinusButton) in self.statusMinusButtonDict.items():
  557.             statusMinusButton.SAFE_SetEvent(self.__OnClickStatusMinusButton, statusMinusKey)
  558.             statusMinusButton.ShowToolTip = lambda arg=statusMinusKey: self.__OverInStatMinusButton(arg)
  559.             statusMinusButton.HideToolTip = lambda arg=statusMinusKey: self.__OverOutStatMinusButton()
  560.  
  561.         for titleBarValue in self.titleBarDict.itervalues():
  562.             titleBarValue.SetCloseEvent(ui.__mem_func__(self.Hide))
  563.  
  564.         #REDDEV_NEW_QUEST_LISTING
  565.         if app.ENABLE_QUEST_RENEWAL:
  566.             self.questTitleBar.SetCloseEvent(ui.__mem_func__(self.Close))
  567.             self.questScrollBar.SetScrollEvent(ui.__mem_func__(self.__OnScrollQuest))
  568.  
  569.             for i in xrange(quest.QUEST_CATEGORY_MAX_NUM):
  570.                 self.questCategoryList[i].SetEvent(ui.__mem_func__(self.__OnClickQuestCategoryButton), i)
  571.         else:
  572.             self.questSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.__SelectQuest))
  573.         #ENDOF_REDDEV_NEW_QUEST_LISTING
  574.        
  575.         #REDDEV_MULTI_BONUS_SHOWER
  576.         for i in xrange(5):
  577.             self.GetChild("SubPage"+str(i)).SetEvent(ui.__mem_func__(self.switchSubPage), i)
  578.        
  579.     def switchSubPage(self, num):
  580.         for i in xrange(5):
  581.             if i!=num:
  582.                 self.GetChild("SubPage"+str(i)).SetUp()
  583.         if num==0:
  584.             self.GetChild("Status_Extent_ItemList1").Show()
  585.             self.GetChild("Status_Extent_ItemList2").Show()
  586.             self.subPageText01.Hide()
  587.             self.subPageText02.Hide()
  588.             self.subPageText03.Hide()
  589.             self.subPageText04.Hide()
  590.             self.subPageText05.Hide()
  591.             self.subPageText06.Hide()
  592.         elif num==1:       
  593.             self.GetChild("Status_Extent_ItemList1").Hide()
  594.             self.GetChild("Status_Extent_ItemList2").Hide()
  595.             self.subPageText01.SetText("Ap. sabie:")
  596.             self.subPageText01.Show()
  597.             self.subPageText02.SetText("Ap. 2maini:")
  598.             self.subPageText02.Show()
  599.             self.subPageText03.SetText("Ap. pumnal:")
  600.             self.subPageText03.Show()
  601.             self.subPageText04.SetText("Ap. sageti:")
  602.             self.subPageText04.Show()
  603.             self.subPageText05.SetText("Ap. evantai:")
  604.             self.subPageText05.Show()
  605.             self.subPageText06.SetText("Rez. magie:")
  606.             self.subPageText06.Show()
  607.         elif num==2:
  608.             self.GetChild("Status_Extent_ItemList1").Hide()
  609.             self.GetChild("Status_Extent_ItemList2").Hide()
  610.             self.subPageText01.SetText("Vs. semi-om:")
  611.             self.subPageText01.Show()
  612.             self.subPageText02.SetText("Critica:")
  613.             self.subPageText02.Show()
  614.             self.subPageText03.SetText("Patrundere:")
  615.             self.subPageText03.Show()
  616.             self.subPageText04.SetText("Vs. monstrii:")
  617.             self.subPageText04.Show()
  618.             self.subPageText05.SetText("Naucire:")
  619.             self.subPageText05.Show()
  620.             self.subPageText06.SetText("Otravire:")
  621.             self.subPageText06.Show()
  622.        
  623.         elif num==3:
  624.             self.GetChild("Status_Extent_ItemList1").Hide()
  625.             self.GetChild("Status_Extent_ItemList2").Hide()
  626.             self.subPageText01.SetText("Anti razb:")
  627.             self.subPageText01.Show()
  628.             self.subPageText02.SetText("Anti ninja:")
  629.             self.subPageText02.Show()
  630.             self.subPageText03.SetText("Anti sura:")
  631.             self.subPageText03.Show()
  632.             self.subPageText04.SetText("Anti saman:")
  633.             self.subPageText04.Show()
  634.             self.subPageText05.SetText("Absorb. PV:")
  635.             self.subPageText05.Show()
  636.             self.subPageText06.SetText("Absorb. PM:")
  637.             self.subPageText06.Show()
  638.        
  639.         elif num==4:
  640.             self.GetChild("Status_Extent_ItemList1").Hide()
  641.             self.GetChild("Status_Extent_ItemList2").Hide()
  642.             self.subPageText01.SetText("Rez. razb:")
  643.             self.subPageText01.Show()
  644.             self.subPageText02.SetText("Rez. ninja:")
  645.             self.subPageText02.Show()
  646.             self.subPageText03.SetText("Rez. sura:")
  647.             self.subPageText03.Show()
  648.             self.subPageText04.SetText("Rez. saman:")
  649.             self.subPageText04.Show()
  650.             self.subPageText05.SetText("Blocare:")
  651.             self.subPageText05.Show()
  652.             self.subPageText06.SetText("Medie:")
  653.             self.subPageText06.Show()
  654.        
  655.         if num < 0 or num > 4:
  656.             num = 0
  657.         self.actualSubPage = num
  658.         self.RefreshStatus()
  659.     #ENDOF_REDDEV_MULTI_BONUS_SHOWER
  660.  
  661.     def __LoadWindow(self):
  662.         if self.isLoaded == 1:
  663.             return
  664.  
  665.         self.isLoaded = 1
  666.  
  667.         try:
  668.             if localeInfo.IsARABIC() or localeInfo.IsVIETNAM() or localeInfo.IsJAPAN():
  669.                 self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "CharacterWindow.py")
  670.             else:
  671.                 self.__LoadScript("UIScript/CharacterWindow.py")
  672.  
  673.             self.__BindObject()
  674.             self.__BindEvent()
  675.         except:
  676.             import exception
  677.             exception.Abort("CharacterWindow.__LoadWindow")
  678.  
  679.         #self.tabButtonDict["EMOTICON"].Disable()
  680.         self.SetState("STATUS")
  681.  
  682.     def Destroy(self):
  683.         self.ClearDictionary()
  684.  
  685.         self.__Initialize()
  686.  
  687.     def __OnClickBonusButton(self):
  688.         if not self.uibonuss:
  689.             self.uibonuss = uibonuss.OptionDialog()
  690.  
  691.         self.uibonuss.Show()
  692.  
  693.     def Close(self):
  694.         if 0 != self.toolTipSkill:
  695.             self.toolTipSkill.Hide()
  696.  
  697.         if app.ENABLE_QUEST_RENEWAL:
  698.             if self.questSlideWndNewKey > 0:
  699.                 if self.questSlideWnd[self.questSlideWndNewKey-1] is not None:
  700.                     self.questSlideWnd[self.questSlideWndNewKey-1].CloseSelf()
  701.  
  702.         self.Hide()
  703.  
  704.     def SetSkillToolTip(self, toolTipSkill):
  705.         self.toolTipSkill = toolTipSkill
  706.  
  707.     def __OnClickStatusPlusButton(self, statusKey):
  708.         try:
  709.             statusPlusCommand=self.statusPlusCommandDict[statusKey]
  710.             net.SendChatPacket(statusPlusCommand)
  711.         except KeyError, msg:
  712.             dbg.TraceError("CharacterWindow.__OnClickStatusPlusButton KeyError: %s", msg)
  713.  
  714.     def __OnClickStatusMinusButton(self, statusKey):
  715.         try:
  716.             statusMinusCommand=self.statusMinusCommandDict[statusKey]
  717.             net.SendChatPacket(statusMinusCommand)
  718.         except KeyError, msg:
  719.             dbg.TraceError("CharacterWindow.__OnClickStatusMinusButton KeyError: %s", msg)
  720.  
  721.  
  722.     def __OnClickTabButton(self, stateKey):
  723.         self.SetState(stateKey)
  724.  
  725.     def SetState(self, stateKey):
  726.        
  727.         self.state = stateKey
  728.  
  729.         if app.ENABLE_QUEST_RENEWAL:
  730.             if stateKey != "QUEST":
  731.                 self.questPage.Hide()
  732.                 if self.questSlideWndNewKey > 0:
  733.                     if self.questSlideWnd[self.questSlideWndNewKey-1] is not None:
  734.                         self.questSlideWnd[self.questSlideWndNewKey-1].CloseSelf()
  735.             else:
  736.                 self.__LoadQuestCategory()
  737.  
  738.         for (tabKey, tabButton) in self.tabButtonDict.items():
  739.             if stateKey!=tabKey:
  740.                 tabButton.SetUp()
  741.  
  742.         for tabValue in self.tabDict.itervalues():
  743.             tabValue.Hide()
  744.  
  745.         for pageValue in self.pageDict.itervalues():
  746.             pageValue.Hide()
  747.  
  748.         for titleBarValue in self.titleBarDict.itervalues():
  749.             titleBarValue.Hide()
  750.  
  751.         self.titleBarDict[stateKey].Show()
  752.         self.tabDict[stateKey].Show()
  753.         self.pageDict[stateKey].Show()
  754.        
  755.         #REDDEV_NEW_QUEST_LISTING
  756.         if stateKey == 'QUEST':
  757.             self.RefreshQuest()
  758.         #ENDOF_REDDEV_NEW_QUEST_LISTING
  759.        
  760.  
  761.     def GetState(self):
  762.         return self.state
  763.  
  764.     def __GetTotalAtkText(self):
  765.         minAtk=player.GetStatus(player.ATT_MIN)
  766.         maxAtk=player.GetStatus(player.ATT_MAX)
  767.         atkBonus=player.GetStatus(player.ATT_BONUS)
  768.         attackerBonus=player.GetStatus(player.ATTACKER_BONUS)
  769.  
  770.         if minAtk==maxAtk:
  771.             return "%d" % (minAtk+atkBonus+attackerBonus)
  772.         else:
  773.             return "%d-%d" % (minAtk+atkBonus+attackerBonus, maxAtk+atkBonus+attackerBonus)
  774.  
  775.     def __GetTotalMagAtkText(self):
  776.         minMagAtk=player.GetStatus(player.MAG_ATT)+player.GetStatus(player.MIN_MAGIC_WEP)
  777.         maxMagAtk=player.GetStatus(player.MAG_ATT)+player.GetStatus(player.MAX_MAGIC_WEP)
  778.  
  779.         if minMagAtk==maxMagAtk:
  780.             return "%d" % (minMagAtk)
  781.         else:
  782.             return "%d-%d" % (minMagAtk, maxMagAtk)
  783.  
  784.     def __GetTotalDefText(self):
  785.         defValue=player.GetStatus(player.DEF_GRADE)
  786.         if constInfo.ADD_DEF_BONUS_ENABLE:
  787.             defValue+=player.GetStatus(player.DEF_BONUS)
  788.         return "%d" % (defValue)
  789.  
  790.     def RefreshStatus(self):
  791.         if self.isLoaded==0:
  792.             return
  793.  
  794.         try:
  795.             self.GetChild("Level_Value").SetText(str(player.GetStatus(player.LEVEL)))
  796.             self.GetChild("Exp_Value").SetText(str(unsigned32(player.GetEXP())))
  797.             self.GetChild("RestExp_Value").SetText(str(unsigned32(player.GetStatus(player.NEXT_EXP)) - unsigned32(player.GetStatus(player.EXP))))
  798.             self.GetChild("HP_Value").SetText(str(player.GetStatus(player.HP)) + '/' + str(player.GetStatus(player.MAX_HP)))
  799.             self.GetChild("SP_Value").SetText(str(player.GetStatus(player.SP)) + '/' + str(player.GetStatus(player.MAX_SP)))
  800.  
  801.             self.GetChild("STR_Value").SetText(str(player.GetStatus(player.ST)))
  802.             self.GetChild("DEX_Value").SetText(str(player.GetStatus(player.DX)))
  803.             self.GetChild("HTH_Value").SetText(str(player.GetStatus(player.HT)))
  804.             self.GetChild("INT_Value").SetText(str(player.GetStatus(player.IQ)))
  805.  
  806.             self.GetChild("ATT_Value").SetText(self.__GetTotalAtkText())
  807.             self.GetChild("DEF_Value").SetText(self.__GetTotalDefText())
  808.            
  809.             #REDDEV_MULTI_BONUS_SHOWER
  810.             #self.GetChild("MATT_Value").SetText(self.__GetTotalMagAtkText())
  811.             #self.GetChild("MATT_Value").SetText(str(player.GetStatus(player.MAG_ATT)))
  812.  
  813.             #self.GetChild("MDEF_Value").SetText(str(player.GetStatus(player.MAG_DEF)))
  814.             #self.GetChild("ASPD_Value").SetText(str(player.GetStatus(player.ATT_SPEED)))
  815.             #self.GetChild("MSPD_Value").SetText(str(player.GetStatus(player.MOVING_SPEED)))
  816.             #self.GetChild("CSPD_Value").SetText(str(player.GetStatus(player.CASTING_SPEED)))
  817.             #self.GetChild("ER_Value").SetText(str(player.GetStatus(player.EVADE_RATE)))
  818.            
  819.             if self.actualSubPage == 0:
  820.                 self.GetChild("MATT_Value").SetText(self.__GetTotalMagAtkText())
  821.                 self.GetChild("MDEF_Value").SetText(str(player.GetStatus(player.MAG_DEF)))
  822.                 self.GetChild("ASPD_Value").SetText(str(player.GetStatus(player.ATT_SPEED)))
  823.                 self.GetChild("MSPD_Value").SetText(str(player.GetStatus(player.MOVING_SPEED)))
  824.                 self.GetChild("CSPD_Value").SetText(str(player.GetStatus(player.CASTING_SPEED)))
  825.                 self.GetChild("ER_Value").SetText(str(player.GetStatus(player.EVADE_RATE)))
  826.             elif self.actualSubPage == 1:
  827.                 self.GetChild("MSPD_Value").SetText(str(player.GetStatus(69)) + str("%")) #Resist sword
  828.                 self.GetChild("ASPD_Value").SetText(str(player.GetStatus(70)) + str("%")) #Resist 2hand
  829.                 self.GetChild("CSPD_Value").SetText(str(player.GetStatus(71)) + str("%")) #Resist dagger
  830.                 self.GetChild("MATT_Value").SetText(str(player.GetStatus(74)) + str("%")) #Resist bow
  831.                 self.GetChild("MDEF_Value").SetText(str(player.GetStatus(73)) + str("%")) #Resist fan
  832.                 self.GetChild("ER_Value").SetText(str(player.GetStatus(77)) + str("%")) #Resist magic
  833.             elif self.actualSubPage == 2:
  834.                 self.GetChild("MSPD_Value").SetText(str(player.GetStatus(43)) + str("%")) #Anti semi-om
  835.                 self.GetChild("ASPD_Value").SetText(str(player.GetStatus(40)) + str("%")) #Critical chance
  836.                 self.GetChild("CSPD_Value").SetText(str(player.GetStatus(41)) + str("%")) #Penetrate chance
  837.                 self.GetChild("MATT_Value").SetText(str(player.GetStatus(53)) + str("%")) #Anti mobs
  838.                 self.GetChild("MDEF_Value").SetText(str(player.GetStatus(38)) + str("%")) #Stun chance
  839.                 self.GetChild("ER_Value").SetText(str(player.GetStatus(37)) + str("%")) #Poison chance
  840.            
  841.             elif self.actualSubPage == 3:
  842.                 self.GetChild("MSPD_Value").SetText(str(player.GetStatus(54)) + str("%")) #Anti Warrior
  843.                 self.GetChild("ASPD_Value").SetText(str(player.GetStatus(55)) + str("%")) #Anti Ninja
  844.                 self.GetChild("CSPD_Value").SetText(str(player.GetStatus(56)) + str("%")) #Anti sura
  845.                 self.GetChild("MATT_Value").SetText(str(player.GetStatus(57)) + str("%")) #Anti shaman
  846.                 self.GetChild("MDEF_Value").SetText(str(player.GetStatus(63)) + str("%")) #HP Steal
  847.                 self.GetChild("ER_Value").SetText(str(player.GetStatus(64)) + str("%")) #SP Steal
  848.                
  849.             elif self.actualSubPage == 4:
  850.                 self.GetChild("MSPD_Value").SetText(str(player.GetStatus(59)) + str("%")) #Res warrior
  851.                 self.GetChild("ASPD_Value").SetText(str(player.GetStatus(60)) + str("%")) #res Ninja
  852.                 self.GetChild("CSPD_Value").SetText(str(player.GetStatus(61)) + str("%")) #res sura
  853.                 self.GetChild("MATT_Value").SetText(str(player.GetStatus(62)) + str("%")) #res shaman
  854.                 self.GetChild("MDEF_Value").SetText(str(player.GetStatus(67)) + str("%")) #Block
  855.                 self.GetChild("ER_Value").SetText(str(player.GetStatus(72)) + str("%")) #Paguba Medie
  856.             else:
  857.                 pass
  858.             #ENDOF_REDDEV_MULTI_BONUS_SHOWER
  859.  
  860.         except:
  861.             #import exception
  862.             #exception.Abort("CharacterWindow.RefreshStatus.BindObject")
  863.             ## °ÔÀÓÀÌ Æ¨°Ü ¹ö¸²
  864.             pass
  865.  
  866.         self.__RefreshStatusPlusButtonList()
  867.         self.__RefreshStatusMinusButtonList()
  868.         self.RefreshAlignment()
  869.  
  870.         if self.refreshToolTip:
  871.             self.refreshToolTip()
  872.  
  873.     def __RefreshStatusPlusButtonList(self):
  874.         if self.isLoaded==0:
  875.             return
  876.  
  877.         statusPlusPoint=player.GetStatus(player.STAT)
  878.  
  879.         if statusPlusPoint>0:
  880.             self.statusPlusValue.SetText(str(statusPlusPoint))
  881.             self.statusPlusLabel.Show()
  882.             self.ShowStatusPlusButtonList()
  883.         else:
  884.             self.statusPlusValue.SetText(str(0))
  885.             self.statusPlusLabel.Hide()
  886.             self.HideStatusPlusButtonList()
  887.  
  888.     def __RefreshStatusMinusButtonList(self):
  889.         if self.isLoaded==0:
  890.             return
  891.  
  892.         statusMinusPoint=self.__GetStatMinusPoint()
  893.  
  894.         if statusMinusPoint>0:
  895.             self.__ShowStatusMinusButtonList()
  896.         else:
  897.             self.__HideStatusMinusButtonList()
  898.  
  899.     def RefreshAlignment(self):
  900.         point, grade = player.GetAlignmentData()
  901.  
  902.         import colorInfo
  903.         COLOR_DICT = {  0 : colorInfo.TITLE_RGB_GOOD_4,
  904.                         1 : colorInfo.TITLE_RGB_GOOD_3,
  905.                         2 : colorInfo.TITLE_RGB_GOOD_2,
  906.                         3 : colorInfo.TITLE_RGB_GOOD_1,
  907.                         4 : colorInfo.TITLE_RGB_NORMAL,
  908.                         5 : colorInfo.TITLE_RGB_EVIL_1,
  909.                         6 : colorInfo.TITLE_RGB_EVIL_2,
  910.                         7 : colorInfo.TITLE_RGB_EVIL_3,
  911.                         8 : colorInfo.TITLE_RGB_EVIL_4, }
  912.         colorList = COLOR_DICT.get(grade, colorInfo.TITLE_RGB_NORMAL)
  913.         gradeColor = ui.GenerateColor(colorList[0], colorList[1], colorList[2])
  914.  
  915.         self.toolTipAlignment.ClearToolTip()
  916.         self.toolTipAlignment.AutoAppendTextLine(localeInfo.TITLE_NAME_LIST[grade], gradeColor)
  917.         self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGNMENT_NAME + str(point))
  918.         self.toolTipAlignment.AlignHorizonalCenter()
  919.            
  920.  
  921.     def __ShowStatusMinusButtonList(self):
  922.         for (stateMinusKey, statusMinusButton) in self.statusMinusButtonDict.items():
  923.             statusMinusButton.Show()
  924.  
  925.     def __HideStatusMinusButtonList(self):
  926.         for (stateMinusKey, statusMinusButton) in self.statusMinusButtonDict.items():
  927.             statusMinusButton.Hide()
  928.  
  929.     def ShowStatusPlusButtonList(self):
  930.         for (statePlusKey, statusPlusButton) in self.statusPlusButtonDict.items():
  931.             statusPlusButton.Show()
  932.  
  933.     def HideStatusPlusButtonList(self):
  934.         for (statePlusKey, statusPlusButton) in self.statusPlusButtonDict.items():
  935.             statusPlusButton.Hide()
  936.  
  937.     def SelectSkill(self, skillSlotIndex):
  938.  
  939.         mouseController = mouseModule.mouseController
  940.  
  941.         if False == mouseController.isAttached():
  942.  
  943.             srcSlotIndex = self.__RealSkillSlotToSourceSlot(skillSlotIndex)
  944.             selectedSkillIndex = player.GetSkillIndex(srcSlotIndex)
  945.  
  946.             if skill.CanUseSkill(selectedSkillIndex):
  947.  
  948.                 if app.IsPressed(app.DIK_LCONTROL):
  949.  
  950.                     player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_SKILL, srcSlotIndex)
  951.                     return
  952.  
  953.                 mouseController.AttachObject(self, player.SLOT_TYPE_SKILL, srcSlotIndex, selectedSkillIndex)
  954.  
  955.         else:
  956.  
  957.             mouseController.DeattachObject()
  958.  
  959.     def SelectEmptySlot(self, SlotIndex):
  960.         mouseModule.mouseController.DeattachObject()
  961.  
  962.     ## ToolTip
  963.     def OverInItem(self, slotNumber):
  964.         if mouseModule.mouseController.isAttached():
  965.             return
  966.  
  967.         if 0 == self.toolTipSkill:
  968.             return
  969.  
  970.         srcSlotIndex = self.__RealSkillSlotToSourceSlot(slotNumber)
  971.         skillIndex = player.GetSkillIndex(srcSlotIndex)
  972.         skillLevel = player.GetSkillLevel(srcSlotIndex)
  973.         skillGrade = player.GetSkillGrade(srcSlotIndex)
  974.         skillType = skill.GetSkillType(skillIndex)
  975.  
  976.         ## ACTIVE
  977.         if skill.SKILL_TYPE_ACTIVE == skillType:
  978.             overInSkillGrade = self.__GetSkillGradeFromSlot(slotNumber)
  979.  
  980.             if overInSkillGrade == skill.SKILL_GRADE_COUNT-1 and skillGrade == skill.SKILL_GRADE_COUNT:
  981.                 self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, skillGrade, skillLevel)
  982.             elif overInSkillGrade == skillGrade:
  983.                 if app.ENABLE_SKILLS_LEVEL_OVER_P and skillGrade == 2:
  984.                     self.toolTipSkill.SetSkillOnlyName(srcSlotIndex, skillIndex, overInSkillGrade + 1)
  985.                 else:
  986.                     self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, overInSkillGrade, skillLevel)
  987.             elif app.ENABLE_SKILLS_LEVEL_OVER_P and overInSkillGrade == skill.SKILL_GRADE_COUNT-2 and skillGrade >= skill.SKILL_GRADE_COUNT-1:
  988.                 self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, skillGrade, skillLevel)
  989.             else:
  990.                 if app.ENABLE_SKILLS_LEVEL_OVER_P and overInSkillGrade == 1 and skillGrade == 2:
  991.                     self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, overInSkillGrade + 1, skillLevel)
  992.                 elif app.ENABLE_SKILLS_LEVEL_OVER_P and overInSkillGrade == 2 and skillGrade < 3:
  993.                     self.toolTipSkill.SetSkillOnlyName(srcSlotIndex, skillIndex, overInSkillGrade + 1)
  994.                 else:
  995.                     self.toolTipSkill.SetSkillOnlyName(srcSlotIndex, skillIndex, overInSkillGrade)
  996.         else:
  997.             self.toolTipSkill.SetSkillNew(srcSlotIndex, skillIndex, skillGrade, skillLevel)
  998.  
  999.     def OverOutItem(self):
  1000.         if 0 != self.toolTipSkill:
  1001.             self.toolTipSkill.HideToolTip()
  1002.  
  1003.     ## Quest
  1004.     def __SelectQuest(self, slotIndex):
  1005.         if app.ENABLE_QUEST_RENEWAL:
  1006.             questIndex = self.questIndexMap[slotIndex]
  1007.  
  1008.             if not questIndex in self.questClicked:
  1009.                 self.questClicked.append(questIndex)
  1010.         else:
  1011.             questIndex = quest.GetQuestIndex(self.questShowingStartIndex + slotIndex)
  1012.  
  1013.         #REDDEV_NEW_QUEST_LISTING
  1014.         if not questIndex in self.markedQuests:
  1015.             self.markedQuests.append(questIndex)
  1016.  
  1017.         import event
  1018.         #event.QuestButtonClick(-2147483648 + questIndex)
  1019.         event.QuestButtonClick(questIndex)
  1020.         #ENDOF_REDDEV_NEW_QUEST_LISTING
  1021.  
  1022.     ''' REDDEV_NEW_QUEST_LISTING
  1023.     def RefreshQuest(self):
  1024.  
  1025.         if self.isLoaded==0:
  1026.             return
  1027.  
  1028.         questCount = quest.GetQuestCount()
  1029.         questRange = range(quest.QUEST_MAX_NUM)
  1030.  
  1031.         if questCount > quest.QUEST_MAX_NUM:
  1032.             self.questScrollBar.Show()
  1033.         else:
  1034.             self.questScrollBar.Hide()
  1035.  
  1036.         for i in questRange[:questCount]:
  1037.             (questName, questIcon, questCounterName, questCounterValue) = quest.GetQuestData(self.questShowingStartIndex+i)
  1038.  
  1039.             self.questNameList[i].SetText(questName)
  1040.             self.questNameList[i].Show()
  1041.             self.questLastCountList[i].Show()
  1042.             self.questLastTimeList[i].Show()
  1043.  
  1044.             if len(questCounterName) > 0:
  1045.                 self.questLastCountList[i].SetText("%s : %d" % (questCounterName, questCounterValue))
  1046.             else:
  1047.                 self.questLastCountList[i].SetText("")
  1048.  
  1049.             ## Icon
  1050.             self.questSlot.SetSlot(i, i, 1, 1, questIcon)
  1051.  
  1052.         for i in questRange[questCount:]:
  1053.             self.questNameList[i].Hide()
  1054.             self.questLastTimeList[i].Hide()
  1055.             self.questLastCountList[i].Hide()
  1056.             self.questSlot.ClearSlot(i)
  1057.             self.questSlot.HideSlotBaseImage(i)
  1058.  
  1059.         self.__UpdateQuestClock()
  1060.  
  1061.     def __UpdateQuestClock(self):
  1062.         if "QUEST" == self.state:
  1063.             # QUEST_LIMIT_COUNT_BUG_FIX
  1064.             for i in xrange(min(quest.GetQuestCount(), quest.QUEST_MAX_NUM)):
  1065.             # END_OF_QUEST_LIMIT_COUNT_BUG_FIX
  1066.                 (lastName, lastTime) = quest.GetQuestLastTime(i)
  1067.  
  1068.                 clockText = localeInfo.QUEST_UNLIMITED_TIME
  1069.                 if len(lastName) > 0:
  1070.  
  1071.                     if lastTime <= 0:
  1072.                         clockText = localeInfo.QUEST_TIMEOVER
  1073.  
  1074.                     else:
  1075.                         questLastMinute = lastTime / 60
  1076.                         questLastSecond = lastTime % 60
  1077.  
  1078.                         clockText = lastName + " : "
  1079.  
  1080.                         if questLastMinute > 0:
  1081.                             clockText += str(questLastMinute) + localeInfo.QUEST_MIN
  1082.                             if questLastSecond > 0:
  1083.                                 clockText += " "
  1084.  
  1085.                         if questLastSecond > 0:
  1086.                             clockText += str(questLastSecond) + localeInfo.QUEST_SEC
  1087.  
  1088.                 self.questLastTimeList[i].SetText(clockText)
  1089.     ''' #ENDOF_REDDEV_NEW_QUEST_LISTING
  1090.  
  1091.     #REDDEV_NEW_QUEST_LISTING
  1092.     def RefreshQuest(self):
  1093.         if app.ENABLE_QUEST_RENEWAL:
  1094.             if self.isLoaded == 0 or self.state != "QUEST":
  1095.                 return
  1096.  
  1097.             for cat in self.questOpenedCategories:
  1098.                 self.RefreshQuestCategory(cat)
  1099.  
  1100.             self.RefreshQuestCategoriesCount()
  1101.         else:
  1102.             if self.isLoaded==0:
  1103.                 return
  1104.  
  1105.             self.OnQuestScroll()
  1106.  
  1107.             questCount = quest.GetQuestCount()
  1108.             questRange = range(quest.QUEST_MAX_NUM)
  1109.  
  1110.             if questCount > quest.QUEST_MAX_NUM:
  1111.                 self.questScrollBar.Show()
  1112.             else:
  1113.                 self.questScrollBar.Hide()
  1114.  
  1115.             for i in questRange[:questCount]:
  1116.                 (questName, questIcon, questCounterName, questCounterValue) = quest.GetQuestData(self.questShowingStartIndex + i)
  1117.  
  1118.                 self.questNameList[i].SetText(questName)
  1119.                 self.questNameList[i].Show()
  1120.                 self.questLastCountList[i].Show()
  1121.                 self.questLastTimeList[i].Show()
  1122.  
  1123.                 if len(questCounterName) > 0:
  1124.                     self.questLastCountList[i].SetText("%s : %d" % (questCounterName, questCounterValue))
  1125.                 else:
  1126.                     self.questLastCountList[i].SetText("")
  1127.  
  1128.                 ## Icon
  1129.                 self.questSlot.SetSlot(i, i, 1, 1, questIcon)
  1130.  
  1131.             for i in questRange[questCount:]:
  1132.                 self.questNameList[i].Hide()
  1133.                 self.questLastTimeList[i].Hide()
  1134.                 self.questLastCountList[i].Hide()
  1135.                 self.questSlot.ClearSlot(i)
  1136.                 self.questSlot.HideSlotBaseImage(i)
  1137.  
  1138.             self.__UpdateQuestClock()
  1139.  
  1140.     def __UpdateQuestClock(self):
  1141.         if "QUEST" == self.state:
  1142.             if app.ENABLE_QUEST_RENEWAL:
  1143.                 for clock in self.questClockList:
  1144.                     clockText = localeInfo.QUEST_UNLIMITED_TIME
  1145.  
  1146.                     if clock.GetProperty("idx"):
  1147.                         (lastName, lastTime) = quest.GetQuestLastTime(clock.GetProperty("idx"))
  1148.  
  1149.                         if len(lastName) > 0:
  1150.                             if lastTime <= 0:
  1151.                                 clockText = localeInfo.QUEST_TIMEOVER
  1152.                             else:
  1153.                                 questLastMinute = lastTime / 60
  1154.                                 questLastSecond = lastTime % 60
  1155.  
  1156.                                 clockText = lastName + " : "
  1157.  
  1158.                                 if questLastMinute > 0:
  1159.                                     clockText += str(questLastMinute) + localeInfo.QUEST_MIN
  1160.                                     if questLastSecond > 0:
  1161.                                         clockText += " "
  1162.  
  1163.                                 if questLastSecond > 0:
  1164.                                     clockText += str(questLastSecond) + localeInfo.QUEST_SEC
  1165.  
  1166.                     clock.SetText(clockText)
  1167.             else:
  1168.                 # QUEST_LIMIT_COUNT_BUG_FIX
  1169.                 for i in xrange(min(quest.GetQuestCount(), quest.QUEST_MAX_NUM)):
  1170.                 # END_OF_QUEST_LIMIT_COUNT_BUG_FIX
  1171.                     (lastName, lastTime) = quest.GetQuestLastTime(i + self.questShowingStartIndex)
  1172.  
  1173.                     clockText = localeInfo.QUEST_UNLIMITED_TIME
  1174.                     if len(lastName) > 0:
  1175.  
  1176.                         if lastTime <= 0:
  1177.                             clockText = localeInfo.QUEST_TIMEOVER
  1178.                         else:
  1179.                             questLastMinute = lastTime / 60
  1180.                             questLastSecond = lastTime % 60
  1181.  
  1182.                             clockText = lastName + " : "
  1183.  
  1184.                             if questLastMinute > 0:
  1185.                                 clockText += str(questLastMinute) + localeInfo.QUEST_MIN
  1186.                                 if questLastSecond > 0:
  1187.                                     clockText += " "
  1188.  
  1189.                             if questLastSecond > 0:
  1190.                                 clockText += str(questLastSecond) + localeInfo.QUEST_SEC
  1191.  
  1192.                     self.questLastTimeList[i].SetText(clockText)
  1193.     #ENDOF_REDDEV_NEW_QUEST_LISTING
  1194.    
  1195.     def __GetStatMinusPoint(self):
  1196.         POINT_STAT_RESET_COUNT = 112
  1197.         return player.GetStatus(POINT_STAT_RESET_COUNT)
  1198.  
  1199.     def __OverInStatMinusButton(self, stat):
  1200.         try:
  1201.             self.__ShowStatToolTip(self.STAT_MINUS_DESCRIPTION[stat] % self.__GetStatMinusPoint())
  1202.         except KeyError:
  1203.             pass
  1204.  
  1205.         self.refreshToolTip = lambda arg=stat: self.__OverInStatMinusButton(arg)
  1206.  
  1207.     def __OverOutStatMinusButton(self):
  1208.         self.__HideStatToolTip()
  1209.         self.refreshToolTip = 0
  1210.  
  1211.     def __OverInStatButton(self, stat):
  1212.         try:
  1213.             self.__ShowStatToolTip(self.STAT_DESCRIPTION[stat])
  1214.         except KeyError:
  1215.             pass
  1216.  
  1217.     def __OverOutStatButton(self):
  1218.         self.__HideStatToolTip()
  1219.  
  1220.     def __ShowStatToolTip(self, statDesc):
  1221.         self.toolTip.ClearToolTip()
  1222.         self.toolTip.AppendTextLine(statDesc)
  1223.         self.toolTip.Show()
  1224.  
  1225.     def __HideStatToolTip(self):
  1226.         self.toolTip.Hide()
  1227.  
  1228.     def OnPressEscapeKey(self):
  1229.  
  1230.         if app.ENABLE_QUEST_RENEWAL:
  1231.             if self.questSlideWndNewKey > 0:
  1232.                 if self.questSlideWnd[self.questSlideWndNewKey-1] is not None:
  1233.                     self.questSlideWnd[self.questSlideWndNewKey-1].OnPressEscapeKey()
  1234.  
  1235.         self.Close()
  1236.         return True
  1237.  
  1238.     def OnUpdate(self):
  1239.         self.__UpdateQuestClock()
  1240.  
  1241.     ## Skill Process
  1242.     def __RefreshSkillPage(self, name, slotCount):
  1243.         global SHOW_LIMIT_SUPPORT_SKILL_LIST
  1244.         skillPage = self.skillPageDict[name]
  1245.         startSlotIndex = skillPage.GetStartIndex()
  1246.         if "ACTIVE" == name:
  1247.             if self.PAGE_HORSE == self.curSelectedSkillGroup:
  1248.                 startSlotIndex += slotCount
  1249.  
  1250.         getSkillType=skill.GetSkillType
  1251.         getSkillIndex=player.GetSkillIndex
  1252.         getSkillGrade=player.GetSkillGrade
  1253.         getSkillLevel=player.GetSkillLevel
  1254.         getSkillLevelUpPoint=skill.GetSkillLevelUpPoint
  1255.         getSkillMaxLevel=skill.GetSkillMaxLevel
  1256.  
  1257.         if app.ENABLE_SKILLS_LEVEL_OVER_P:
  1258.             refresh = 0
  1259.  
  1260.         for i in xrange(slotCount+1):
  1261.  
  1262.             slotIndex = i + startSlotIndex
  1263.             skillIndex = getSkillIndex(slotIndex)
  1264.             if not app.ENABLE_SKILLS_LEVEL_OVER_P:
  1265.                 for j in xrange(skill.SKILL_GRADE_COUNT):
  1266.                     skillPage.ClearSlot(self.__GetRealSkillSlot(j, i))
  1267.             else:
  1268.                 if not refresh and skillIndex >= 137 and skillIndex <= 140:
  1269.                     for w in xrange(slotCount + 1):
  1270.                         for q in xrange(skill.SKILL_GRADE_COUNT):
  1271.                             skillPage.ClearSlot(self.__GetRealSkillSlot(q, w))
  1272.                    
  1273.                     refresh = 1
  1274.            
  1275.             if app.ENABLE_SKILLS_LEVEL_OVER_P:
  1276.                 if slotIndex == 7 or slotIndex == 8:
  1277.                     for j in xrange(skill.SKILL_GRADE_COUNT):
  1278.                         skillPage.ClearSlot(self.__GetRealSkillSlot(j, slotIndex))
  1279.  
  1280.             if 0 == skillIndex:
  1281.                 continue
  1282.  
  1283.             skillGrade = getSkillGrade(slotIndex)
  1284.             skillLevel = getSkillLevel(slotIndex)
  1285.             skillType = getSkillType(skillIndex)
  1286.  
  1287.             if player.SKILL_INDEX_RIDING == skillIndex:
  1288.                 if app.ENABLE_SKILLS_LEVEL_OVER_P:
  1289.                     skGrade = 0
  1290.                     if skillLevel >= 11 and skillLevel < 20:
  1291.                         skGrade = 1
  1292.                     elif skillGrade == 1:
  1293.                         skGrade = 2
  1294.  
  1295.                 if 1 == skillGrade:
  1296.                     skillLevel += 19
  1297.                 elif 2 == skillGrade:
  1298.                     skillLevel += 29
  1299.                 elif 3 == skillGrade:
  1300.                     skillLevel = 40
  1301.  
  1302.                 if app.ENABLE_SKILLS_LEVEL_OVER_P:
  1303.                     skGr = max(skillLevel - 1, 0)
  1304.                     skGr = skGrade
  1305.                     skillPage.SetSkillSlotNew(slotIndex, skillIndex, skGr, skillLevel)
  1306.                 else:
  1307.                     skillPage.SetSkillSlotNew(slotIndex, skillIndex, max(skillLevel-1, 0), skillLevel)
  1308.  
  1309.                 skillPage.SetSlotCount(slotIndex, skillLevel)
  1310.  
  1311.             ## ACTIVE
  1312.             elif skill.SKILL_TYPE_ACTIVE == skillType:
  1313.                 for j in xrange(skill.SKILL_GRADE_COUNT):
  1314.                     if app.ENABLE_SKILLS_LEVEL_OVER_P:
  1315.                         if j == 2 and skillGrade == 1:
  1316.                             continue
  1317.  
  1318.                     realSlotIndex = self.__GetRealSkillSlot(j, slotIndex)
  1319.                     skillPage.SetSkillSlotNew(realSlotIndex, skillIndex, j, skillLevel)
  1320.                     skillPage.SetCoverButton(realSlotIndex)
  1321.  
  1322.                     if (skillGrade == skill.SKILL_GRADE_COUNT) and j == (skill.SKILL_GRADE_COUNT-1):
  1323.                         skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)
  1324.                     elif (not self.__CanUseSkillNow()) or (skillGrade != j):
  1325.                         if app.ENABLE_SKILLS_LEVEL_OVER_P:
  1326.                             if j != 2 and skillGrade != 2:
  1327.                                 skillPage.ClearSlot(realSlotIndex)
  1328.                                 skillPage.SetSkillSlotNew(realSlotIndex, skillIndex, j, skillLevel)
  1329.                                 skillPage.SetCoverButton(realSlotIndex)
  1330.                             elif skillGrade == 2 and j >= 3:
  1331.                                 skillPage.ClearSlot(realSlotIndex)
  1332.                                 skillPage.SetSkillSlotNew(realSlotIndex, skillIndex, j, skillLevel)
  1333.                                 skillPage.SetCoverButton(realSlotIndex)
  1334.  
  1335.                         skillPage.SetSlotCount(realSlotIndex, 0)
  1336.                         skillPage.DisableCoverButton(realSlotIndex)
  1337.                     else:
  1338.                         skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)
  1339.             else:
  1340.                 if not SHOW_LIMIT_SUPPORT_SKILL_LIST or skillIndex in SHOW_LIMIT_SUPPORT_SKILL_LIST:
  1341.                     realSlotIndex = self.__GetETCSkillRealSlotIndex(slotIndex)
  1342.                     skillPage.SetSkillSlot(realSlotIndex, skillIndex, skillLevel)
  1343.                     skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel)
  1344.                     if skill.CanUseSkill(skillIndex):
  1345.                         skillPage.SetCoverButton(realSlotIndex)
  1346.  
  1347.             skillPage.RefreshSlot()
  1348.  
  1349.     def RefreshSkill(self):
  1350.  
  1351.         if self.isLoaded==0:
  1352.             return
  1353.  
  1354.         if self.__IsChangedHorseRidingSkillLevel():
  1355.             self.RefreshCharacter()
  1356.             return
  1357.  
  1358.  
  1359.         global SHOW_ONLY_ACTIVE_SKILL
  1360.         if SHOW_ONLY_ACTIVE_SKILL:
  1361.             self.__RefreshSkillPage("ACTIVE", self.ACTIVE_PAGE_SLOT_COUNT)
  1362.         else:
  1363.             self.__RefreshSkillPage("ACTIVE", self.ACTIVE_PAGE_SLOT_COUNT)
  1364.             self.__RefreshSkillPage("SUPPORT", self.SUPPORT_PAGE_SLOT_COUNT)
  1365.  
  1366.         self.RefreshSkillPlusButtonList()
  1367.  
  1368.     def CanShowPlusButton(self, skillIndex, skillLevel, curStatPoint):
  1369.  
  1370.         ## ½ºÅ³ÀÌ ÀÖÀ¸¸é
  1371.         if 0 == skillIndex:
  1372.             return False
  1373.  
  1374.         ## ·¹º§¾÷ Á¶°ÇÀ» ¸¸Á·ÇÑ´Ù¸é
  1375.         if not skill.CanLevelUpSkill(skillIndex, skillLevel):
  1376.             return False
  1377.  
  1378.         return True
  1379.  
  1380.     def __RefreshSkillPlusButton(self, name):
  1381.         global HIDE_SUPPORT_SKILL_POINT
  1382.         if HIDE_SUPPORT_SKILL_POINT and "SUPPORT" == name:
  1383.             return
  1384.  
  1385.         slotWindow = self.skillPageDict[name]
  1386.         slotWindow.HideAllSlotButton()
  1387.  
  1388.         slotStatType = self.skillPageStatDict[name]
  1389.         if 0 == slotStatType:
  1390.             return
  1391.  
  1392.         statPoint = player.GetStatus(slotStatType)
  1393.         startSlotIndex = slotWindow.GetStartIndex()
  1394.         if "HORSE" == name:
  1395.             startSlotIndex += self.ACTIVE_PAGE_SLOT_COUNT
  1396.  
  1397.         if statPoint > 0:
  1398.             for i in xrange(self.PAGE_SLOT_COUNT):
  1399.                 slotIndex = i + startSlotIndex
  1400.                 skillIndex = player.GetSkillIndex(slotIndex)
  1401.                 skillGrade = player.GetSkillGrade(slotIndex)
  1402.                 skillLevel = player.GetSkillLevel(slotIndex)
  1403.  
  1404.                 if skillIndex == 0:
  1405.                     continue
  1406.                 if skillGrade != 0:
  1407.                     continue
  1408.  
  1409.                 if name == "HORSE":
  1410.                     if player.GetStatus(player.LEVEL) >= skill.GetSkillLevelLimit(skillIndex):
  1411.                         if skillLevel < 20:
  1412.                             slotWindow.ShowSlotButton(self.__GetETCSkillRealSlotIndex(slotIndex))
  1413.  
  1414.                 else:
  1415.                     if "SUPPORT" == name:
  1416.                         if not SHOW_LIMIT_SUPPORT_SKILL_LIST or skillIndex in SHOW_LIMIT_SUPPORT_SKILL_LIST:
  1417.                             if self.CanShowPlusButton(skillIndex, skillLevel, statPoint):
  1418.                                 slotWindow.ShowSlotButton(slotIndex)
  1419.                     else:
  1420.                         if self.CanShowPlusButton(skillIndex, skillLevel, statPoint):
  1421.                             slotWindow.ShowSlotButton(slotIndex)
  1422.  
  1423.  
  1424.     def RefreshSkillPlusButtonList(self):
  1425.  
  1426.         if self.isLoaded==0:
  1427.             return
  1428.  
  1429.         self.RefreshSkillPlusPointLabel()
  1430.  
  1431.         if not self.__CanUseSkillNow():
  1432.             return
  1433.  
  1434.         try:
  1435.             if self.PAGE_HORSE == self.curSelectedSkillGroup:
  1436.                 self.__RefreshSkillPlusButton("HORSE")
  1437.             else:
  1438.                 self.__RefreshSkillPlusButton("ACTIVE")
  1439.  
  1440.             self.__RefreshSkillPlusButton("SUPPORT")
  1441.  
  1442.         except:
  1443.             import exception
  1444.             exception.Abort("CharacterWindow.RefreshSkillPlusButtonList.BindObject")
  1445.  
  1446.     def RefreshSkillPlusPointLabel(self):
  1447.         if self.isLoaded==0:
  1448.             return
  1449.  
  1450.         if self.PAGE_HORSE == self.curSelectedSkillGroup:
  1451.             activeStatPoint = player.GetStatus(player.SKILL_HORSE)
  1452.             self.activeSkillPointValue.SetText(str(activeStatPoint))
  1453.  
  1454.         else:
  1455.             activeStatPoint = player.GetStatus(player.SKILL_ACTIVE)
  1456.             self.activeSkillPointValue.SetText(str(activeStatPoint))
  1457.  
  1458.         supportStatPoint = max(0, player.GetStatus(player.SKILL_SUPPORT))
  1459.         self.supportSkillPointValue.SetText(str(supportStatPoint))
  1460.  
  1461.     ## Skill Level Up Button
  1462.     def OnPressedSlotButton(self, slotNumber):
  1463.         srcSlotIndex = self.__RealSkillSlotToSourceSlot(slotNumber)
  1464.  
  1465.         skillIndex = player.GetSkillIndex(srcSlotIndex)
  1466.         curLevel = player.GetSkillLevel(srcSlotIndex)
  1467.         maxLevel = skill.GetSkillMaxLevel(skillIndex)
  1468.  
  1469.         net.SendChatPacket("/skillup " + str(skillIndex))
  1470.  
  1471.     ## Use Skill
  1472.     def ClickSkillSlot(self, slotIndex):
  1473.  
  1474.         srcSlotIndex = self.__RealSkillSlotToSourceSlot(slotIndex)
  1475.         skillIndex = player.GetSkillIndex(srcSlotIndex)
  1476.         skillType = skill.GetSkillType(skillIndex)
  1477.  
  1478.         if not self.__CanUseSkillNow():
  1479.             if skill.SKILL_TYPE_ACTIVE == skillType:
  1480.                 return
  1481.  
  1482.         for slotWindow in self.skillPageDict.values():
  1483.             if slotWindow.HasSlot(slotIndex):
  1484.                 if skill.CanUseSkill(skillIndex):
  1485.                     player.ClickSkillSlot(srcSlotIndex)
  1486.                     return
  1487.  
  1488.         mouseModule.mouseController.DeattachObject()
  1489.  
  1490.     ## FIXME : ½ºÅ³À» »ç¿ëÇßÀ»¶§ ½½·Ô ¹øÈ£¸¦ °¡Áö°í ÇØ´ç ½½·ÔÀ» ã¾Æ¼­ ¾÷µ¥ÀÌÆ® ÇÑ´Ù.
  1491.     ##         ¸Å¿ì ºÒÇÕ¸®. ±¸Á¶ ÀÚü¸¦ °³¼±ÇØ¾ß ÇÒµí.
  1492.     def OnUseSkill(self, slotIndex, coolTime):
  1493.  
  1494.         skillIndex = player.GetSkillIndex(slotIndex)
  1495.         skillType = skill.GetSkillType(skillIndex)
  1496.  
  1497.         ## ACTIVE
  1498.         if skill.SKILL_TYPE_ACTIVE == skillType:
  1499.             skillGrade = player.GetSkillGrade(slotIndex)
  1500.             slotIndex = self.__GetRealSkillSlot(skillGrade, slotIndex)
  1501.         ## ETC
  1502.         else:
  1503.             slotIndex = self.__GetETCSkillRealSlotIndex(slotIndex)
  1504.  
  1505.         for slotWindow in self.skillPageDict.values():
  1506.             if slotWindow.HasSlot(slotIndex):
  1507.                 slotWindow.SetSlotCoolTime(slotIndex, coolTime)
  1508.                 return
  1509.  
  1510.     def OnActivateSkill(self, slotIndex):
  1511.         skillGrade = player.GetSkillGrade(slotIndex)
  1512.         slotIndex = self.__GetRealSkillSlot(skillGrade, slotIndex)
  1513.         for slotWindow in self.skillPageDict.values():
  1514.             if slotWindow.HasSlot(slotIndex):
  1515.                 if app.ENABLE_SASH_SYSTEM:
  1516.                     slotWindow.ActivateSlotOld(slotIndex)
  1517.                 else:
  1518.                     slotWindow.ActivateSlot(slotIndex)
  1519.                
  1520.                 return
  1521.  
  1522.     def OnDeactivateSkill(self, slotIndex):
  1523.         skillGrade = player.GetSkillGrade(slotIndex)
  1524.         slotIndex = self.__GetRealSkillSlot(skillGrade, slotIndex)
  1525.         for slotWindow in self.skillPageDict.values():
  1526.             if slotWindow.HasSlot(slotIndex):
  1527.                 if app.ENABLE_SASH_SYSTEM:
  1528.                     slotWindow.DeactivateSlotOld(slotIndex)
  1529.                 else:
  1530.                     slotWindow.DeactivateSlot(slotIndex)
  1531.                
  1532.                 return
  1533.  
  1534.     def __ShowJobToolTip(self):
  1535.         self.toolTipJob.ShowToolTip()
  1536.  
  1537.     def __HideJobToolTip(self):
  1538.         self.toolTipJob.HideToolTip()
  1539.  
  1540.     def __SetJobText(self, mainJob, subJob):
  1541.         if player.GetStatus(player.LEVEL)<5:
  1542.             subJob=0
  1543.  
  1544.         if 949 == app.GetDefaultCodePage():
  1545.             self.toolTipJob.ClearToolTip()
  1546.  
  1547.             try:
  1548.                 jobInfoTitle=localeInfo.JOBINFO_TITLE[mainJob][subJob]
  1549.                 jobInfoData=localeInfo.JOBINFO_DATA_LIST[mainJob][subJob]
  1550.             except IndexError:
  1551.                 print "uiCharacter.CharacterWindow.__SetJobText(mainJob=%d, subJob=%d)" % (mainJob, subJob)
  1552.                 return
  1553.  
  1554.             self.toolTipJob.AutoAppendTextLine(jobInfoTitle)
  1555.             self.toolTipJob.AppendSpace(5)
  1556.  
  1557.             for jobInfoDataLine in jobInfoData:
  1558.                 self.toolTipJob.AutoAppendTextLine(jobInfoDataLine)
  1559.  
  1560.             self.toolTipJob.AlignHorizonalCenter()
  1561.  
  1562.     def __ShowAlignmentToolTip(self):
  1563.         self.toolTipAlignment.ShowToolTip()
  1564.  
  1565.     def __HideAlignmentToolTip(self):
  1566.         self.toolTipAlignment.HideToolTip()
  1567.  
  1568.     def RefreshCharacter(self):
  1569.  
  1570.         if self.isLoaded==0:
  1571.             return
  1572.  
  1573.         ## Name
  1574.         try:
  1575.             characterName = player.GetName()
  1576.             guildName = player.GetGuildName()
  1577.             self.characterNameValue.SetText(characterName)
  1578.             self.guildNameValue.SetText(guildName)
  1579.             if not guildName:
  1580.                 if localeInfo.IsARABIC():
  1581.                     self.characterNameSlot.SetPosition(190, 34)
  1582.                 else:
  1583.                     self.characterNameSlot.SetPosition(109, 34)
  1584.  
  1585.                 self.guildNameSlot.Hide()
  1586.             else:
  1587.                 if localeInfo.IsJAPAN():
  1588.                     self.characterNameSlot.SetPosition(143, 34)
  1589.                 else:
  1590.                     self.characterNameSlot.SetPosition(153, 34)
  1591.                 self.guildNameSlot.Show()
  1592.         except:
  1593.             import exception
  1594.             exception.Abort("CharacterWindow.RefreshCharacter.BindObject")
  1595.  
  1596.         race = net.GetMainActorRace()
  1597.         group = net.GetMainActorSkillGroup()
  1598.         empire = net.GetMainActorEmpire()
  1599.  
  1600.         ## Job Text
  1601.         job = chr.RaceToJob(race)
  1602.         self.__SetJobText(job, group)
  1603.  
  1604.         ## FaceImage
  1605.         try:
  1606.             faceImageName = FACE_IMAGE_DICT[race]
  1607.  
  1608.             try:
  1609.                 self.faceImage.LoadImage(faceImageName)
  1610.             except:
  1611.                 print "CharacterWindow.RefreshCharacter(race=%d, faceImageName=%s)" % (race, faceImageName)
  1612.                 self.faceImage.Hide()
  1613.  
  1614.         except KeyError:
  1615.             self.faceImage.Hide()
  1616.  
  1617.         ## GroupName
  1618.         self.__SetSkillGroupName(race, group)
  1619.  
  1620.         ## Skill
  1621.         if 0 == group:
  1622.             self.__SelectSkillGroup(0)
  1623.  
  1624.         else:
  1625.             self.__SetSkillSlotData(race, group, empire)
  1626.  
  1627.             if self.__CanUseHorseSkill():
  1628.                 self.__SelectSkillGroup(0)
  1629.  
  1630.     def __SetSkillGroupName(self, race, group):
  1631.  
  1632.         job = chr.RaceToJob(race)
  1633.  
  1634.         if not self.SKILL_GROUP_NAME_DICT.has_key(job):
  1635.             return
  1636.  
  1637.         nameList = self.SKILL_GROUP_NAME_DICT[job]
  1638.  
  1639.         if 0 == group:
  1640.             self.skillGroupButton1.SetText(nameList[1])
  1641.             self.skillGroupButton2.SetText(nameList[2])
  1642.             self.skillGroupButton1.Show()
  1643.             self.skillGroupButton2.Show()
  1644.             self.activeSkillGroupName.Hide()
  1645.  
  1646.         else:
  1647.  
  1648.             if self.__CanUseHorseSkill():
  1649.                 self.activeSkillGroupName.Hide()
  1650.                 self.skillGroupButton1.SetText(nameList.get(group, "Noname"))
  1651.                 self.skillGroupButton2.SetText(localeInfo.SKILL_GROUP_HORSE)
  1652.                 self.skillGroupButton1.Show()
  1653.                 self.skillGroupButton2.Show()
  1654.  
  1655.             else:
  1656.                 self.activeSkillGroupName.SetText(nameList.get(group, "Noname"))
  1657.                 self.activeSkillGroupName.Show()
  1658.                 self.skillGroupButton1.Hide()
  1659.                 self.skillGroupButton2.Hide()
  1660.  
  1661.     def __SetSkillSlotData(self, race, group, empire=0):
  1662.  
  1663.         ## SkillIndex
  1664.         playersettingmodule.RegisterSkill(race, group, empire)
  1665.  
  1666.         ## Event
  1667.         self.__SetSkillSlotEvent()
  1668.  
  1669.         ## Refresh
  1670.         self.RefreshSkill()
  1671.  
  1672.     def __SelectSkillGroup(self, index):
  1673.         for btn in self.skillGroupButton:
  1674.             btn.SetUp()
  1675.         self.skillGroupButton[index].Down()
  1676.  
  1677.         if self.__CanUseHorseSkill():
  1678.             if 0 == index:
  1679.                 index = net.GetMainActorSkillGroup()-1
  1680.             elif 1 == index:
  1681.                 index = self.PAGE_HORSE
  1682.  
  1683.         self.curSelectedSkillGroup = index
  1684.         self.__SetSkillSlotData(net.GetMainActorRace(), index+1, net.GetMainActorEmpire())
  1685.  
  1686.     def __CanUseSkillNow(self):
  1687.         if 0 == net.GetMainActorSkillGroup():
  1688.             return False
  1689.  
  1690.         return True
  1691.  
  1692.     def __CanUseHorseSkill(self):
  1693.  
  1694.         slotIndex = player.GetSkillSlotIndex(player.SKILL_INDEX_RIDING)
  1695.  
  1696.         if not slotIndex:
  1697.             return False
  1698.  
  1699.         grade = player.GetSkillGrade(slotIndex)
  1700.         level = player.GetSkillLevel(slotIndex)
  1701.         if level < 0:
  1702.             level *= -1
  1703.         if grade >= 1 and level >= 1:
  1704.             return True
  1705.  
  1706.         return False
  1707.  
  1708.     def __IsChangedHorseRidingSkillLevel(self):
  1709.         ret = False
  1710.  
  1711.         if -1 == self.canUseHorseSkill:
  1712.             self.canUseHorseSkill = self.__CanUseHorseSkill()
  1713.  
  1714.         if self.canUseHorseSkill != self.__CanUseHorseSkill():
  1715.             ret = True
  1716.  
  1717.         self.canUseHorseSkill = self.__CanUseHorseSkill()
  1718.         return ret
  1719.  
  1720.     if app.ENABLE_SKILLS_LEVEL_OVER_P:
  1721.         def __GetRealSkillSlot(self, skillGrade, skillSlot):
  1722.             _min = skill.SKILL_GRADE_COUNT - 1
  1723.             if app.ENABLE_SKILLS_LEVEL_OVER_P:
  1724.                 _min -= 1
  1725.                 if skillGrade == 2:
  1726.                     skillGrade -= 1
  1727.            
  1728.             __calc = skillSlot + min(_min, skillGrade) * skill.SKILL_GRADE_STEP_COUNT
  1729.             return __calc
  1730.     else:
  1731.         def __GetRealSkillSlot(self, skillGrade, skillSlot):
  1732.             return skillSlot + min(skill.SKILL_GRADE_COUNT-1, skillGrade)*skill.SKILL_GRADE_STEP_COUNT
  1733.  
  1734.     def __GetETCSkillRealSlotIndex(self, skillSlot):
  1735.         if skillSlot > 100:
  1736.             return skillSlot
  1737.         return skillSlot % self.ACTIVE_PAGE_SLOT_COUNT
  1738.  
  1739.     def __RealSkillSlotToSourceSlot(self, realSkillSlot):
  1740.         if realSkillSlot > 100:
  1741.             return realSkillSlot
  1742.         if self.PAGE_HORSE == self.curSelectedSkillGroup:
  1743.             return realSkillSlot + self.ACTIVE_PAGE_SLOT_COUNT
  1744.         return realSkillSlot % skill.SKILL_GRADE_STEP_COUNT
  1745.  
  1746.     def __GetSkillGradeFromSlot(self, skillSlot):
  1747.         return int(skillSlot / skill.SKILL_GRADE_STEP_COUNT)
  1748.  
  1749.     def SelectSkillGroup(self, index):
  1750.         self.__SelectSkillGroup(index)
  1751.  
  1752.     def OnQuestScroll(self):
  1753.         questCount = quest.GetQuestCount()
  1754.         scrollLineCount = max(0, questCount - quest.QUEST_MAX_NUM)
  1755.         startIndex = int(scrollLineCount * self.questScrollBar.GetPos())
  1756.  
  1757.         if startIndex != self.questShowingStartIndex:
  1758.             self.questShowingStartIndex = startIndex
  1759.             self.RefreshQuest()
  1760.  
  1761.     if app.ENABLE_QUEST_RENEWAL:
  1762.         def __OnScrollQuest(self):
  1763.             if self.state != "QUEST":
  1764.                 return
  1765.  
  1766.             curPos = self.questScrollBar.GetPos()
  1767.             if math.fabs(curPos - self.questLastScrollPosition) >= 0.001:
  1768.                 self.RerenderQuestPage()
  1769.                 self.questLastScrollPosition = curPos
  1770.  
  1771.         def ResetQuestScroll(self):
  1772.             self.questScrollBar.Hide()
  1773.  
  1774.             if self.questScrollBar.GetPos() != 0:
  1775.                 self.questScrollBar.SetPos(0)
  1776.  
  1777.         def RerenderQuestPage(self):
  1778.             overflowingY = self.displayY - self.MAX_QUEST_PAGE_HEIGHT
  1779.             if overflowingY < 0:
  1780.                 overflowingY = 0
  1781.  
  1782.             self.baseCutY = math.ceil(overflowingY * self.questScrollBar.GetPos())
  1783.             self.displayY = 0
  1784.             self.RearrangeQuestCategories(xrange(quest.QUEST_CATEGORY_MAX_NUM))
  1785.             self.RefreshQuestCategory()
  1786.  
  1787.             if overflowingY > 0:
  1788.                 if (len(self.questOpenedCategories)) == 0:
  1789.                     self.ResetQuestScroll()
  1790.                 else:
  1791.                     self.questScrollBar.Show()
  1792.             else:
  1793.                 self.ResetQuestScroll()
  1794.  
  1795.         def __LoadQuestCategory(self):
  1796.             self.questPage.Show()
  1797.  
  1798.             if self.isLoaded == 0:
  1799.                 return
  1800.  
  1801.             for i in xrange(quest.QUEST_CATEGORY_MAX_NUM):
  1802.                 category = self.questCategoryList[i]
  1803.  
  1804.                 categoryName = category.GetProperty("name")
  1805.                 if not categoryName:
  1806.                     category.SetProperty("name", category.GetText())
  1807.                     categoryName = category.GetText()
  1808.  
  1809.                 questCount = self.GetQuestCountInCategory(i)
  1810.                 self.questCategoryList[i].SetTextAlignLeft(categoryName + " (" + str(questCount) + ")")
  1811.                 self.questCategoryList[i].SetTextColor(self.GetQuestCategoryColor(i))
  1812.                 self.questCategoryList[i].SetQuestLabel(quest_lable_expend_img_path_dict[i], self.GetQuestCountInCategory(i))
  1813.                 self.questCategoryList[i].Show()
  1814.  
  1815.             self.RefreshQuestCategory()
  1816.             if self.isQuestCategoryLoad == False:
  1817.                 self.questScrollBar.Hide()
  1818.             else:
  1819.                 self.RerenderQuestPage()
  1820.  
  1821.             self.isQuestCategoryLoad = True
  1822.  
  1823.         def GetQuestCategoryColor(self, category):
  1824.             return self.questColorList["default_title"]
  1825.  
  1826.         def GetQuestProperties(self, questName):
  1827.             findString = {
  1828.                 "*" : "blue",
  1829.                 "&" : "green",
  1830.                 "~" : "golden"
  1831.             }
  1832.  
  1833.             if questName[0] in findString:
  1834.                 return (questName[1:], findString[questName[0]])
  1835.  
  1836.             return (questName, None)
  1837.  
  1838.         def IsQuestCategoryOpen(self, category):
  1839.             return (category in self.questOpenedCategories)
  1840.  
  1841.         def ToggleCategory(self, category):
  1842.             if self.IsQuestCategoryOpen(category):
  1843.                 self.CloseQuestCategory(category)
  1844.             else:
  1845.                 self.OpenQuestCategory(category)
  1846.  
  1847.         def RearrangeQuestCategories(self, categoryRange):
  1848.             i = 0
  1849.             for i in categoryRange:
  1850.                 if (self.displayY - self.baseCutY) >= 0 and (self.displayY - self.baseCutY) < self.MAX_QUEST_PAGE_HEIGHT - 20:
  1851.                     self.questCategoryList[i].SetPosition(13, (self.displayY - self.baseCutY) + 10)
  1852.                     self.questCategoryList[i].Show()
  1853.                 else:
  1854.                     self.questCategoryList[i].Hide()
  1855.  
  1856.                 self.displayY += 20
  1857.                 self.questCategoryRenderPos[i] = self.displayY
  1858.  
  1859.         def CloseQuestCategory(self, category):
  1860.             self.questCategoryList[category].CloseCategory(self.GetQuestCountInCategory(category))
  1861.  
  1862.             if category in self.questOpenedCategories:
  1863.                 self.questOpenedCategories.remove(category)
  1864.  
  1865.             for currentSlot in self.questSlotList:
  1866.                 if currentSlot.GetProperty("category") == category:
  1867.                     currentSlot.Hide()
  1868.                     self.displayY -= currentSlot.GetHeight()
  1869.  
  1870.             self.RerenderQuestPage()
  1871.  
  1872.         def OpenQuestCategory(self, category):
  1873.             if self.GetQuestCountInCategory(category) == 0:
  1874.                 return
  1875.  
  1876.             while len(self.questOpenedCategories) >= self.questMaxOpenedCategories:
  1877.                 openedCategories = self.questOpenedCategories.pop()
  1878.                 self.CloseQuestCategory(openedCategories)
  1879.  
  1880.             self.questCategoryList[category].OpenCategory(self.GetQuestCountInCategory(category))
  1881.             self.questOpenedCategories.append(category)
  1882.             self.RefreshQuestCategory(category)
  1883.             self.RerenderQuestPage()
  1884.  
  1885.         def RefreshQuestCategory(self, category = -1):
  1886.             if self.isLoaded == 0 or self.state != "QUEST":
  1887.                 return
  1888.  
  1889.             categories = []
  1890.             if category == -1:
  1891.                 categories = self.questOpenedCategories
  1892.             elif not category in self.questOpenedCategories:
  1893.                 self.OpenQuestCategory(category)
  1894.                 return
  1895.             else:
  1896.                 categories.append(category)
  1897.  
  1898.             for currentCategory in categories:
  1899.                 self.displayY = self.questCategoryRenderPos[currentCategory]
  1900.  
  1901.                 self.LoadCategory(currentCategory)
  1902.                 self.RearrangeQuestCategories(xrange(currentCategory + 1, quest.QUEST_CATEGORY_MAX_NUM))
  1903.  
  1904.         def RefreshQuestCategoriesCount(self):
  1905.             for category in xrange(quest.QUEST_CATEGORY_MAX_NUM):
  1906.                 categoryName = self.questCategoryList[category].GetProperty("name")
  1907.                 questCount = self.GetQuestCountInCategory(category)
  1908.                 self.questCategoryList[category].SetTextAlignLeft(categoryName + " (" + str(questCount) + ")")
  1909.  
  1910.         def RefreshQuest(self):
  1911.             if self.isLoaded == 0 or self.state != "QUEST":
  1912.                 return
  1913.  
  1914.             for category in self.questOpenedCategories:
  1915.                 self.RefreshQuestCategory(category)
  1916.  
  1917.             self.RefreshQuestCategoriesCount()
  1918.  
  1919.         def CreateQuestSlot(self, name):
  1920.             for questSlot in self.questSlotList:
  1921.                 if questSlot.GetWindowName() == name:
  1922.                     return questSlot
  1923.  
  1924.             pyScrLoader = ui.PythonScriptLoader()
  1925.             slot = ui.ListBar()
  1926.             pyScrLoader.LoadElementListBar(slot, quest_slot_listbar, self.questPage)
  1927.  
  1928.             slot.SetParent(self.quest_page_board_window)
  1929.             slot.SetWindowName(name)
  1930.             slot.Hide()
  1931.             self.questSlotList.append(slot)
  1932.             return slot
  1933.  
  1934.         def SetQuest(self, slot, questID, questName, questCounterName, questCounterValue):
  1935.             (name, color) = self.GetQuestProperties(questName)
  1936.             slot.SetTextAlignLeft(name, 20)
  1937.             if color:
  1938.                 slot.SetTextColor(self.questColorList[color])
  1939.             slot.SetEvent(ui.__mem_func__(self.__SelectQuest), questID)
  1940.             slot.SetWindowHorizontalAlignLeft()
  1941.             slot.Show()
  1942.  
  1943.         def LoadCategory(self, category):
  1944.             self.questIndexMap = {}
  1945.             self.questCounterList = []
  1946.             self.questClockList = []
  1947.             self.questSeparatorList = []
  1948.  
  1949.             for questSlot in self.questSlotList:
  1950.                 questSlot.Hide()
  1951.  
  1952.             questCount = 0
  1953.             for questIdx in self.GetQuestsInCategory(category):
  1954.                 questCount += 1
  1955.                 (questID, questIndex, questName, questCategory, _, questCounterName, questCounterValue) = questIdx
  1956.                 (lastName, lastTime) = quest.GetQuestLastTime(questID)
  1957.  
  1958.                 slot = self.CreateQuestSlot("QuestSlotList_" + str(questCategory) + "_" + str(questID))
  1959.  
  1960.                 slot.SetPosition(0, (self.displayY - self.baseCutY))
  1961.                 slot.SetParent(self.quest_page_board_window)
  1962.                 baseDisplayY = self.displayY
  1963.  
  1964.                 ## -- Quest Counter
  1965.                 hasCounter = False
  1966.                 if questCounterName != "":
  1967.                     self.displayY += 15
  1968.  
  1969.                     counter = ui.TextLine()
  1970.                     counter.SetParent(slot)
  1971.                     counter.SetPosition(20, 20 - 2.5)
  1972.                     counter.SetText(questCounterName + ": " + str(questCounterValue))
  1973.                     counter.Show()
  1974.  
  1975.                     self.questCounterList.append(counter)
  1976.                     hasCounter = True
  1977.                 ## -- Quest Counter
  1978.  
  1979.                 ## -- Quest Clock
  1980.                 self.displayY += 15
  1981.  
  1982.                 clockText = localeInfo.QUEST_UNLIMITED_TIME
  1983.                 if len(lastName) > 0:
  1984.                     if lastTime <= 0:
  1985.                         clockText = localeInfo.QUEST_TIMEOVER
  1986.                     else:
  1987.                         questLastMinute = lastTime / 60
  1988.                         questLastSecond = lastTime % 60
  1989.  
  1990.                         clockText = lastName + " : "
  1991.  
  1992.                         if questLastMinute > 0:
  1993.                             clockText += str(questLastMinute) + localeInfo.QUEST_MIN
  1994.                             if questLastSecond > 0:
  1995.                                 clockText += " "
  1996.  
  1997.                         if questLastSecond > 0:
  1998.                             clockText += str(questLastSecond) + localeInfo.QUEST_SEC
  1999.  
  2000.                 clock = ui.TextLine()
  2001.                 clock.SetParent(slot)
  2002.                 clock.SetPosition(20, 20 + (int(hasCounter) * 14) - 2.5)
  2003.                 clock.SetText(clockText)
  2004.                 clock.SetProperty("idx", questID)
  2005.                 self.questClockList.append(clock)
  2006.                 clock.Show()
  2007.                 ## -- Quest Clock
  2008.  
  2009.                 ## -- Quest Separator
  2010.                 self.displayY += 5
  2011.                 if questCount < self.GetQuestCountInCategory(category):
  2012.                     seperator = ui.ImageBox()
  2013.                     seperator.SetParent(slot)
  2014.                     seperator.SetPosition(4, 20 + (int(hasCounter) * 14 - 2.5) + 15)
  2015.                     seperator.LoadImage("d:/ymir work/ui/quest_re/quest_list_line_01.tga")
  2016.                     seperator.Show()
  2017.                     self.questSeparatorList.append(seperator)
  2018.                 ## -- Quest Separator
  2019.  
  2020.                 slot.SetProperty("category", questCategory)
  2021.  
  2022.                 if questIndex in self.questClicked:
  2023.                     slot.OnClickEvent()
  2024.  
  2025.                 if (baseDisplayY - self.baseCutY) + 2 >= 0 and (baseDisplayY - self.baseCutY) + 2 < self.MAX_QUEST_PAGE_HEIGHT - 30:
  2026.                     self.questIndexMap[questID] = questIndex
  2027.                     self.SetQuest(slot, questID, questName, questCounterName, questCounterValue)
  2028.  
  2029.                 self.displayY += 15
  2030.  
  2031.             newList = []
  2032.             for questSlot in self.questSlotList:
  2033.                 if questSlot.IsShow():
  2034.                     newList.append(questSlot)
  2035.  
  2036.             self.questSlotList = newList
  2037.  
  2038.         def __OnClickQuestCategoryButton(self, category):
  2039.             self.ToggleCategory(category)
  2040.  
  2041.         def GetQuestsInCategory(self, category, retCount = False):
  2042.             questList = []
  2043.             count = 0
  2044.             for i in xrange(quest.GetQuestCount()):
  2045.                 (questIndex, questName, questCategory, questIcon, questCounterName, questCounterValue) = quest.GetQuestData(i)
  2046.                 if questCategory == category:
  2047.                     count += 1
  2048.                     questList.append((i, questIndex, questName, questCategory, questIcon, questCounterName, questCounterValue))
  2049.  
  2050.             if retCount:
  2051.                 return count
  2052.  
  2053.             return questList
  2054.  
  2055.         def GetQuestCountInCategory(self, category):
  2056.             return self.GetQuestsInCategory(category, True)
Add Comment
Please, Sign In to add comment