AlissonLima

game.py

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