Guest User

Untitled

a guest
May 4th, 2020
44
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. import app
  3. import dbg
  4. import grp
  5. import item
  6. import background
  7. import chr
  8. import chrmgr
  9. import player
  10. import snd
  11. import chat
  12. import textTail
  13. import snd
  14. import net
  15. import effect
  16. import wndMgr
  17. import fly
  18. import systemSetting
  19. import quest
  20. import guild
  21. import skill
  22. import messenger
  23. import localeInfo
  24. import constInfo
  25. import exchange
  26. import ime
  27. import ui
  28. import uiCommon
  29. import uiPhaseCurtain
  30. import uiMapNameShower
  31. import uiAffectShower
  32. import uiPlayerGauge
  33. import uiCharacter
  34. import uiTarget
  35. # PRIVATE_SHOP_PRICE_LIST
  36. import uiPrivateShopBuilder
  37. # END_OF_PRIVATE_SHOP_PRICE_LIST
  38.  
  39. import mouseModule
  40. import consoleModule
  41. import localeInfo
  42.  
  43. import playerSettingModule
  44. import interfaceModule
  45.  
  46. import musicInfo
  47. import debugInfo
  48. import stringCommander
  49.  
  50. from _weakref import proxy
  51. # TEXTTAIL_LIVINGTIME_CONTROL
  52. #if localeInfo.IsJAPAN():
  53. #   app.SetTextTailLivingTime(8.0)
  54. # END_OF_TEXTTAIL_LIVINGTIME_CONTROL
  55.  
  56. # SCREENSHOT_CWDSAVE
  57. SCREENSHOT_CWDSAVE = False
  58. SCREENSHOT_DIR = None
  59.  
  60. if localeInfo.IsEUROPE():
  61.     SCREENSHOT_CWDSAVE = True
  62.  
  63. if localeInfo.IsCIBN10():
  64.     SCREENSHOT_CWDSAVE = False
  65.     SCREENSHOT_DIR = "YT2W"
  66.  
  67. cameraDistance = 1550.0
  68. cameraPitch = 27.0
  69. cameraRotation = 0.0
  70. cameraHeight = 100.0
  71.  
  72. testAlignment = 0
  73. BPisLoaded = 0
  74.  
  75. checagem = 0
  76. checagem2 = 0
  77. count_mind = 0
  78. time_counter = 0 ##45 segundos
  79. time_counter_on = 0
  80. time_counter_off = 0
  81.  
  82. class GameWindow(ui.ScriptWindow):
  83.     def __init__(self, stream):
  84.         ui.ScriptWindow.__init__(self, "GAME")
  85.         self.SetWindowName("game")
  86.         net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)
  87.         player.SetGameWindow(self) 
  88.  
  89.         self.quickSlotPageIndex = 0
  90.         self.lastPKModeSendedTime = 0
  91.         self.pressNumber = None
  92.  
  93.         self.guildWarQuestionDialog = None
  94.         self.interface = None
  95.         self.targetBoard = None
  96.         self.console = None
  97.         self.mapNameShower = None
  98.         self.affectShower = None
  99.         self.playerGauge = None
  100.  
  101.         self.stream=stream
  102.         self.interface = interfaceModule.Interface()
  103.         self.interface.MakeInterface()
  104.         self.interface.ShowDefaultWindows()
  105.  
  106.         self.curtain = uiPhaseCurtain.PhaseCurtain()
  107.         self.curtain.speed = 0.03
  108.         self.curtain.Hide()
  109.  
  110.         self.targetBoard = uiTarget.TargetBoard()
  111.         self.targetBoard.SetWhisperEvent(ui.__mem_func__(self.interface.OpenWhisperDialog))
  112.         self.targetBoard.Hide()
  113.  
  114.         self.console = consoleModule.ConsoleWindow()
  115.         self.console.BindGameClass(self)
  116.         self.console.SetConsoleSize(wndMgr.GetScreenWidth(), 200)
  117.         self.console.Hide()
  118.  
  119.         self.mapNameShower = uiMapNameShower.MapNameShower()
  120.         self.affectShower = uiAffectShower.AffectShower()
  121.  
  122.         self.playerGauge = uiPlayerGauge.PlayerGauge(self)
  123.         self.playerGauge.Hide()
  124.  
  125.         #wj 2014.1.2. ESCÅ°¸¦ ´©¸¦ ½Ã ¿ì¼±ÀûÀ¸·Î DropQuestionDialog¸¦ ²ôµµ·Ï ¸¸µé¾ú´Ù. ÇÏÁö¸¸ óÀ½¿¡ itemDropQuestionDialog°¡ ¼±¾ðµÇ¾î ÀÖÁö ¾Ê¾Æ ERROR°¡ ¹ß»ýÇÏ¿© init¿¡¼­ ¼±¾ð°ú µ¿½Ã¿¡ ÃʱâÈ­ ½ÃÅ´.
  126.         self.itemDropQuestionDialog = None
  127.  
  128.         self.__SetQuickSlotMode()
  129.  
  130.         self.__ServerCommand_Build()
  131.         self.__ProcessPreservedServerCommand()
  132.  
  133.     def __del__(self):
  134.         player.SetGameWindow(0)
  135.         net.ClearPhaseWindow(net.PHASE_WINDOW_GAME, self)
  136.         ui.ScriptWindow.__del__(self)
  137.  
  138.     def Open(self):
  139.         app.SetFrameSkip(1)
  140.  
  141.         self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  142.  
  143.         self.quickSlotPageIndex = 0
  144.         self.PickingCharacterIndex = -1
  145.         self.PickingItemIndex = -1
  146.         self.consoleEnable = False
  147.         self.isShowDebugInfo = False
  148.         self.ShowNameFlag = False
  149.  
  150.         self.enableXMasBoom = False
  151.         self.startTimeXMasBoom = 0.0
  152.         self.indexXMasBoom = 0
  153.  
  154.         global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  155.  
  156.         app.SetCamera(cameraDistance, cameraPitch, cameraRotation, cameraHeight)
  157.  
  158.         constInfo.SET_DEFAULT_CAMERA_MAX_DISTANCE()
  159.         constInfo.SET_DEFAULT_CHRNAME_COLOR()
  160.         constInfo.SET_DEFAULT_FOG_LEVEL()
  161.         constInfo.SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE()
  162.         constInfo.SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS()
  163.         constInfo.SET_DEFAULT_USE_SKILL_EFFECT_ENABLE()
  164.  
  165.         # TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  166.         constInfo.SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE()
  167.         # END_OF_TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  168.  
  169.         import event
  170.         event.SetLeftTimeString(localeInfo.UI_LEFT_TIME)
  171.  
  172.         textTail.EnablePKTitle(constInfo.PVPMODE_ENABLE)
  173.  
  174.         if constInfo.PVPMODE_TEST_ENABLE:
  175.             self.testPKMode = ui.TextLine()
  176.             self.testPKMode.SetFontName(localeInfo.UI_DEF_FONT)
  177.             self.testPKMode.SetPosition(0, 15)
  178.             self.testPKMode.SetWindowHorizontalAlignCenter()
  179.             self.testPKMode.SetHorizontalAlignCenter()
  180.             self.testPKMode.SetFeather()
  181.             self.testPKMode.SetOutline()
  182.             self.testPKMode.Show()
  183.  
  184.             self.testAlignment = ui.TextLine()
  185.             self.testAlignment.SetFontName(localeInfo.UI_DEF_FONT)
  186.             self.testAlignment.SetPosition(0, 35)
  187.             self.testAlignment.SetWindowHorizontalAlignCenter()
  188.             self.testAlignment.SetHorizontalAlignCenter()
  189.             self.testAlignment.SetFeather()
  190.             self.testAlignment.SetOutline()
  191.             self.testAlignment.Show()
  192.  
  193.         self.__BuildKeyDict()
  194.         self.__BuildDebugInfo()
  195.  
  196.         # PRIVATE_SHOP_PRICE_LIST
  197.         uiPrivateShopBuilder.Clear()
  198.         # END_OF_PRIVATE_SHOP_PRICE_LIST
  199.  
  200.         # UNKNOWN_UPDATE
  201.         exchange.InitTrading()
  202.         # END_OF_UNKNOWN_UPDATE
  203.  
  204.         if debugInfo.IsDebugMode():
  205.             self.ToggleDebugInfo()
  206.  
  207.         ## Sound
  208.         snd.SetMusicVolume(systemSetting.GetMusicVolume()*net.GetFieldMusicVolume())
  209.         snd.SetSoundVolume(systemSetting.GetSoundVolume())
  210.  
  211.         netFieldMusicFileName = net.GetFieldMusicFileName()
  212.         if netFieldMusicFileName:
  213.             snd.FadeInMusic("BGM/" + netFieldMusicFileName)
  214.         elif musicInfo.fieldMusic != "":                       
  215.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  216.  
  217.         self.__SetQuickSlotMode()
  218.         self.__SelectQuickPage(self.quickSlotPageIndex)
  219.  
  220.         self.SetFocus()
  221.         self.Show()
  222.         app.ShowCursor()
  223.  
  224.         net.SendEnterGamePacket()
  225.  
  226.         # START_GAME_ERROR_EXIT
  227.         try:
  228.             self.StartGame()
  229.         except:
  230.             import exception
  231.             exception.Abort("GameWindow.Open")
  232.         # END_OF_START_GAME_ERROR_EXIT
  233.        
  234.         # NPC°¡ Å¥ºê½Ã½ºÅÛÀ¸·Î ¸¸µé ¼ö ÀÖ´Â ¾ÆÀÌÅÛµéÀÇ ¸ñ·ÏÀ» ij½Ì
  235.         # ex) cubeInformation[20383] = [ {"rewordVNUM": 72723, "rewordCount": 1, "materialInfo": "101,1&102,2", "price": 999 }, ... ]
  236.         self.cubeInformation = {}
  237.         self.currentCubeNPC = 0
  238.        
  239.     def Close(self):
  240.         self.Hide()
  241.  
  242.         global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  243.         (cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
  244.  
  245.         if musicInfo.fieldMusic != "":
  246.             snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
  247.  
  248.         self.onPressKeyDict = None
  249.         self.onClickKeyDict = None
  250.  
  251.         chat.Close()
  252.         snd.StopAllSound()
  253.         grp.InitScreenEffect()
  254.         chr.Destroy()
  255.         textTail.Clear()
  256.         quest.Clear()
  257.         background.Destroy()
  258.         guild.Destroy()
  259.         messenger.Destroy()
  260.         skill.ClearSkillData()
  261.         wndMgr.Unlock()
  262.         mouseModule.mouseController.DeattachObject()
  263.  
  264.         if self.guildWarQuestionDialog:
  265.             self.guildWarQuestionDialog.Close()
  266.  
  267.         self.guildNameBoard = None
  268.         self.partyRequestQuestionDialog = None
  269.         self.partyInviteQuestionDialog = None
  270.         self.guildInviteQuestionDialog = None
  271.         self.guildWarQuestionDialog = None
  272.         self.messengerAddFriendQuestion = None
  273.  
  274.         # UNKNOWN_UPDATE
  275.         self.itemDropQuestionDialog = None
  276.         # END_OF_UNKNOWN_UPDATE
  277.  
  278.         # QUEST_CONFIRM
  279.         self.confirmDialog = None
  280.         # END_OF_QUEST_CONFIRM
  281.  
  282.         self.PrintCoord = None
  283.         self.FrameRate = None
  284.         self.Pitch = None
  285.         self.Splat = None
  286.         self.TextureNum = None
  287.         self.ObjectNum = None
  288.         self.ViewDistance = None
  289.         self.PrintMousePos = None
  290.  
  291.         self.ClearDictionary()
  292.  
  293.         self.playerGauge = None
  294.         self.mapNameShower = None
  295.         self.affectShower = None
  296.  
  297.         if self.console:
  298.             self.console.BindGameClass(0)
  299.             self.console.Close()
  300.             self.console=None
  301.        
  302.         if self.targetBoard:
  303.             self.targetBoard.Destroy()
  304.             self.targetBoard = None
  305.    
  306.         if self.interface:
  307.             self.interface.HideAllWindows()
  308.             self.interface.Close()
  309.             self.interface=None
  310.  
  311.         player.ClearSkillDict()
  312.         player.ResetCameraRotation()
  313.  
  314.         self.KillFocus()
  315.         app.HideCursor()
  316.  
  317.         print "---------------------------------------------------------------------------- CLOSE GAME WINDOW"
  318.  
  319.     def __BuildKeyDict(self):
  320.         onPressKeyDict = {}
  321.  
  322.         ##PressKey ´Â ´©¸£°í ÀÖ´Â µ¿¾È °è¼Ó Àû¿ëµÇ´Â Å°ÀÌ´Ù.
  323.        
  324.         ## ¼ýÀÚ ´ÜÃàÅ° Äü½½·Ô¿¡ ÀÌ¿ëµÈ´Ù.(ÀÌÈÄ ¼ýÀڵ鵵 Äü ½½·Ô¿ë ¿¹¾à)
  325.         ## F12 ´Â Ŭ¶ó µð¹ö±×¿ë Å°À̹ǷΠ¾²Áö ¾Ê´Â °Ô ÁÁ´Ù.
  326.         onPressKeyDict[app.DIK_1]   = lambda : self.__PressNumKey(1)
  327.         onPressKeyDict[app.DIK_2]   = lambda : self.__PressNumKey(2)
  328.         onPressKeyDict[app.DIK_3]   = lambda : self.__PressNumKey(3)
  329.         onPressKeyDict[app.DIK_4]   = lambda : self.__PressNumKey(4)
  330.         onPressKeyDict[app.DIK_5]   = lambda : self.__PressNumKey(5)
  331.         onPressKeyDict[app.DIK_6]   = lambda : self.__PressNumKey(6)
  332.         onPressKeyDict[app.DIK_7]   = lambda : self.__PressNumKey(7)
  333.         onPressKeyDict[app.DIK_8]   = lambda : self.__PressNumKey(8)
  334.         onPressKeyDict[app.DIK_9]   = lambda : self.__PressNumKey(9)
  335.         onPressKeyDict[app.DIK_F1]  = lambda : self.__PressQuickSlot(4)
  336.         onPressKeyDict[app.DIK_F2]  = lambda : self.__PressQuickSlot(5)
  337.         onPressKeyDict[app.DIK_F3]  = lambda : self.__PressQuickSlot(6)
  338.         onPressKeyDict[app.DIK_F4]  = lambda : self.__PressQuickSlot(7)
  339.         onPressKeyDict[app.DIK_P]   = lambda : self.__BonusPage()
  340.  
  341.         onPressKeyDict[app.DIK_LALT]        = lambda : self.ShowName()
  342.         onPressKeyDict[app.DIK_LCONTROL]    = lambda : self.ShowMouseImage()
  343.         onPressKeyDict[app.DIK_SYSRQ]       = lambda : self.SaveScreen()
  344.         onPressKeyDict[app.DIK_SPACE]       = lambda : self.StartAttack()
  345.  
  346.         #ij¸¯ÅÍ À̵¿Å°
  347.         onPressKeyDict[app.DIK_UP]          = lambda : self.MoveUp()
  348.         onPressKeyDict[app.DIK_DOWN]        = lambda : self.MoveDown()
  349.         onPressKeyDict[app.DIK_LEFT]        = lambda : self.MoveLeft()
  350.         onPressKeyDict[app.DIK_RIGHT]       = lambda : self.MoveRight()
  351.         onPressKeyDict[app.DIK_W]           = lambda : self.MoveUp()
  352.         onPressKeyDict[app.DIK_S]           = lambda : self.MoveDown()
  353.         onPressKeyDict[app.DIK_A]           = lambda : self.MoveLeft()
  354.         onPressKeyDict[app.DIK_D]           = lambda : self.MoveRight()
  355.  
  356.         onPressKeyDict[app.DIK_E]           = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
  357.         onPressKeyDict[app.DIK_R]           = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
  358.         #onPressKeyDict[app.DIK_F]          = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  359.         onPressKeyDict[app.DIK_T]           = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
  360.         onPressKeyDict[app.DIK_G]           = self.__PressGKey
  361.         onPressKeyDict[app.DIK_Q]           = self.__PressQKey
  362.  
  363.         onPressKeyDict[app.DIK_NUMPAD9]     = lambda: app.MovieResetCamera()
  364.         onPressKeyDict[app.DIK_NUMPAD4]     = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
  365.         onPressKeyDict[app.DIK_NUMPAD6]     = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)
  366.         onPressKeyDict[app.DIK_PGUP]        = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)
  367.         onPressKeyDict[app.DIK_PGDN]        = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
  368.         onPressKeyDict[app.DIK_NUMPAD8]     = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
  369.         onPressKeyDict[app.DIK_NUMPAD2]     = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
  370.         onPressKeyDict[app.DIK_GRAVE]       = lambda : self.PickUpItem()
  371.         onPressKeyDict[app.DIK_Z]           = lambda : self.PickUpItem()
  372.         onPressKeyDict[app.DIK_C]           = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
  373.         onPressKeyDict[app.DIK_V]           = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
  374.         #onPressKeyDict[app.DIK_B]          = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
  375.         onPressKeyDict[app.DIK_N]           = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
  376.         onPressKeyDict[app.DIK_I]           = lambda : self.interface.ToggleInventoryWindow()
  377.         onPressKeyDict[app.DIK_O]           = lambda : self.interface.ToggleDragonSoulWindowWithNoInfo()
  378.         onPressKeyDict[app.DIK_M]           = lambda : self.interface.PressMKey()
  379.         #onPressKeyDict[app.DIK_H]          = lambda : self.interface.OpenHelpWindow()
  380.         onPressKeyDict[app.DIK_ADD]         = lambda : self.interface.MiniMapScaleUp()
  381.         onPressKeyDict[app.DIK_SUBTRACT]    = lambda : self.interface.MiniMapScaleDown()
  382.         onPressKeyDict[app.DIK_L]           = lambda : self.interface.ToggleChatLogWindow()
  383.         onPressKeyDict[app.DIK_COMMA]       = lambda : self.ShowConsole()       # "`" key
  384.         onPressKeyDict[app.DIK_LSHIFT]      = lambda : self.__SetQuickPageMode()
  385.  
  386.         onPressKeyDict[app.DIK_J]           = lambda : self.__PressJKey()
  387.         onPressKeyDict[app.DIK_H]           = lambda : self.__PressHKey()
  388.         onPressKeyDict[app.DIK_B]           = lambda : self.__PressBKey()
  389.         onPressKeyDict[app.DIK_F]           = lambda : self.__PressFKey()
  390.  
  391.         # CUBE_TEST
  392.         #onPressKeyDict[app.DIK_K]          = lambda : self.interface.OpenCubeWindow()
  393.         # CUBE_TEST_END
  394.  
  395.         self.onPressKeyDict = onPressKeyDict
  396.  
  397.         onClickKeyDict = {}
  398.         onClickKeyDict[app.DIK_UP] = lambda : self.StopUp()
  399.         onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown()
  400.         onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft()
  401.         onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight()
  402.         onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack()
  403.  
  404.         onClickKeyDict[app.DIK_W] = lambda : self.StopUp()
  405.         onClickKeyDict[app.DIK_S] = lambda : self.StopDown()
  406.         onClickKeyDict[app.DIK_A] = lambda : self.StopLeft()
  407.         onClickKeyDict[app.DIK_D] = lambda : self.StopRight()
  408.         onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP)
  409.         onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP)
  410.         onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  411.         onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  412.         onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP)
  413.         onClickKeyDict[app.DIK_G] = lambda: self.__ReleaseGKey()
  414.         onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  415.         onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  416.         onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  417.         onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  418.         onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  419.         onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  420.         onClickKeyDict[app.DIK_LALT] = lambda: self.HideName()
  421.         onClickKeyDict[app.DIK_LCONTROL] = lambda: self.HideMouseImage()
  422.         onClickKeyDict[app.DIK_LSHIFT] = lambda: self.__SetQuickSlotMode()
  423.  
  424.         #if constInfo.PVPMODE_ACCELKEY_ENABLE:
  425.         #   onClickKeyDict[app.DIK_B] = lambda: self.ChangePKMode()
  426.  
  427.         self.onClickKeyDict=onClickKeyDict
  428.  
  429.     def __PressNumKey(self,num):
  430.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  431.            
  432.             if num >= 1 and num <= 9:
  433.                 if(chrmgr.IsPossibleEmoticon(-1)):             
  434.                     chrmgr.SetEmoticon(-1,int(num)-1)
  435.                     net.SendEmoticon(int(num)-1)
  436.         else:
  437.             if num >= 1 and num <= 4:
  438.                 self.pressNumber(num-1)
  439.  
  440.     def __ClickBKey(self):
  441.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  442.             return
  443.         else:
  444.             if constInfo.PVPMODE_ACCELKEY_ENABLE:
  445.                 self.ChangePKMode()
  446.  
  447.  
  448.     def __PressJKey(self):
  449.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  450.             if player.IsMountingHorse():
  451.                 net.SendChatPacket("/unmount")
  452.             else:
  453.                 #net.SendChatPacket("/user_horse_ride")
  454.                 if not uiPrivateShopBuilder.IsBuildingPrivateShop():
  455.                     for i in xrange(player.INVENTORY_PAGE_SIZE):
  456.                         if player.GetItemIndex(i) in (71114, 71116, 71118, 71120):
  457.                             net.SendItemUsePacket(i)
  458.                             break
  459.     def __PressHKey(self):
  460.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  461.             net.SendChatPacket("/user_horse_ride")
  462.         else:
  463.             self.interface.OpenHelpWindow()
  464.  
  465.     def __PressBKey(self):
  466.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  467.             net.SendChatPacket("/user_horse_back")
  468.         else:
  469.             state = "EMOTICON"
  470.             self.interface.ToggleCharacterWindow(state)
  471.  
  472.     def __PressFKey(self):
  473.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  474.             net.SendChatPacket("/user_horse_feed") 
  475.         else:
  476.             app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  477.  
  478.     def __PressGKey(self):
  479.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  480.             net.SendChatPacket("/ride")
  481.         else:
  482.             if self.ShowNameFlag:
  483.                 self.interface.ToggleGuildWindow()
  484.             else:
  485.                 app.PitchCamera(app.CAMERA_TO_POSITIVE)
  486.  
  487.     def __ReleaseGKey(self):
  488.         app.PitchCamera(app.CAMERA_STOP)
  489.  
  490.     def __PressQKey(self):
  491.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  492.             if 0==interfaceModule.IsQBHide:
  493.                 interfaceModule.IsQBHide = 1
  494.                 self.interface.HideAllQuestButton()
  495.             else:
  496.                 interfaceModule.IsQBHide = 0
  497.                 self.interface.ShowAllQuestButton()
  498.         else:
  499.             app.RotateCamera(app.CAMERA_TO_NEGATIVE)
  500.  
  501.     def __SetQuickSlotMode(self):
  502.         self.pressNumber=ui.__mem_func__(self.__PressQuickSlot)
  503.  
  504.     def __SetQuickPageMode(self):
  505.         self.pressNumber=ui.__mem_func__(self.__SelectQuickPage)
  506.  
  507.     def __PressQuickSlot(self, localSlotIndex):
  508.         if localeInfo.IsARABIC():
  509.             if 0 <= localSlotIndex and localSlotIndex < 4:
  510.                 player.RequestUseLocalQuickSlot(3-localSlotIndex)
  511.             else:
  512.                 player.RequestUseLocalQuickSlot(11-localSlotIndex)
  513.         else:
  514.             player.RequestUseLocalQuickSlot(localSlotIndex)        
  515.  
  516.     def __SelectQuickPage(self, pageIndex):
  517.         self.quickSlotPageIndex = pageIndex
  518.         player.SetQuickPage(pageIndex)
  519.  
  520.     def ToggleDebugInfo(self):
  521.         self.isShowDebugInfo = not self.isShowDebugInfo
  522.  
  523.  
  524.  
  525.     def __BuildDebugInfo(self):
  526.         ## Character Position Coordinate
  527.         self.PrintCoord = ui.TextLine()
  528.         self.PrintCoord.SetFontName(localeInfo.UI_DEF_FONT)
  529.         self.PrintCoord.SetPosition(wndMgr.GetScreenWidth() - 270, 0)
  530.        
  531.         ## Frame Rate
  532.         self.FrameRate = ui.TextLine()
  533.         self.FrameRate.SetFontName(localeInfo.UI_DEF_FONT)
  534.         self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
  535.  
  536.         ## Camera Pitch
  537.         self.Pitch = ui.TextLine()
  538.         self.Pitch.SetFontName(localeInfo.UI_DEF_FONT)
  539.         self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
  540.  
  541.         ## Splat
  542.         self.Splat = ui.TextLine()
  543.         self.Splat.SetFontName(localeInfo.UI_DEF_FONT)
  544.         self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
  545.        
  546.         ##
  547.         self.PrintMousePos = ui.TextLine()
  548.         self.PrintMousePos.SetFontName(localeInfo.UI_DEF_FONT)
  549.         self.PrintMousePos.SetPosition(wndMgr.GetScreenWidth() - 270, 80)
  550.  
  551.         # TextureNum
  552.         self.TextureNum = ui.TextLine()
  553.         self.TextureNum.SetFontName(localeInfo.UI_DEF_FONT)
  554.         self.TextureNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
  555.  
  556.         # ¿ÀºêÁ§Æ® ±×¸®´Â °³¼ö
  557.         self.ObjectNum = ui.TextLine()
  558.         self.ObjectNum.SetFontName(localeInfo.UI_DEF_FONT)
  559.         self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 120)
  560.  
  561.         # ½Ã¾ß°Å¸®
  562.         self.ViewDistance = ui.TextLine()
  563.         self.ViewDistance.SetFontName(localeInfo.UI_DEF_FONT)
  564.         self.ViewDistance.SetPosition(0, 0)
  565.  
  566.     def __NotifyError(self, msg):
  567.         chat.AppendChat(chat.CHAT_TYPE_INFO, msg)
  568.  
  569.     def ChangePKMode(self):
  570.  
  571.         if not app.IsPressed(app.DIK_LCONTROL):
  572.             return
  573.  
  574.         if player.GetStatus(player.LEVEL)<constInfo.PVPMODE_PROTECTED_LEVEL:
  575.             self.__NotifyError(localeInfo.OPTION_PVPMODE_PROTECT % (constInfo.PVPMODE_PROTECTED_LEVEL))
  576.             return
  577.  
  578.         curTime = app.GetTime()
  579.         if curTime - self.lastPKModeSendedTime < constInfo.PVPMODE_ACCELKEY_DELAY:
  580.             return
  581.  
  582.         self.lastPKModeSendedTime = curTime
  583.  
  584.         curPKMode = player.GetPKMode()
  585.         nextPKMode = curPKMode + 1
  586.         if nextPKMode == player.PK_MODE_PROTECT:
  587.             if 0 == player.GetGuildID():
  588.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
  589.                 nextPKMode = 0
  590.             else:
  591.                 nextPKMode = player.PK_MODE_GUILD
  592.  
  593.         elif nextPKMode == player.PK_MODE_MAX_NUM:
  594.             nextPKMode = 0
  595.  
  596.         net.SendChatPacket("/PKMode " + str(nextPKMode))
  597.         print "/PKMode " + str(nextPKMode)
  598.  
  599.     def OnChangePKMode(self):
  600.  
  601.         self.interface.OnChangePKMode()
  602.  
  603.         try:
  604.             self.__NotifyError(localeInfo.OPTION_PVPMODE_MESSAGE_DICT[player.GetPKMode()])
  605.         except KeyError:
  606.             print "UNKNOWN PVPMode[%d]" % (player.GetPKMode())
  607.  
  608.         if constInfo.PVPMODE_TEST_ENABLE:
  609.             curPKMode = player.GetPKMode()
  610.             alignment, grade = chr.testGetPKData()
  611.             self.pkModeNameDict = { 0 : "PEACE", 1 : "REVENGE", 2 : "FREE", 3 : "PROTECT", }
  612.             self.testPKMode.SetText("Current PK Mode : " + self.pkModeNameDict.get(curPKMode, "UNKNOWN"))
  613.             self.testAlignment.SetText("Current Alignment : " + str(alignment) + " (" + localeInfo.TITLE_NAME_LIST[grade] + ")")
  614.  
  615.     ###############################################################################################
  616.     ###############################################################################################
  617.     ## Game Callback Functions
  618.  
  619.     # Start
  620.     def StartGame(self):
  621.         self.RefreshInventory()
  622.         self.RefreshEquipment()
  623.         self.RefreshCharacter()
  624.         self.RefreshSkill()
  625.  
  626.     # Refresh
  627.     def CheckGameButton(self):
  628.         if self.interface:
  629.             self.interface.CheckGameButton()
  630.  
  631.     def RefreshAlignment(self):
  632.         self.interface.RefreshAlignment()
  633.  
  634.     def RefreshStatus(self):
  635.         self.CheckGameButton()
  636.  
  637.         if self.interface:
  638.             self.interface.RefreshStatus()
  639.  
  640.         if self.playerGauge:
  641.             self.playerGauge.RefreshGauge()
  642.  
  643.     def RefreshStamina(self):
  644.         self.interface.RefreshStamina()
  645.  
  646.     def RefreshSkill(self):
  647.         self.CheckGameButton()
  648.         if self.interface:
  649.             self.interface.RefreshSkill()
  650.  
  651.     def RefreshQuest(self):
  652.         self.interface.RefreshQuest()
  653.  
  654.     def RefreshMessenger(self):
  655.         self.interface.RefreshMessenger()
  656.  
  657.     def RefreshGuildInfoPage(self):
  658.         self.interface.RefreshGuildInfoPage()
  659.  
  660.     def RefreshGuildBoardPage(self):
  661.         self.interface.RefreshGuildBoardPage()
  662.  
  663.     def RefreshGuildMemberPage(self):
  664.         self.interface.RefreshGuildMemberPage()
  665.  
  666.     def RefreshGuildMemberPageGradeComboBox(self):
  667.         self.interface.RefreshGuildMemberPageGradeComboBox()
  668.  
  669.     def RefreshGuildSkillPage(self):
  670.         self.interface.RefreshGuildSkillPage()
  671.  
  672.     def RefreshGuildGradePage(self):
  673.         self.interface.RefreshGuildGradePage()
  674.  
  675.     def RefreshMobile(self):
  676.         if self.interface:
  677.             self.interface.RefreshMobile()
  678.  
  679.     def OnMobileAuthority(self):
  680.         self.interface.OnMobileAuthority()
  681.  
  682.     def OnBlockMode(self, mode):
  683.         self.interface.OnBlockMode(mode)
  684.  
  685.     def OpenQuestWindow(self, skin, idx):
  686.         self.interface.OpenQuestWindow(skin, idx)
  687.  
  688.     def AskGuildName(self):
  689.  
  690.         guildNameBoard = uiCommon.InputDialog()
  691.         guildNameBoard.SetTitle(localeInfo.GUILD_NAME)
  692.         guildNameBoard.SetAcceptEvent(ui.__mem_func__(self.ConfirmGuildName))
  693.         guildNameBoard.SetCancelEvent(ui.__mem_func__(self.CancelGuildName))
  694.         guildNameBoard.Open()
  695.  
  696.         self.guildNameBoard = guildNameBoard
  697.  
  698.     def ConfirmGuildName(self):
  699.         guildName = self.guildNameBoard.GetText()
  700.         if not guildName:
  701.             return
  702.  
  703.         if net.IsInsultIn(guildName):
  704.             self.PopupMessage(localeInfo.GUILD_CREATE_ERROR_INSULT_NAME)
  705.             return
  706.  
  707.         net.SendAnswerMakeGuildPacket(guildName)
  708.         self.guildNameBoard.Close()
  709.         self.guildNameBoard = None
  710.         return True
  711.  
  712.     def CancelGuildName(self):
  713.         self.guildNameBoard.Close()
  714.         self.guildNameBoard = None
  715.         return True
  716.  
  717.     ## Refine
  718.     def PopupMessage(self, msg):
  719.         self.stream.popupWindow.Close()
  720.         self.stream.popupWindow.Open(msg, 0, localeInfo.UI_OK)
  721.  
  722.     def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type=0):
  723.         self.interface.OpenRefineDialog(targetItemPos, nextGradeItemVnum, cost, prob, type)
  724.  
  725.     def AppendMaterialToRefineDialog(self, vnum, count):
  726.         self.interface.AppendMaterialToRefineDialog(vnum, count)
  727.  
  728.     def RunUseSkillEvent(self, slotIndex, coolTime):
  729.         self.interface.OnUseSkill(slotIndex, coolTime)
  730.  
  731.     def ClearAffects(self):
  732.         self.affectShower.ClearAffects()
  733.  
  734.     def SetAffect(self, affect):
  735.         self.affectShower.SetAffect(affect)
  736.  
  737.     def ResetAffect(self, affect):
  738.         self.affectShower.ResetAffect(affect)
  739.  
  740.     # UNKNOWN_UPDATE
  741.     def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  742.         self.affectShower.BINARY_NEW_AddAffect(type, pointIdx, value, duration)
  743.         if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  744.             self.interface.DragonSoulActivate(type - chr.NEW_AFFECT_DRAGON_SOUL_DECK1)
  745.         elif chr.NEW_AFFECT_DRAGON_SOUL_QUALIFIED == type:
  746.             self.BINARY_DragonSoulGiveQuilification()
  747.  
  748.     def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  749.         self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  750.         if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  751.             self.interface.DragonSoulDeactivate()
  752.    
  753.  
  754.  
  755.     # END_OF_UNKNOWN_UPDATE
  756.  
  757.     def ActivateSkillSlot(self, slotIndex):
  758.         if self.interface:
  759.             self.interface.OnActivateSkill(slotIndex)
  760.  
  761.     def DeactivateSkillSlot(self, slotIndex):
  762.         if self.interface:
  763.             self.interface.OnDeactivateSkill(slotIndex)
  764.  
  765.     def RefreshEquipment(self):
  766.         if self.interface:
  767.             self.interface.RefreshInventory()
  768.  
  769.     def RefreshInventory(self):
  770.         if self.interface:
  771.             self.interface.RefreshInventory()
  772.  
  773.     def RefreshCharacter(self):
  774.         if self.interface:
  775.             self.interface.RefreshCharacter()
  776.  
  777.     def OnGameOver(self):
  778.         self.CloseTargetBoard()
  779.         self.OpenRestartDialog()
  780.  
  781.     def OpenRestartDialog(self):
  782.         self.interface.OpenRestartDialog()
  783.  
  784.     def ChangeCurrentSkill(self, skillSlotNumber):
  785.         self.interface.OnChangeCurrentSkill(skillSlotNumber)
  786.  
  787.     ## TargetBoard
  788.     def SetPCTargetBoard(self, vid, name):
  789.         self.targetBoard.Open(vid, name)
  790.        
  791.         if app.IsPressed(app.DIK_LCONTROL):
  792.            
  793.             if not player.IsSameEmpire(vid):
  794.                 return
  795.  
  796.             if player.IsMainCharacterIndex(vid):
  797.                 return     
  798.             elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(vid):
  799.                 return
  800.  
  801.             self.interface.OpenWhisperDialog(name)
  802.            
  803.  
  804.     def RefreshTargetBoardByVID(self, vid):
  805.         self.targetBoard.RefreshByVID(vid)
  806.  
  807.     def RefreshTargetBoardByName(self, name):
  808.         self.targetBoard.RefreshByName(name)
  809.        
  810.     def __RefreshTargetBoard(self):
  811.         self.targetBoard.Refresh()
  812.        
  813.     def SetHPTargetBoard(self, vid, hpPercentage):
  814.         if vid != self.targetBoard.GetTargetVID():
  815.             self.targetBoard.ResetTargetBoard()
  816.             self.targetBoard.SetEnemyVID(vid)
  817.  
  818.         self.targetBoard.SetHP(hpPercentage)
  819.         self.targetBoard.Show()
  820.  
  821.     def CloseTargetBoardIfDifferent(self, vid):
  822.         if vid != self.targetBoard.GetTargetVID():
  823.             self.targetBoard.Close()
  824.  
  825.     def CloseTargetBoard(self):
  826.         self.targetBoard.Close()
  827.  
  828.     ## View Equipment
  829.     def OpenEquipmentDialog(self, vid):
  830.         self.interface.OpenEquipmentDialog(vid)
  831.  
  832.     def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
  833.         self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
  834.  
  835.     def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
  836.         self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
  837.  
  838.     def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
  839.         self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
  840.  
  841.     # SHOW_LOCAL_MAP_NAME
  842.     def ShowMapName(self, mapName, x, y):
  843.  
  844.         if self.mapNameShower:
  845.             self.mapNameShower.ShowMapName(mapName, x, y)
  846.  
  847.         if self.interface:
  848.             self.interface.SetMapName(mapName)
  849.     # END_OF_SHOW_LOCAL_MAP_NAME   
  850.  
  851.     def BINARY_OpenAtlasWindow(self):
  852.         self.interface.BINARY_OpenAtlasWindow()
  853.  
  854.     ## Chat
  855.     def OnRecvWhisper(self, mode, name, line):
  856.         if mode == chat.WHISPER_TYPE_GM:
  857.             self.interface.RegisterGameMasterName(name)
  858.         chat.AppendWhisper(mode, name, line)
  859.         self.interface.RecvWhisper(name)
  860.  
  861.     def OnRecvWhisperSystemMessage(self, mode, name, line):
  862.         chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
  863.         self.interface.RecvWhisper(name)
  864.  
  865.     def OnRecvWhisperError(self, mode, name, line):
  866.         if localeInfo.WHISPER_ERROR.has_key(mode):
  867.             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name))
  868.         else:
  869.             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
  870.         self.interface.RecvWhisper(name)
  871.  
  872.     def RecvWhisper(self, name):
  873.         self.interface.RecvWhisper(name)
  874.  
  875.     def OnPickMoney(self, money):
  876.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_PICK_MONEY % (money))
  877.  
  878.     def OnShopError(self, type):
  879.         try:
  880.             self.PopupMessage(localeInfo.SHOP_ERROR_DICT[type])
  881.         except KeyError:
  882.             self.PopupMessage(localeInfo.SHOP_ERROR_UNKNOWN % (type))
  883.  
  884.     def OnSafeBoxError(self):
  885.         self.PopupMessage(localeInfo.SAFEBOX_ERROR)
  886.  
  887.     def OnFishingSuccess(self, isFish, fishName):
  888.         chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_SUCCESS(isFish, fishName), 2000)
  889.  
  890.     # ADD_FISHING_MESSAGE
  891.     def OnFishingNotifyUnknown(self):
  892.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_UNKNOWN)
  893.  
  894.     def OnFishingWrongPlace(self):
  895.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_WRONG_PLACE)
  896.     # END_OF_ADD_FISHING_MESSAGE
  897.  
  898.     def OnFishingNotify(self, isFish, fishName):
  899.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_NOTIFY(isFish, fishName))
  900.  
  901.     def OnFishingFailure(self):
  902.         chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_FAILURE, 2000)
  903.  
  904.     def OnCannotPickItem(self):
  905.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_PICK_ITEM)
  906.  
  907.     # MINING
  908.     def OnCannotMining(self):
  909.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_MINING)
  910.     # END_OF_MINING
  911.  
  912.     def OnCannotUseSkill(self, vid, type):
  913.         if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
  914.             textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type])
  915.  
  916.         if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
  917.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type])
  918.  
  919.     def OnCannotShotError(self, vid, type):
  920.         textTail.RegisterInfoTail(vid, localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type)))
  921.  
  922.     ## PointReset
  923.     def StartPointReset(self):
  924.         self.interface.OpenPointResetDialog()
  925.  
  926.     ## Shop
  927.     def StartShop(self, vid):
  928.         self.interface.OpenShopDialog(vid)
  929.  
  930.     def EndShop(self):
  931.         self.interface.CloseShopDialog()
  932.  
  933.     def RefreshShop(self):
  934.         self.interface.RefreshShopDialog()
  935.  
  936.     def SetShopSellingPrice(self, Price):
  937.         pass
  938.  
  939.     ## Exchange
  940.     def StartExchange(self):
  941.         self.interface.StartExchange()
  942.  
  943.     def EndExchange(self):
  944.         self.interface.EndExchange()
  945.  
  946.     def RefreshExchange(self):
  947.         self.interface.RefreshExchange()
  948.  
  949.     ## Party
  950.     def RecvPartyInviteQuestion(self, leaderVID, leaderName):
  951.         partyInviteQuestionDialog = uiCommon.QuestionDialog()
  952.         partyInviteQuestionDialog.SetText(leaderName + localeInfo.PARTY_DO_YOU_JOIN)
  953.         partyInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerPartyInvite(arg))
  954.         partyInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerPartyInvite(arg))
  955.         partyInviteQuestionDialog.Open()
  956.         partyInviteQuestionDialog.partyLeaderVID = leaderVID
  957.         self.partyInviteQuestionDialog = partyInviteQuestionDialog
  958.  
  959.     def AnswerPartyInvite(self, answer):
  960.  
  961.         if not self.partyInviteQuestionDialog:
  962.             return
  963.  
  964.         partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
  965.  
  966.         distance = player.GetCharacterDistance(partyLeaderVID)
  967.         if distance < 0.0 or distance > 5000:
  968.             answer = False
  969.  
  970.         net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
  971.  
  972.         self.partyInviteQuestionDialog.Close()
  973.         self.partyInviteQuestionDialog = None
  974.  
  975.     def AddPartyMember(self, pid, name):
  976.         self.interface.AddPartyMember(pid, name)
  977.  
  978.     def UpdatePartyMemberInfo(self, pid):
  979.         self.interface.UpdatePartyMemberInfo(pid)
  980.  
  981.     def RemovePartyMember(self, pid):
  982.         self.interface.RemovePartyMember(pid)
  983.         self.__RefreshTargetBoard()
  984.  
  985.     def LinkPartyMember(self, pid, vid):
  986.         self.interface.LinkPartyMember(pid, vid)
  987.  
  988.     def UnlinkPartyMember(self, pid):
  989.         self.interface.UnlinkPartyMember(pid)
  990.  
  991.     def UnlinkAllPartyMember(self):
  992.         self.interface.UnlinkAllPartyMember()
  993.  
  994.     def ExitParty(self):
  995.         self.interface.ExitParty()
  996.         self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID())
  997.  
  998.     def ChangePartyParameter(self, distributionMode):
  999.         self.interface.ChangePartyParameter(distributionMode)
  1000.  
  1001.     ## Messenger
  1002.     def OnMessengerAddFriendQuestion(self, name):
  1003.         messengerAddFriendQuestion = uiCommon.QuestionDialog2()
  1004.         messengerAddFriendQuestion.SetText1(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
  1005.         messengerAddFriendQuestion.SetText2(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2)
  1006.         messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend))
  1007.         messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend))
  1008.         messengerAddFriendQuestion.Open()
  1009.         messengerAddFriendQuestion.name = name
  1010.         self.messengerAddFriendQuestion = messengerAddFriendQuestion
  1011.  
  1012.     def OnAcceptAddFriend(self):
  1013.         name = self.messengerAddFriendQuestion.name
  1014.         net.SendChatPacket("/messenger_auth y " + name)
  1015.         self.OnCloseAddFriendQuestionDialog()
  1016.         return True
  1017.  
  1018.     def OnDenyAddFriend(self):
  1019.         name = self.messengerAddFriendQuestion.name
  1020.         net.SendChatPacket("/messenger_auth n " + name)
  1021.         self.OnCloseAddFriendQuestionDialog()
  1022.         return True
  1023.  
  1024.     def OnCloseAddFriendQuestionDialog(self):
  1025.         self.messengerAddFriendQuestion.Close()
  1026.         self.messengerAddFriendQuestion = None
  1027.         return True
  1028.  
  1029.     ## SafeBox
  1030.     def OpenSafeboxWindow(self, size):
  1031.         self.interface.OpenSafeboxWindow(size)
  1032.  
  1033.     def RefreshSafebox(self):
  1034.         self.interface.RefreshSafebox()
  1035.  
  1036.     def RefreshSafeboxMoney(self):
  1037.         self.interface.RefreshSafeboxMoney()
  1038.  
  1039.     # ITEM_MALL
  1040.     def OpenMallWindow(self, size):
  1041.         self.interface.OpenMallWindow(size)
  1042.  
  1043.     def RefreshMall(self):
  1044.         self.interface.RefreshMall()
  1045.     # END_OF_ITEM_MALL
  1046.  
  1047.     ## Guild
  1048.     def RecvGuildInviteQuestion(self, guildID, guildName):
  1049.         guildInviteQuestionDialog = uiCommon.QuestionDialog()
  1050.         guildInviteQuestionDialog.SetText(guildName + localeInfo.GUILD_DO_YOU_JOIN)
  1051.         guildInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerGuildInvite(arg))
  1052.         guildInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerGuildInvite(arg))
  1053.         guildInviteQuestionDialog.Open()
  1054.         guildInviteQuestionDialog.guildID = guildID
  1055.         self.guildInviteQuestionDialog = guildInviteQuestionDialog
  1056.  
  1057.     def AnswerGuildInvite(self, answer):
  1058.  
  1059.         if not self.guildInviteQuestionDialog:
  1060.             return
  1061.  
  1062.         guildLeaderVID = self.guildInviteQuestionDialog.guildID
  1063.         net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
  1064.  
  1065.         self.guildInviteQuestionDialog.Close()
  1066.         self.guildInviteQuestionDialog = None
  1067.  
  1068.    
  1069.     def DeleteGuild(self):
  1070.         self.interface.DeleteGuild()
  1071.  
  1072.     ## Clock
  1073.     def ShowClock(self, second):
  1074.         self.interface.ShowClock(second)
  1075.  
  1076.     def HideClock(self):
  1077.         self.interface.HideClock()
  1078.  
  1079.     ## Emotion
  1080.     def BINARY_ActEmotion(self, emotionIndex):
  1081.         if self.interface.wndCharacter:
  1082.             self.interface.wndCharacter.ActEmotion(emotionIndex)
  1083.  
  1084.     ###############################################################################################
  1085.     ###############################################################################################
  1086.     ## Keyboard Functions
  1087.  
  1088.     def CheckFocus(self):
  1089.         if False == self.IsFocus():
  1090.             if True == self.interface.IsOpenChat():
  1091.                 self.interface.ToggleChat()
  1092.  
  1093.             self.SetFocus()
  1094.  
  1095.     def SaveScreen(self):
  1096.         print "save screen"
  1097.  
  1098.         # SCREENSHOT_CWDSAVE
  1099.         if SCREENSHOT_CWDSAVE:
  1100.             if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
  1101.                 os.mkdir(os.getcwd()+os.sep+"screenshot")
  1102.  
  1103.             (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep)
  1104.         elif SCREENSHOT_DIR:
  1105.             (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
  1106.         else:
  1107.             (succeeded, name) = grp.SaveScreenShot()
  1108.         # END_OF_SCREENSHOT_CWDSAVE
  1109.  
  1110.         if succeeded:
  1111.             pass
  1112.             """
  1113.             chat.AppendChat(chat.CHAT_TYPE_INFO, name + localeInfo.SCREENSHOT_SAVE1)
  1114.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE2)
  1115.             """
  1116.         else:
  1117.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE_FAILURE)
  1118.  
  1119.     def ShowConsole(self):
  1120.         if debugInfo.IsDebugMode() or True == self.consoleEnable:
  1121.             player.EndKeyWalkingImmediately()
  1122.             self.console.OpenWindow()
  1123.  
  1124.     def ShowName(self):
  1125.         self.ShowNameFlag = True
  1126.         self.playerGauge.EnableShowAlways()
  1127.         player.SetQuickPage(self.quickSlotPageIndex+1)
  1128.  
  1129.     # ADD_ALWAYS_SHOW_NAME
  1130.     def __IsShowName(self):
  1131.  
  1132.         if systemSetting.IsAlwaysShowName():
  1133.             return True
  1134.  
  1135.         if self.ShowNameFlag:
  1136.             return True
  1137.  
  1138.         return False
  1139.     # END_OF_ADD_ALWAYS_SHOW_NAME
  1140.    
  1141.     def HideName(self):
  1142.         self.ShowNameFlag = False
  1143.         self.playerGauge.DisableShowAlways()
  1144.         player.SetQuickPage(self.quickSlotPageIndex)
  1145.  
  1146.     def ShowMouseImage(self):
  1147.         self.interface.ShowMouseImage()
  1148.  
  1149.     def HideMouseImage(self):
  1150.         self.interface.HideMouseImage()
  1151.  
  1152.     def StartAttack(self):
  1153.         player.SetAttackKeyState(True)
  1154.  
  1155.     def EndAttack(self):
  1156.         player.SetAttackKeyState(False)
  1157.  
  1158.     def MoveUp(self):
  1159.         player.SetSingleDIKKeyState(app.DIK_UP, True)
  1160.  
  1161.     def MoveDown(self):
  1162.         player.SetSingleDIKKeyState(app.DIK_DOWN, True)
  1163.  
  1164.     def MoveLeft(self):
  1165.         player.SetSingleDIKKeyState(app.DIK_LEFT, True)
  1166.  
  1167.     def MoveRight(self):
  1168.         player.SetSingleDIKKeyState(app.DIK_RIGHT, True)
  1169.  
  1170.     def StopUp(self):
  1171.         player.SetSingleDIKKeyState(app.DIK_UP, False)
  1172.  
  1173.     def StopDown(self):
  1174.         player.SetSingleDIKKeyState(app.DIK_DOWN, False)
  1175.  
  1176.     def StopLeft(self):
  1177.         player.SetSingleDIKKeyState(app.DIK_LEFT, False)
  1178.  
  1179.     def StopRight(self):
  1180.         player.SetSingleDIKKeyState(app.DIK_RIGHT, False)
  1181.  
  1182.     def PickUpItem(self):
  1183.         player.PickCloseItem()
  1184.  
  1185.     ###############################################################################################
  1186.     ###############################################################################################
  1187.     ## Event Handler
  1188.  
  1189.     def OnKeyDown(self, key):
  1190.         if self.interface.wndWeb and self.interface.wndWeb.IsShow():
  1191.             return
  1192.  
  1193.         if key == app.DIK_ESC:
  1194.             self.RequestDropItem(FALSE)
  1195.             constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
  1196.  
  1197.         try:
  1198.             self.onPressKeyDict[key]()
  1199.         except KeyError:
  1200.             pass
  1201.         except:
  1202.             raise
  1203.  
  1204.         return TRUE
  1205.  
  1206.     def OnKeyUp(self, key):
  1207.         try:
  1208.             self.onClickKeyDict[key]()
  1209.         except KeyError:
  1210.             pass
  1211.         except:
  1212.             raise
  1213.  
  1214.         return True
  1215.  
  1216.     def OnMouseLeftButtonDown(self):
  1217.         if self.interface.BUILD_OnMouseLeftButtonDown():
  1218.             return
  1219.  
  1220.         if mouseModule.mouseController.isAttached():
  1221.             self.CheckFocus()
  1222.         else:
  1223.             hyperlink = ui.GetHyperlink()
  1224.             if hyperlink:
  1225.                 return
  1226.             else:
  1227.                 self.CheckFocus()
  1228.                 player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  1229.  
  1230.         return True
  1231.  
  1232.     def OnMouseLeftButtonUp(self):
  1233.  
  1234.         if self.interface.BUILD_OnMouseLeftButtonUp():
  1235.             return
  1236.  
  1237.         if mouseModule.mouseController.isAttached():
  1238.  
  1239.             attachedType = mouseModule.mouseController.GetAttachedType()
  1240.             attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1241.             attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1242.             attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1243.  
  1244.             ## QuickSlot
  1245.             if player.SLOT_TYPE_QUICK_SLOT == attachedType:
  1246.                 player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)
  1247.  
  1248.             ## Inventory
  1249.             elif player.SLOT_TYPE_INVENTORY == attachedType:
  1250.  
  1251.                 if player.ITEM_MONEY == attachedItemIndex:
  1252.                     self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1253.                 else:
  1254.                     self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1255.  
  1256.             ## DragonSoul
  1257.             elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1258.                 self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1259.            
  1260.             mouseModule.mouseController.DeattachObject()
  1261.  
  1262.         else:
  1263.             hyperlink = ui.GetHyperlink()
  1264.             if hyperlink:
  1265.                 if app.IsPressed(app.DIK_LALT):
  1266.                     link = chat.GetLinkFromHyperlink(hyperlink)
  1267.                     ime.PasteString(link)
  1268.                 else:
  1269.                     self.interface.MakeHyperlinkTooltip(hyperlink)
  1270.                 return
  1271.             else:
  1272.                 player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  1273.  
  1274.         #player.EndMouseWalking()
  1275.         return True
  1276.  
  1277.     def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
  1278.         if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1279.             attachedInvenType = player.SlotTypeToInvenType(attachedType)
  1280.             if True == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1281.                 if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType:
  1282.                     self.stream.popupWindow.Close()
  1283.                     self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1284.                 else:
  1285.                     if chr.IsNPC(dstChrID):
  1286.                         net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1287.                     else:
  1288.                         net.SendExchangeStartPacket(dstChrID)
  1289.                         net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1290.             else:
  1291.                 self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1292.  
  1293.     def __PutMoney(self, attachedType, attachedMoney, dstChrID):
  1294.         if True == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1295.             net.SendExchangeStartPacket(dstChrID)
  1296.             net.SendExchangeElkAddPacket(attachedMoney)
  1297.         else:
  1298.             self.__DropMoney(attachedType, attachedMoney)
  1299.  
  1300.     def __DropMoney(self, attachedType, attachedMoney):
  1301.         # PRIVATESHOP_DISABLE_ITEM_DROP - °³ÀλóÁ¡ ¿­°í ÀÖ´Â µ¿¾È ¾ÆÀÌÅÛ ¹ö¸² ¹æÁö
  1302.         if uiPrivateShopBuilder.IsBuildingPrivateShop():           
  1303.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1304.             return
  1305.         # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1306.        
  1307.         if attachedMoney>=1000:
  1308.             self.stream.popupWindow.Close()
  1309.             self.stream.popupWindow.Open(localeInfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeInfo.UI_OK)
  1310.             return
  1311.  
  1312.         itemDropQuestionDialog = uiCommon.QuestionDialog()
  1313.         itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_MONEY % (attachedMoney))
  1314.         itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1315.         itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1316.         itemDropQuestionDialog.Open()
  1317.         itemDropQuestionDialog.dropType = attachedType
  1318.         itemDropQuestionDialog.dropCount = attachedMoney
  1319.         itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
  1320.         self.itemDropQuestionDialog = itemDropQuestionDialog
  1321.  
  1322.     def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
  1323.         # PRIVATESHOP_DISABLE_ITEM_DROP - °³ÀλóÁ¡ ¿­°í ÀÖ´Â µ¿¾È ¾ÆÀÌÅÛ ¹ö¸² ¹æÁö
  1324.         if uiPrivateShopBuilder.IsBuildingPrivateShop():           
  1325.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1326.             return
  1327.         # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1328.        
  1329.         if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos):
  1330.             self.stream.popupWindow.Close()
  1331.             self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1332.  
  1333.         else:
  1334.             if player.SLOT_TYPE_INVENTORY == attachedType:
  1335.                 dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
  1336.  
  1337.                 item.SelectItem(dropItemIndex)
  1338.                 dropItemName = item.GetItemName()
  1339.  
  1340.                 ## Question Text
  1341.                 questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1342.  
  1343.                 ## Dialog
  1344.                 itemDropQuestionDialog = uiCommon.QuestionDialog()
  1345.                 itemDropQuestionDialog.SetText(questionText)
  1346.                 itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1347.                 itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1348.                 itemDropQuestionDialog.Open()
  1349.                 itemDropQuestionDialog.dropType = attachedType
  1350.                 itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1351.                 itemDropQuestionDialog.dropCount = attachedItemCount
  1352.                 self.itemDropQuestionDialog = itemDropQuestionDialog
  1353.  
  1354.                 constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
  1355.             elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1356.                 dropItemIndex = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, attachedItemSlotPos)
  1357.  
  1358.                 item.SelectItem(dropItemIndex)
  1359.                 dropItemName = item.GetItemName()
  1360.  
  1361.                 ## Question Text
  1362.                 questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1363.  
  1364.                 ## Dialog
  1365.                 itemDropQuestionDialog = uiCommon.QuestionDialog()
  1366.                 itemDropQuestionDialog.SetText(questionText)
  1367.                 itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1368.                 itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1369.                 itemDropQuestionDialog.Open()
  1370.                 itemDropQuestionDialog.dropType = attachedType
  1371.                 itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1372.                 itemDropQuestionDialog.dropCount = attachedItemCount
  1373.                 self.itemDropQuestionDialog = itemDropQuestionDialog
  1374.  
  1375.                 constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
  1376.  
  1377.     def RequestDropItem(self, answer):
  1378.         if not self.itemDropQuestionDialog:
  1379.             return
  1380.  
  1381.         if answer:
  1382.             dropType = self.itemDropQuestionDialog.dropType
  1383.             dropCount = self.itemDropQuestionDialog.dropCount
  1384.             dropNumber = self.itemDropQuestionDialog.dropNumber
  1385.  
  1386.             if player.SLOT_TYPE_INVENTORY == dropType:
  1387.                 if dropNumber == player.ITEM_MONEY:
  1388.                     net.SendGoldDropPacketNew(dropCount)
  1389.                     snd.PlaySound("sound/ui/money.wav")
  1390.                 else:
  1391.                     # PRIVATESHOP_DISABLE_ITEM_DROP
  1392.                     self.__SendDropItemPacket(dropNumber, dropCount)
  1393.                     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1394.             elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == dropType:
  1395.                     # PRIVATESHOP_DISABLE_ITEM_DROP
  1396.                     self.__SendDropItemPacket(dropNumber, dropCount, player.DRAGON_SOUL_INVENTORY)
  1397.                     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1398.  
  1399.         self.itemDropQuestionDialog.Close()
  1400.         self.itemDropQuestionDialog = None
  1401.  
  1402.         constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
  1403.  
  1404.     # PRIVATESHOP_DISABLE_ITEM_DROP
  1405.     def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
  1406.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1407.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1408.             return
  1409.  
  1410.         net.SendItemDropPacketNew(itemInvenType, itemVNum, itemCount)
  1411.     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1412.  
  1413.     def OnMouseRightButtonDown(self):
  1414.  
  1415.         self.CheckFocus()
  1416.  
  1417.         if True == mouseModule.mouseController.isAttached():
  1418.             mouseModule.mouseController.DeattachObject()
  1419.  
  1420.         else:
  1421.             player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
  1422.  
  1423.         return True
  1424.  
  1425.     def OnMouseRightButtonUp(self):
  1426.         if True == mouseModule.mouseController.isAttached():
  1427.             return True
  1428.  
  1429.         player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
  1430.         return True
  1431.  
  1432.     def OnMouseMiddleButtonDown(self):
  1433.         player.SetMouseMiddleButtonState(player.MBS_PRESS)
  1434.  
  1435.     def OnMouseMiddleButtonUp(self):
  1436.         player.SetMouseMiddleButtonState(player.MBS_CLICK)
  1437.  
  1438.     def OnUpdate(self):
  1439.         app.UpdateGame()
  1440.        
  1441.         if self.mapNameShower.IsShow():
  1442.             self.mapNameShower.Update()
  1443.  
  1444.         if self.isShowDebugInfo:
  1445.             self.UpdateDebugInfo()
  1446.  
  1447.         if self.enableXMasBoom:
  1448.             self.__XMasBoom_Update()
  1449.  
  1450.         self.interface.BUILD_OnUpdate()
  1451.        
  1452.        
  1453.     def UpdateDebugInfo(self):
  1454.         #
  1455.         # ij¸¯ÅÍ ÁÂÇ¥ ¹× FPS Ãâ·Â
  1456.         (x, y, z) = player.GetMainCharacterPosition()
  1457.         nUpdateTime = app.GetUpdateTime()
  1458.         nUpdateFPS = app.GetUpdateFPS()
  1459.         nRenderFPS = app.GetRenderFPS()
  1460.         nFaceCount = app.GetFaceCount()
  1461.         fFaceSpeed = app.GetFaceSpeed()
  1462.         nST=background.GetRenderShadowTime()
  1463.         (fAveRT, nCurRT) =  app.GetRenderTime()
  1464.         (iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
  1465.         (iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
  1466.         if iPatch == 0:
  1467.             iPatch = 1
  1468.  
  1469.         #(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
  1470.  
  1471.         self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
  1472.         xMouse, yMouse = wndMgr.GetMousePosition()
  1473.         self.PrintMousePos.SetText("MousePosition: %d %d" % (xMouse, yMouse))          
  1474.  
  1475.         self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
  1476.  
  1477.         if fAveRT>1.0:
  1478.             self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
  1479.  
  1480.         self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
  1481.         #self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
  1482.         #self.TextureNum.SetText("TN : %s" % (sTextureNum))
  1483.         #self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
  1484.         self.ViewDistance.SetText("Num : %d, FS : %f, FE : %f, FC : %f" % (iNum, fFogStart, fFogEnd, fFarCilp))
  1485.  
  1486.     def OnRender(self):
  1487.         app.RenderGame()
  1488.        
  1489.         if self.console.Console.collision:
  1490.             background.RenderCollision()
  1491.             chr.RenderCollision()
  1492.  
  1493.         (x, y) = app.GetCursorPosition()
  1494.  
  1495.         ########################
  1496.         # Picking
  1497.         ########################
  1498.         textTail.UpdateAllTextTail()
  1499.  
  1500.         if True == wndMgr.IsPickedWindow(self.hWnd):
  1501.  
  1502.             self.PickingCharacterIndex = chr.Pick()
  1503.  
  1504.             if -1 != self.PickingCharacterIndex:
  1505.                 textTail.ShowCharacterTextTail(self.PickingCharacterIndex)
  1506.             if 0 != self.targetBoard.GetTargetVID():
  1507.                 textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())
  1508.  
  1509.             # ADD_ALWAYS_SHOW_NAME
  1510.             if not self.__IsShowName():
  1511.                 self.PickingItemIndex = item.Pick()
  1512.                 if -1 != self.PickingItemIndex:
  1513.                     textTail.ShowItemTextTail(self.PickingItemIndex)
  1514.             # END_OF_ADD_ALWAYS_SHOW_NAME
  1515.            
  1516.         ## Show all name in the range
  1517.        
  1518.         # ADD_ALWAYS_SHOW_NAME
  1519.         if self.__IsShowName():
  1520.             textTail.ShowAllTextTail()
  1521.             self.PickingItemIndex = textTail.Pick(x, y)
  1522.         # END_OF_ADD_ALWAYS_SHOW_NAME
  1523.  
  1524.         textTail.UpdateShowingTextTail()
  1525.         textTail.ArrangeTextTail()
  1526.         if -1 != self.PickingItemIndex:
  1527.             textTail.SelectItemName(self.PickingItemIndex)
  1528.  
  1529.         grp.PopState()
  1530.         grp.SetInterfaceRenderState()
  1531.  
  1532.         textTail.Render()
  1533.         textTail.HideAllTextTail()
  1534.  
  1535.     def OnPressEscapeKey(self):
  1536.         if app.TARGET == app.GetCursor():
  1537.             app.SetCursor(app.NORMAL)
  1538.  
  1539.         elif True == mouseModule.mouseController.isAttached():
  1540.             mouseModule.mouseController.DeattachObject()
  1541.  
  1542.         else:
  1543.             self.interface.OpenSystemDialog()
  1544.  
  1545.         return True
  1546.  
  1547.     def OnIMEReturn(self):
  1548.         if app.IsPressed(app.DIK_LSHIFT):
  1549.             self.interface.OpenWhisperDialogWithoutTarget()
  1550.         else:
  1551.             self.interface.ToggleChat()
  1552.         return True
  1553.  
  1554.     def OnPressExitKey(self):
  1555.         self.interface.ToggleSystemDialog()
  1556.         return True
  1557.  
  1558.     ## BINARY CALLBACK
  1559.     ######################################################################################
  1560.    
  1561.     # WEDDING
  1562.     def BINARY_LoverInfo(self, name, lovePoint):
  1563.         if self.interface.wndMessenger:
  1564.             self.interface.wndMessenger.OnAddLover(name, lovePoint)
  1565.         if self.affectShower:
  1566.             self.affectShower.SetLoverInfo(name, lovePoint)
  1567.  
  1568.     def BINARY_UpdateLovePoint(self, lovePoint):
  1569.         if self.interface.wndMessenger:
  1570.             self.interface.wndMessenger.OnUpdateLovePoint(lovePoint)
  1571.         if self.affectShower:
  1572.             self.affectShower.OnUpdateLovePoint(lovePoint)
  1573.     # END_OF_WEDDING
  1574.  
  1575.     # QUEST_CONFIRM
  1576.     def BINARY_OnQuestConfirm(self, msg, timeout, pid):
  1577.         confirmDialog = uiCommon.QuestionDialogWithTimeLimit()
  1578.         confirmDialog.Open(msg, timeout)
  1579.         confirmDialog.SetAcceptEvent(lambda answer=True, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1580.         confirmDialog.SetCancelEvent(lambda answer=False, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1581.         self.confirmDialog = confirmDialog
  1582.     # END_OF_QUEST_CONFIRM
  1583.  
  1584.     # GIFT command
  1585.     def Gift_Show(self):
  1586.         self.interface.ShowGift()
  1587.  
  1588.     # CUBE
  1589.     def BINARY_Cube_Open(self, npcVNUM):
  1590.         self.currentCubeNPC = npcVNUM
  1591.        
  1592.         self.interface.OpenCubeWindow()
  1593.  
  1594.        
  1595.         if npcVNUM not in self.cubeInformation:
  1596.             net.SendChatPacket("/cube r_info")
  1597.         else:
  1598.             cubeInfoList = self.cubeInformation[npcVNUM]
  1599.            
  1600.             i = 0
  1601.             for cubeInfo in cubeInfoList:                              
  1602.                 self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"])
  1603.                
  1604.                 j = 0              
  1605.                 for materialList in cubeInfo["materialList"]:
  1606.                     for materialInfo in materialList:
  1607.                         itemVnum, itemCount = materialInfo
  1608.                         self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount)
  1609.                     j = j + 1                      
  1610.                        
  1611.                 i = i + 1
  1612.                
  1613.             self.interface.wndCube.Refresh()
  1614.  
  1615.     def BINARY_Cube_Close(self):
  1616.         self.interface.CloseCubeWindow()
  1617.  
  1618.     # Á¦ÀÛ¿¡ ÇÊ¿äÇÑ °ñµå, ¿¹»óµÇ´Â ¿Ï¼ºÇ°ÀÇ VNUM°ú °³¼ö Á¤º¸ update
  1619.     def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count):
  1620.         self.interface.UpdateCubeInfo(gold, itemVnum, count)
  1621.        
  1622.     def BINARY_Cube_Succeed(self, itemVnum, count):
  1623.         print "Å¥ºê Á¦ÀÛ ¼º°ø"
  1624.         self.interface.SucceedCubeWork(itemVnum, count)
  1625.         pass
  1626.  
  1627.     def BINARY_Cube_Failed(self):
  1628.         print "Å¥ºê Á¦ÀÛ ½ÇÆÐ"
  1629.         self.interface.FailedCubeWork()
  1630.         pass
  1631.  
  1632.     def BINARY_Cube_ResultList(self, npcVNUM, listText):
  1633.         # ResultList Text Format : 72723,1/72725,1/72730.1/50001,5  ÀÌ·±½ÄÀ¸·Î "/" ¹®ÀÚ·Î ±¸ºÐµÈ ¸®½ºÆ®¸¦ ÁÜ
  1634.         #print listText
  1635.        
  1636.         if npcVNUM == 0:
  1637.             npcVNUM = self.currentCubeNPC
  1638.        
  1639.         self.cubeInformation[npcVNUM] = []
  1640.        
  1641.         try:
  1642.             for eachInfoText in listText.split("/"):
  1643.                 eachInfo = eachInfoText.split(",")
  1644.                 itemVnum    = int(eachInfo[0])
  1645.                 itemCount   = int(eachInfo[1])
  1646.  
  1647.                 self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount})
  1648.                 self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount)
  1649.            
  1650.             resultCount = len(self.cubeInformation[npcVNUM])
  1651.             requestCount = 7
  1652.             modCount = resultCount % requestCount
  1653.             splitCount = resultCount / requestCount
  1654.             for i in xrange(splitCount):
  1655.                 #print("/cube r_info %d %d" % (i * requestCount, requestCount))
  1656.                 net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
  1657.                
  1658.             if 0 < modCount:
  1659.                 #print("/cube r_info %d %d" % (splitCount * requestCount, modCount))               
  1660.                 net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1661.  
  1662.         except RuntimeError, msg:
  1663.             dbg.TraceError(msg)
  1664.             return 0
  1665.            
  1666.         pass
  1667.        
  1668.     def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText):
  1669.         # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000
  1670.         try:
  1671.             #print listText
  1672.            
  1673.             if 3 > len(listText):
  1674.                 dbg.TraceError("Wrong Cube Material Infomation")
  1675.                 return 0
  1676.  
  1677.            
  1678.            
  1679.             eachResultList = listText.split("@")
  1680.  
  1681.             cubeInfo = self.cubeInformation[self.currentCubeNPC]           
  1682.            
  1683.             itemIndex = 0
  1684.             for eachResultText in eachResultList:
  1685.                 cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []]
  1686.                 materialList = cubeInfo[startIndex + itemIndex]["materialList"]
  1687.                
  1688.                 gold = 0
  1689.                 splitResult = eachResultText.split("/")
  1690.                 if 1 < len(splitResult):
  1691.                     gold = int(splitResult[1])
  1692.                    
  1693.                 #print "splitResult : ", splitResult
  1694.                 eachMaterialList = splitResult[0].split("&")
  1695.                
  1696.                 i = 0
  1697.                 for eachMaterialText in eachMaterialList:
  1698.                     complicatedList = eachMaterialText.split("|")
  1699.                    
  1700.                     if 0 < len(complicatedList):
  1701.                         for complicatedText in complicatedList:
  1702.                             (itemVnum, itemCount) = complicatedText.split(",")
  1703.                             itemVnum = int(itemVnum)
  1704.                             itemCount = int(itemCount)
  1705.                             self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1706.                            
  1707.                             materialList[i].append((itemVnum, itemCount))
  1708.                            
  1709.                     else:
  1710.                         itemVnum, itemCount = eachMaterialText.split(",")
  1711.                         itemVnum = int(itemVnum)
  1712.                         itemCount = int(itemCount)
  1713.                         self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1714.                        
  1715.                         materialList[i].append((itemVnum, itemCount))
  1716.                        
  1717.                     i = i + 1
  1718.                    
  1719.                    
  1720.                    
  1721.                 itemIndex = itemIndex + 1
  1722.                
  1723.             self.interface.wndCube.Refresh()
  1724.            
  1725.                
  1726.         except RuntimeError, msg:
  1727.             dbg.TraceError(msg)
  1728.             return 0
  1729.            
  1730.         pass
  1731.    
  1732.     # END_OF_CUBE
  1733.    
  1734.     # ¿ëÈ¥¼® 
  1735.     def BINARY_Highlight_Item(self, inven_type, inven_pos):
  1736.         self.interface.Highligt_Item(inven_type, inven_pos)
  1737.    
  1738.     def BINARY_DragonSoulGiveQuilification(self):
  1739.         self.interface.DragonSoulGiveQuilification()
  1740.        
  1741.     def BINARY_DragonSoulRefineWindow_Open(self):
  1742.         self.interface.OpenDragonSoulRefineWindow()
  1743.  
  1744.     def BINARY_DragonSoulRefineWindow_RefineFail(self, reason, inven_type, inven_pos):
  1745.         self.interface.FailDragonSoulRefine(reason, inven_type, inven_pos)
  1746.  
  1747.     def BINARY_DragonSoulRefineWindow_RefineSucceed(self, inven_type, inven_pos):
  1748.         self.interface.SucceedDragonSoulRefine(inven_type, inven_pos)
  1749.    
  1750.     # END of DRAGON SOUL REFINE WINDOW
  1751.    
  1752.     def BINARY_SetBigMessage(self, message):
  1753.         self.interface.bigBoard.SetTip(message)
  1754.  
  1755.     def BINARY_SetTipMessage(self, message):
  1756.         self.interface.tipBoard.SetTip(message)    
  1757.  
  1758.     def BINARY_AppendNotifyMessage(self, type):
  1759.         if not type in localeInfo.NOTIFY_MESSAGE:
  1760.             return
  1761.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.NOTIFY_MESSAGE[type])
  1762.  
  1763.     def BINARY_Guild_EnterGuildArea(self, areaID):
  1764.         self.interface.BULID_EnterGuildArea(areaID)
  1765.  
  1766.     def BINARY_Guild_ExitGuildArea(self, areaID):
  1767.         self.interface.BULID_ExitGuildArea(areaID)
  1768.  
  1769.     def BINARY_GuildWar_OnSendDeclare(self, guildID):
  1770.         pass
  1771.  
  1772.     def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
  1773.         mainCharacterName = player.GetMainCharacterName()
  1774.         masterName = guild.GetGuildMasterName()
  1775.         if mainCharacterName == masterName:
  1776.             self.__GuildWar_OpenAskDialog(guildID, warType)
  1777.  
  1778.     def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
  1779.         self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
  1780.  
  1781.     def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
  1782.         self.interface.OnStartGuildWar(guildSelf, guildOpp)
  1783.  
  1784.     def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
  1785.         self.interface.OnEndGuildWar(guildSelf, guildOpp)
  1786.  
  1787.     def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
  1788.         self.interface.BINARY_SetObserverMode(isEnable)
  1789.  
  1790.     def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
  1791.         self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1792.  
  1793.     def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
  1794.         guildID1 = int(guildID1)
  1795.         guildID2 = int(guildID2)
  1796.         memberCount1 = int(memberCount1)
  1797.         memberCount2 = int(memberCount2)
  1798.         observerCount = int(observerCount)
  1799.  
  1800.         self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
  1801.         self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1802.  
  1803.     def __GuildWar_OpenAskDialog(self, guildID, warType):
  1804.  
  1805.         guildName = guild.GetGuildName(guildID)
  1806.  
  1807.         # REMOVED_GUILD_BUG_FIX
  1808.         if "Noname" == guildName:
  1809.             return
  1810.         # END_OF_REMOVED_GUILD_BUG_FIX
  1811.  
  1812.         import uiGuild
  1813.         questionDialog = uiGuild.AcceptGuildWarDialog()
  1814.         questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept)
  1815.         questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline)
  1816.         questionDialog.Open(guildName, warType)
  1817.  
  1818.         self.guildWarQuestionDialog = questionDialog
  1819.  
  1820.     def __GuildWar_CloseAskDialog(self):
  1821.         self.guildWarQuestionDialog.Close()
  1822.         self.guildWarQuestionDialog = None
  1823.  
  1824.     def __GuildWar_OnAccept(self):
  1825.  
  1826.         guildName = self.guildWarQuestionDialog.GetGuildName()
  1827.  
  1828.         net.SendChatPacket("/war " + guildName)
  1829.         self.__GuildWar_CloseAskDialog()
  1830.  
  1831.         return 1
  1832.  
  1833.     def __GuildWar_OnDecline(self):
  1834.  
  1835.         guildName = self.guildWarQuestionDialog.GetGuildName()
  1836.  
  1837.         net.SendChatPacket("/nowar " + guildName)
  1838.         self.__GuildWar_CloseAskDialog()
  1839.  
  1840.         return 1
  1841.     ## BINARY CALLBACK
  1842.     ######################################################################################
  1843.  
  1844.     def __ServerCommand_Build(self):
  1845.         serverCommandList={
  1846.             "ConsoleEnable"         : self.__Console_Enable,
  1847.             "DayMode"               : self.__DayMode_Update,
  1848.             "PRESERVE_DayMode"      : self.__PRESERVE_DayMode_Update,
  1849.             "CloseRestartWindow"    : self.__RestartDialog_Close,
  1850.             "OpenPrivateShop"       : self.__PrivateShop_Open,
  1851.             "PartyHealReady"        : self.PartyHealReady,
  1852.             "ShowMeSafeboxPassword" : self.AskSafeboxPassword,
  1853.             "CloseSafebox"          : self.CommandCloseSafebox,
  1854.  
  1855.             # ITEM_MALL
  1856.             "CloseMall"             : self.CommandCloseMall,
  1857.             "ShowMeMallPassword"    : self.AskMallPassword,
  1858.             "item_mall"             : self.__ItemMall_Open,
  1859.             # END_OF_ITEM_MALL
  1860.  
  1861.             "RefineSuceeded"        : self.RefineSuceededMessage,
  1862.             "RefineFailed"          : self.RefineFailedMessage,
  1863.             "xmas_snow"             : self.__XMasSnow_Enable,
  1864.             "xmas_boom"             : self.__XMasBoom_Enable,
  1865.             "xmas_song"             : self.__XMasSong_Enable,
  1866.             "xmas_tree"             : self.__XMasTree_Enable,
  1867.             "newyear_boom"          : self.__XMasBoom_Enable,
  1868.             "PartyRequest"          : self.__PartyRequestQuestion,
  1869.             "PartyRequestDenied"    : self.__PartyRequestDenied,
  1870.             "horse_state"           : self.__Horse_UpdateState,
  1871.             "hide_horse_state"      : self.__Horse_HideState,
  1872.             "WarUC"                 : self.__GuildWar_UpdateMemberCount,
  1873.             "test_server"           : self.__EnableTestServerFlag,
  1874.             "mall"          : self.__InGameShop_Show,
  1875.  
  1876.             # Achievement System START
  1877.             "conquista"         : self.__ConquistasBuff,
  1878.             "achievement"   : self.__AchievementTest,
  1879.             "achievementpoints"   : self.__ShowAchievementPoints,
  1880.            # Achievement System END
  1881.  
  1882.             # WEDDING
  1883.             "lover_login"           : self.__LoginLover,
  1884.             "lover_logout"          : self.__LogoutLover,
  1885.             "lover_near"            : self.__LoverNear,
  1886.             "lover_far"             : self.__LoverFar,
  1887.             "lover_divorce"         : self.__LoverDivorce,
  1888.             "PlayMusic"             : self.__PlayMusic,
  1889.             # END_OF_WEDDING
  1890.  
  1891.             # PRIVATE_SHOP_PRICE_LIST
  1892.             "MyShopPriceList"       : self.__PrivateShop_PriceList,
  1893.             # END_OF_PRIVATE_SHOP_PRICE_LIST
  1894.         }
  1895.  
  1896.         self.serverCommander=stringCommander.Analyzer()
  1897.         for serverCommandItem in serverCommandList.items():
  1898.             self.serverCommander.SAFE_RegisterCallBack(
  1899.                 serverCommandItem[0], serverCommandItem[1]
  1900.             )
  1901.  
  1902.     def BINARY_ServerCommand_Run(self, line):
  1903.         #dbg.TraceError(line)
  1904.         try:
  1905.             #print " BINARY_ServerCommand_Run", line
  1906.             return self.serverCommander.Run(line)
  1907.         except RuntimeError, msg:
  1908.             dbg.TraceError(msg)
  1909.             return 0
  1910.  
  1911.     def __ProcessPreservedServerCommand(self):
  1912.         try:
  1913.             command = net.GetPreservedServerCommand()
  1914.             while command:
  1915.                 print " __ProcessPreservedServerCommand", command
  1916.                 self.serverCommander.Run(command)
  1917.                 command = net.GetPreservedServerCommand()
  1918.         except RuntimeError, msg:
  1919.             dbg.TraceError(msg)
  1920.             return 0
  1921.  
  1922.     # Achievement System START
  1923.     def __ShowAchievementPoints(self, points):
  1924.       import uiAchievement
  1925.       import uiTaskbar
  1926.       self.uiAchievement = uiAchievement.AchievementDialog()
  1927.       uiAchievement.AchievementPoints = int(points)
  1928.  
  1929.     def __AchievementTest(self, archivement):
  1930.       import uiAchievement
  1931.       self.uiAchievement = uiAchievement.AchievementDialog()
  1932.       self.uiAchievement.Show(1, str(archivement))
  1933.       self.uiAchievement.SetTop()
  1934.     # Achievement System END
  1935.  
  1936.     def PartyHealReady(self):
  1937.         self.interface.PartyHealReady()
  1938.  
  1939.     def AskSafeboxPassword(self):
  1940.         self.interface.AskSafeboxPassword()
  1941.  
  1942.     def __ConquistasBuff(self):
  1943.         net.SendChatPacket("(conquista)")
  1944.  
  1945.     # ITEM_MALL
  1946.     def AskMallPassword(self):
  1947.         self.interface.AskMallPassword()
  1948.  
  1949.     def __ItemMall_Open(self):
  1950.         self.interface.OpenItemMall();
  1951.  
  1952.     def CommandCloseMall(self):
  1953.         self.interface.CommandCloseMall()
  1954.     # END_OF_ITEM_MALL
  1955.  
  1956.     def RefineSuceededMessage(self):
  1957.         snd.PlaySound("sound/ui/make_soket.wav")
  1958.         self.PopupMessage(localeInfo.REFINE_SUCCESS)
  1959.  
  1960.     def RefineFailedMessage(self):
  1961.         snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1962.         self.PopupMessage(localeInfo.REFINE_FAILURE)
  1963.  
  1964.     def CommandCloseSafebox(self):
  1965.         self.interface.CommandCloseSafebox()
  1966.  
  1967.     # PRIVATE_SHOP_PRICE_LIST
  1968.     def __PrivateShop_PriceList(self, itemVNum, itemPrice):
  1969.         uiPrivateShopBuilder.SetPrivateShopItemPrice(itemVNum, itemPrice)  
  1970.     # END_OF_PRIVATE_SHOP_PRICE_LIST
  1971.  
  1972.     def __Horse_HideState(self):
  1973.         self.affectShower.SetHorseState(0, 0, 0)
  1974.  
  1975.     def __Horse_UpdateState(self, level, health, battery):
  1976.         self.affectShower.SetHorseState(int(level), int(health), int(battery))
  1977.  
  1978.     def __IsXMasMap(self):
  1979.         mapDict = ( "metin2_map_n_flame_01",
  1980.                     "metin2_map_n_desert_01",
  1981.                     "metin2_map_spiderdungeon",
  1982.                     "metin2_map_deviltower1", )
  1983.  
  1984.         if background.GetCurrentMapName() in mapDict:
  1985.             return False
  1986.  
  1987.         return True
  1988.  
  1989.     def __XMasSnow_Enable(self, mode):
  1990.  
  1991.         self.__XMasSong_Enable(mode)
  1992.  
  1993.         if "1"==mode:
  1994.  
  1995.             if not self.__IsXMasMap():
  1996.                 return
  1997.  
  1998.             print "XMAS_SNOW ON"
  1999.             background.EnableSnow(1)
  2000.  
  2001.         else:
  2002.             print "XMAS_SNOW OFF"
  2003.             background.EnableSnow(0)
  2004.  
  2005.     def __XMasBoom_Enable(self, mode):
  2006.         if "1"==mode:
  2007.  
  2008.             if not self.__IsXMasMap():
  2009.                 return
  2010.  
  2011.             print "XMAS_BOOM ON"
  2012.             self.__DayMode_Update("dark")
  2013.             self.enableXMasBoom = True
  2014.             self.startTimeXMasBoom = app.GetTime()
  2015.         else:
  2016.             print "XMAS_BOOM OFF"
  2017.             self.__DayMode_Update("light")
  2018.             self.enableXMasBoom = False
  2019.  
  2020.     def __XMasTree_Enable(self, grade):
  2021.  
  2022.         print "XMAS_TREE ", grade
  2023.         background.SetXMasTree(int(grade))
  2024.  
  2025.     def __XMasSong_Enable(self, mode):
  2026.         if "1"==mode:
  2027.             print "XMAS_SONG ON"
  2028.  
  2029.             XMAS_BGM = "xmas.mp3"
  2030.  
  2031.             if app.IsExistFile("BGM/" + XMAS_BGM)==1:
  2032.                 if musicInfo.fieldMusic != "":
  2033.                     snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2034.  
  2035.                 musicInfo.fieldMusic=XMAS_BGM
  2036.                 snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2037.  
  2038.         else:
  2039.             print "XMAS_SONG OFF"
  2040.  
  2041.             if musicInfo.fieldMusic != "":
  2042.                 snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2043.  
  2044.             musicInfo.fieldMusic=musicInfo.METIN2THEMA
  2045.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2046.  
  2047.     def __RestartDialog_Close(self):
  2048.         self.interface.CloseRestartDialog()
  2049.  
  2050.     def __Console_Enable(self):
  2051.         constInfo.CONSOLE_ENABLE = True
  2052.         self.consoleEnable = True
  2053.         app.EnableSpecialCameraMode()
  2054.         ui.EnablePaste(True)
  2055.  
  2056.     ## PrivateShop
  2057.     def __PrivateShop_Open(self):
  2058.         self.interface.OpenPrivateShopInputNameDialog()
  2059.  
  2060.     def BINARY_PrivateShop_Appear(self, vid, text):
  2061.         self.interface.AppearPrivateShop(vid, text)
  2062.  
  2063.     def BINARY_PrivateShop_Disappear(self, vid):
  2064.         self.interface.DisappearPrivateShop(vid)
  2065.  
  2066.     ## DayMode
  2067.     def __PRESERVE_DayMode_Update(self, mode):
  2068.         if "light"==mode:
  2069.             background.SetEnvironmentData(0)
  2070.         elif "dark"==mode:
  2071.  
  2072.             if not self.__IsXMasMap():
  2073.                 return
  2074.  
  2075.             background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2076.             background.SetEnvironmentData(1)
  2077.  
  2078.     def __DayMode_Update(self, mode):
  2079.         if "light"==mode:
  2080.             self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
  2081.         elif "dark"==mode:
  2082.  
  2083.             if not self.__IsXMasMap():
  2084.                 return
  2085.  
  2086.             self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
  2087.  
  2088.     def __DayMode_OnCompleteChangeToLight(self):
  2089.         background.SetEnvironmentData(0)
  2090.         self.curtain.FadeIn()
  2091.  
  2092.     def __DayMode_OnCompleteChangeToDark(self):
  2093.         background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2094.         background.SetEnvironmentData(1)
  2095.         self.curtain.FadeIn()
  2096.  
  2097.     ## XMasBoom
  2098.     def __XMasBoom_Update(self):
  2099.  
  2100.         self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
  2101.         if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
  2102.             return
  2103.  
  2104.         boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
  2105.         boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
  2106.  
  2107.         if app.GetTime() - self.startTimeXMasBoom > boomTime:
  2108.  
  2109.             self.indexXMasBoom += 1
  2110.  
  2111.             for i in xrange(boomCount):
  2112.                 self.__XMasBoom_Boom()
  2113.  
  2114.     def __XMasBoom_Boom(self):
  2115.         x, y, z = player.GetMainCharacterPosition()
  2116.         randX = app.GetRandom(-150, 150)
  2117.         randY = app.GetRandom(-150, 150)
  2118.  
  2119.         snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
  2120.  
  2121.     def __PartyRequestQuestion(self, vid):
  2122.         vid = int(vid)
  2123.         partyRequestQuestionDialog = uiCommon.QuestionDialog()
  2124.         partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + localeInfo.PARTY_DO_YOU_ACCEPT)
  2125.         partyRequestQuestionDialog.SetAcceptText(localeInfo.UI_ACCEPT)
  2126.         partyRequestQuestionDialog.SetCancelText(localeInfo.UI_DENY)
  2127.         partyRequestQuestionDialog.SetAcceptEvent(lambda arg=True: self.__AnswerPartyRequest(arg))
  2128.         partyRequestQuestionDialog.SetCancelEvent(lambda arg=False: self.__AnswerPartyRequest(arg))
  2129.         partyRequestQuestionDialog.Open()
  2130.         partyRequestQuestionDialog.vid = vid
  2131.         self.partyRequestQuestionDialog = partyRequestQuestionDialog
  2132.  
  2133.     def __AnswerPartyRequest(self, answer):
  2134.         if not self.partyRequestQuestionDialog:
  2135.             return
  2136.  
  2137.         vid = self.partyRequestQuestionDialog.vid
  2138.  
  2139.         if answer:
  2140.             net.SendChatPacket("/party_request_accept " + str(vid))
  2141.         else:
  2142.             net.SendChatPacket("/party_request_deny " + str(vid))
  2143.  
  2144.         self.partyRequestQuestionDialog.Close()
  2145.         self.partyRequestQuestionDialog = None
  2146.  
  2147.     def __PartyRequestDenied(self):
  2148.         self.PopupMessage(localeInfo.PARTY_REQUEST_DENIED)
  2149.  
  2150.     def __EnableTestServerFlag(self):
  2151.         app.EnableTestServerFlag()
  2152.  
  2153.     def __InGameShop_Show(self, url):
  2154.         if constInfo.IN_GAME_SHOP_ENABLE:
  2155.             self.interface.OpenWebWindow(url)
  2156.  
  2157.     # WEDDING
  2158.     def __LoginLover(self):
  2159.         if self.interface.wndMessenger:
  2160.             self.interface.wndMessenger.OnLoginLover()
  2161.  
  2162.     def __LogoutLover(self):
  2163.         if self.interface.wndMessenger:
  2164.             self.interface.wndMessenger.OnLogoutLover()
  2165.         if self.affectShower:
  2166.             self.affectShower.HideLoverState()
  2167.  
  2168.     def __LoverNear(self):
  2169.         if self.affectShower:
  2170.             self.affectShower.ShowLoverState()
  2171.  
  2172.     def __LoverFar(self):
  2173.         if self.affectShower:
  2174.             self.affectShower.HideLoverState()
  2175.  
  2176.     def __LoverDivorce(self):
  2177.         if self.interface.wndMessenger:
  2178.             self.interface.wndMessenger.ClearLoverInfo()
  2179.         if self.affectShower:
  2180.             self.affectShower.ClearLoverState()
  2181.  
  2182.     def __PlayMusic(self, flag, filename):
  2183.         flag = int(flag)
  2184.         if flag:
  2185.             snd.FadeOutAllMusic()
  2186.             musicInfo.SaveLastPlayFieldMusic()
  2187.             snd.FadeInMusic("BGM/" + filename)
  2188.         else:
  2189.             snd.FadeOutAllMusic()
  2190.             musicInfo.LoadLastPlayFieldMusic()
  2191.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2192.  
  2193.     # END_OF_WEDDING
  2194.  
  2195. # Pagina bonusuri
  2196.     def __BonusPage(self):
  2197.         import PaginaBonusuri
  2198.         global BPisLoaded
  2199.         try:
  2200.             if BPisLoaded != 1:
  2201.                 exec 'PaginaBonusuri.BonusBoardDialog().Show()'
  2202.             else:
  2203.                 pass
  2204.         except ImportError:
  2205.             import dbg,app
  2206.             dbg.Trace('PaginaBonusuri.py Importing error')
  2207.             app.Abort()
  2208. # Pagina bonusuri, sfarsit
RAW Paste Data