Guest User

Untitled

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