Advertisement
Guest User

Untitled

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