Advertisement
Guest User

game.py / metin2dev

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