Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 65.06 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 locale
  24. import constInfo
  25. import exchange
  26. import ime
  27. import uiRune
  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. import uiBonus
  37.  
  38. # PRIVATE_SHOP_PRICE_LIST
  39. import uiPrivateShopBuilder
  40. # END_OF_PRIVATE_SHOP_PRICE_LIST
  41.  
  42. import mouseModule
  43. import consoleModule
  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 locale.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 locale.IsEUROPE():
  64.     SCREENSHOT_CWDSAVE = TRUE
  65.  
  66. if locale.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.         self.dlgRune = uiRune.RunWindow()
  121.         self.dlgRune.Hide()
  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(locale.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(locale.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(locale.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_X]           = lambda : self.interface.ToggleBonusWindow()
  367.         onPressKeyDict[app.DIK_C]           = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
  368.         onPressKeyDict[app.DIK_V]           = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
  369.         #onPressKeyDict[app.DIK_B]          = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
  370.         onPressKeyDict[app.DIK_N]           = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
  371.         onPressKeyDict[app.DIK_I]           = lambda : self.interface.ToggleInventoryWindow()
  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 locale.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(locale.UI_DEF_FONT)
  540.         self.PrintCoord.SetPosition(wndMgr.GetScreenWidth() - 270, 0)
  541.        
  542.         ## Frame Rate
  543.         self.FrameRate = ui.TextLine()
  544.         self.FrameRate.SetFontName(locale.UI_DEF_FONT)
  545.         self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
  546.  
  547.         ## Camera Pitch
  548.         self.Pitch = ui.TextLine()
  549.         self.Pitch.SetFontName(locale.UI_DEF_FONT)
  550.         self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
  551.  
  552.         ## Splat
  553.         self.Splat = ui.TextLine()
  554.         self.Splat.SetFontName(locale.UI_DEF_FONT)
  555.         self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
  556.        
  557.         ##
  558.         self.PrintMousePos = ui.TextLine()
  559.         self.PrintMousePos.SetFontName(locale.UI_DEF_FONT)
  560.         self.PrintMousePos.SetPosition(wndMgr.GetScreenWidth() - 270, 80)
  561.  
  562.         # TextureNum
  563.         self.TextureNum = ui.TextLine()
  564.         self.TextureNum.SetFontName(locale.UI_DEF_FONT)
  565.         self.TextureNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
  566.  
  567.         # 오브젝트 그리는 개수
  568.         self.ObjectNum = ui.TextLine()
  569.         self.ObjectNum.SetFontName(locale.UI_DEF_FONT)
  570.         self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 120)
  571.  
  572.         # 시야거리
  573.         self.ViewDistance = ui.TextLine()
  574.         self.ViewDistance.SetFontName(locale.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(locale.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, locale.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(locale.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) + " (" + locale.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(locale.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(locale.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, locale.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.  
  755.     def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  756.         self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  757.    
  758.  
  759.  
  760.     # END_OF_UNKNOWN_UPDATE
  761.  
  762.     def ActivateSkillSlot(self, slotIndex):
  763.         if self.interface:
  764.             self.interface.OnActivateSkill(slotIndex)
  765.  
  766.     def DeactivateSkillSlot(self, slotIndex):
  767.         if self.interface:
  768.             self.interface.OnDeactivateSkill(slotIndex)
  769.  
  770.     def RefreshEquipment(self):
  771.         if self.interface:
  772.             self.interface.RefreshInventory()
  773.  
  774.     def RefreshInventory(self):
  775.         if self.interface:
  776.             self.interface.RefreshInventory()
  777.  
  778.     def RefreshCharacter(self):
  779.         if self.interface:
  780.             self.interface.RefreshCharacter()
  781.  
  782.     def OnGameOver(self):
  783.         self.CloseTargetBoard()
  784.         self.OpenRestartDialog()
  785.  
  786.     def OpenRestartDialog(self):
  787.         self.interface.OpenRestartDialog()
  788.  
  789.     def ChangeCurrentSkill(self, skillSlotNumber):
  790.         self.interface.OnChangeCurrentSkill(skillSlotNumber)
  791.  
  792.     ## TargetBoard
  793.     def SetPCTargetBoard(self, vid, name):
  794.         self.targetBoard.Open(vid, name)
  795.        
  796.         if app.IsPressed(app.DIK_LCONTROL):
  797.            
  798.             if not player.IsSameEmpire(vid):
  799.                 return
  800.  
  801.             if player.IsMainCharacterIndex(vid):
  802.                 return     
  803.             elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(vid):
  804.                 return
  805.  
  806.             self.interface.OpenWhisperDialog(name)
  807.            
  808.  
  809.     def RefreshTargetBoardByVID(self, vid):
  810.         self.targetBoard.RefreshByVID(vid)
  811.  
  812.     def RefreshTargetBoardByName(self, name):
  813.         self.targetBoard.RefreshByName(name)
  814.        
  815.     def __RefreshTargetBoard(self):
  816.         self.targetBoard.Refresh()
  817.        
  818.     def SetHPTargetBoard(self, vid, hpPercentage):
  819.         if vid != self.targetBoard.GetTargetVID():
  820.             self.targetBoard.ResetTargetBoard()
  821.             self.targetBoard.SetEnemyVID(vid)
  822.  
  823.         self.targetBoard.SetHP(hpPercentage)
  824.         self.targetBoard.Show()
  825.  
  826.     def CloseTargetBoardIfDifferent(self, vid):
  827.         if vid != self.targetBoard.GetTargetVID():
  828.             self.targetBoard.Close()
  829.  
  830.     def CloseTargetBoard(self):
  831.         self.targetBoard.Close()
  832.  
  833.     ## View Equipment
  834.     def OpenEquipmentDialog(self, vid):
  835.         self.interface.OpenEquipmentDialog(vid)
  836.  
  837.     def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
  838.         self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
  839.  
  840.     def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
  841.         self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
  842.  
  843.     def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
  844.         self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
  845.  
  846.     # SHOW_LOCAL_MAP_NAME
  847.     def ShowMapName(self, mapName, x, y):
  848.  
  849.         if self.mapNameShower:
  850.             self.mapNameShower.ShowMapName(mapName, x, y)
  851.  
  852.         if self.interface:
  853.             self.interface.SetMapName(mapName)
  854.     # END_OF_SHOW_LOCAL_MAP_NAME   
  855.  
  856.     def BINARY_OpenAtlasWindow(self):
  857.         self.interface.BINARY_OpenAtlasWindow()
  858.  
  859.     ## Chat
  860.     def OnRecvWhisper(self, mode, name, line):
  861.         if mode == chat.WHISPER_TYPE_GM:
  862.             self.interface.RegisterGameMasterName(name)
  863.         chat.AppendWhisper(mode, name, line)
  864.         self.interface.RecvWhisper(name)
  865.  
  866.     def OnRecvWhisperSystemMessage(self, mode, name, line):
  867.         chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
  868.         self.interface.RecvWhisper(name)
  869.  
  870.     def OnRecvWhisperError(self, mode, name, line):
  871.         if locale.WHISPER_ERROR.has_key(mode):
  872.             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, locale.WHISPER_ERROR[mode](name))
  873.         else:
  874.             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
  875.         self.interface.RecvWhisper(name)
  876.  
  877.     def RecvWhisper(self, name):
  878.         self.interface.RecvWhisper(name)
  879.  
  880.     def OnPickMoney(self, money):
  881.         chat.AppendChat(chat.CHAT_TYPE_INFO, locale.GAME_PICK_MONEY % (money))
  882.  
  883.     def OnShopError(self, type):
  884.         try:
  885.             self.PopupMessage(locale.SHOP_ERROR_DICT[type])
  886.         except KeyError:
  887.             self.PopupMessage(locale.SHOP_ERROR_UNKNOWN % (type))
  888.  
  889.     def OnSafeBoxError(self):
  890.         self.PopupMessage(locale.SAFEBOX_ERROR)
  891.  
  892.     def OnFishingSuccess(self, isFish, fishName):
  893.         chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, locale.FISHING_SUCCESS(isFish, fishName), 2000)
  894.  
  895.     # ADD_FISHING_MESSAGE
  896.     def OnFishingNotifyUnknown(self):
  897.         chat.AppendChat(chat.CHAT_TYPE_INFO, locale.FISHING_UNKNOWN)
  898.  
  899.     def OnFishingWrongPlace(self):
  900.         chat.AppendChat(chat.CHAT_TYPE_INFO, locale.FISHING_WRONG_PLACE)
  901.     # END_OF_ADD_FISHING_MESSAGE
  902.  
  903.     def OnFishingNotify(self, isFish, fishName):
  904.         chat.AppendChat(chat.CHAT_TYPE_INFO, locale.FISHING_NOTIFY(isFish, fishName))
  905.  
  906.     def OnFishingFailure(self):
  907.         chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, locale.FISHING_FAILURE, 2000)
  908.  
  909.     def OnCannotPickItem(self):
  910.         chat.AppendChat(chat.CHAT_TYPE_INFO, locale.GAME_CANNOT_PICK_ITEM)
  911.  
  912.     # MINING
  913.     def OnCannotMining(self):
  914.         chat.AppendChat(chat.CHAT_TYPE_INFO, locale.GAME_CANNOT_MINING)
  915.     # END_OF_MINING
  916.  
  917.     def OnCannotUseSkill(self, vid, type):
  918.         if locale.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
  919.             textTail.RegisterInfoTail(vid, locale.USE_SKILL_ERROR_TAIL_DICT[type])
  920.  
  921.         if locale.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
  922.             chat.AppendChat(chat.CHAT_TYPE_INFO, locale.USE_SKILL_ERROR_CHAT_DICT[type])
  923.  
  924.     def OnCannotShotError(self, vid, type):
  925.         textTail.RegisterInfoTail(vid, locale.SHOT_ERROR_TAIL_DICT.get(type, locale.SHOT_ERROR_UNKNOWN % (type)))
  926.  
  927.     ## PointReset
  928.     def StartPointReset(self):
  929.         self.interface.OpenPointResetDialog()
  930.  
  931.     ## Shop
  932.     def StartShop(self, vid):
  933.         self.interface.OpenShopDialog(vid)
  934.  
  935.     def EndShop(self):
  936.         self.interface.CloseShopDialog()
  937.  
  938.     def RefreshShop(self):
  939.         self.interface.RefreshShopDialog()
  940.  
  941.     def SetShopSellingPrice(self, Price):
  942.         pass
  943.  
  944.     ## Exchange
  945.     def StartExchange(self):
  946.         self.interface.StartExchange()
  947.  
  948.     def EndExchange(self):
  949.         self.interface.EndExchange()
  950.  
  951.     def RefreshExchange(self):
  952.         self.interface.RefreshExchange()
  953.  
  954.     ## Party
  955.     def RecvPartyInviteQuestion(self, leaderVID, leaderName):
  956.         partyInviteQuestionDialog = uiCommon.QuestionDialog()
  957.         partyInviteQuestionDialog.SetText(leaderName + locale.PARTY_DO_YOU_JOIN)
  958.         partyInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerPartyInvite(arg))
  959.         partyInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerPartyInvite(arg))
  960.         partyInviteQuestionDialog.Open()
  961.         partyInviteQuestionDialog.partyLeaderVID = leaderVID
  962.         self.partyInviteQuestionDialog = partyInviteQuestionDialog
  963.  
  964.     def AnswerPartyInvite(self, answer):
  965.  
  966.         if not self.partyInviteQuestionDialog:
  967.             return
  968.  
  969.         partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
  970.  
  971.         distance = player.GetCharacterDistance(partyLeaderVID)
  972.         if distance < 0.0 or distance > 5000:
  973.             answer = FALSE
  974.  
  975.         net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
  976.  
  977.         self.partyInviteQuestionDialog.Close()
  978.         self.partyInviteQuestionDialog = None
  979.  
  980.     def AddPartyMember(self, pid, name):
  981.         self.interface.AddPartyMember(pid, name)
  982.  
  983.     def UpdatePartyMemberInfo(self, pid):
  984.         self.interface.UpdatePartyMemberInfo(pid)
  985.  
  986.     def RemovePartyMember(self, pid):
  987.         self.interface.RemovePartyMember(pid)
  988.         self.__RefreshTargetBoard()
  989.  
  990.     def LinkPartyMember(self, pid, vid):
  991.         self.interface.LinkPartyMember(pid, vid)
  992.  
  993.     def UnlinkPartyMember(self, pid):
  994.         self.interface.UnlinkPartyMember(pid)
  995.  
  996.     def UnlinkAllPartyMember(self):
  997.         self.interface.UnlinkAllPartyMember()
  998.  
  999.     def ExitParty(self):
  1000.         self.interface.ExitParty()
  1001.         self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID())
  1002.  
  1003.     def ChangePartyParameter(self, distributionMode):
  1004.         self.interface.ChangePartyParameter(distributionMode)
  1005.  
  1006.     ## Messenger
  1007.     def OnMessengerAddFriendQuestion(self, name):
  1008.         messengerAddFriendQuestion = uiCommon.QuestionDialog2()
  1009.         messengerAddFriendQuestion.SetText1(locale.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
  1010.         messengerAddFriendQuestion.SetText2(locale.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2)
  1011.         messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend))
  1012.         messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend))
  1013.         messengerAddFriendQuestion.Open()
  1014.         messengerAddFriendQuestion.name = name
  1015.         self.messengerAddFriendQuestion = messengerAddFriendQuestion
  1016.  
  1017.     def OnAcceptAddFriend(self):
  1018.         name = self.messengerAddFriendQuestion.name
  1019.         net.SendChatPacket("/messenger_auth y " + name)
  1020.         self.OnCloseAddFriendQuestionDialog()
  1021.         return TRUE
  1022.  
  1023.     def OnDenyAddFriend(self):
  1024.         name = self.messengerAddFriendQuestion.name
  1025.         net.SendChatPacket("/messenger_auth n " + name)
  1026.         self.OnCloseAddFriendQuestionDialog()
  1027.         return TRUE
  1028.  
  1029.     def OnCloseAddFriendQuestionDialog(self):
  1030.         self.messengerAddFriendQuestion.Close()
  1031.         self.messengerAddFriendQuestion = None
  1032.         return TRUE
  1033.  
  1034.     ## SafeBox
  1035.     def OpenSafeboxWindow(self, size):
  1036.         self.interface.OpenSafeboxWindow(size)
  1037.  
  1038.     def RefreshSafebox(self):
  1039.         self.interface.RefreshSafebox()
  1040.  
  1041.     def RefreshSafeboxMoney(self):
  1042.         self.interface.RefreshSafeboxMoney()
  1043.  
  1044.     # ITEM_MALL
  1045.     def OpenMallWindow(self, size):
  1046.         self.interface.OpenMallWindow(size)
  1047.  
  1048.     def RefreshMall(self):
  1049.         self.interface.RefreshMall()
  1050.     # END_OF_ITEM_MALL
  1051.  
  1052.     ## Guild
  1053.     def RecvGuildInviteQuestion(self, guildID, guildName):
  1054.         guildInviteQuestionDialog = uiCommon.QuestionDialog()
  1055.         guildInviteQuestionDialog.SetText(guildName + locale.GUILD_DO_YOU_JOIN)
  1056.         guildInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerGuildInvite(arg))
  1057.         guildInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerGuildInvite(arg))
  1058.         guildInviteQuestionDialog.Open()
  1059.         guildInviteQuestionDialog.guildID = guildID
  1060.         self.guildInviteQuestionDialog = guildInviteQuestionDialog
  1061.  
  1062.     def AnswerGuildInvite(self, answer):
  1063.  
  1064.         if not self.guildInviteQuestionDialog:
  1065.             return
  1066.  
  1067.         guildLeaderVID = self.guildInviteQuestionDialog.guildID
  1068.         net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
  1069.  
  1070.         self.guildInviteQuestionDialog.Close()
  1071.         self.guildInviteQuestionDialog = None
  1072.  
  1073.    
  1074.     def DeleteGuild(self):
  1075.         self.interface.DeleteGuild()
  1076.  
  1077.     ## Clock
  1078.     def ShowClock(self, second):
  1079.         self.interface.ShowClock(second)
  1080.  
  1081.     def HideClock(self):
  1082.         self.interface.HideClock()
  1083.  
  1084.     ## Emotion
  1085.     def BINARY_ActEmotion(self, emotionIndex):
  1086.         if self.interface.wndCharacter:
  1087.             self.interface.wndCharacter.ActEmotion(emotionIndex)
  1088.  
  1089.     ###############################################################################################
  1090.     ###############################################################################################
  1091.     ## Keyboard Functions
  1092.  
  1093.     def CheckFocus(self):
  1094.         if FALSE == self.IsFocus():
  1095.             if TRUE == self.interface.IsOpenChat():
  1096.                 self.interface.ToggleChat()
  1097.  
  1098.             self.SetFocus()
  1099.  
  1100.     def SaveScreen(self):
  1101.         print "save screen"
  1102.  
  1103.         # SCREENSHOT_CWDSAVE
  1104.         if SCREENSHOT_CWDSAVE:
  1105.             if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
  1106.                 os.mkdir(os.getcwd()+os.sep+"screenshot")
  1107.  
  1108.             (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep)
  1109.         elif SCREENSHOT_DIR:
  1110.             (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
  1111.         else:
  1112.             (succeeded, name) = grp.SaveScreenShot()
  1113.         # END_OF_SCREENSHOT_CWDSAVE
  1114.  
  1115.         if succeeded:
  1116.             pass
  1117.             """
  1118.             chat.AppendChat(chat.CHAT_TYPE_INFO, name + locale.SCREENSHOT_SAVE1)
  1119.             chat.AppendChat(chat.CHAT_TYPE_INFO, locale.SCREENSHOT_SAVE2)
  1120.             """
  1121.         else:
  1122.             chat.AppendChat(chat.CHAT_TYPE_INFO, locale.SCREENSHOT_SAVE_FAILURE)
  1123.  
  1124.     def ShowConsole(self):
  1125.         if debugInfo.IsDebugMode() or TRUE == self.consoleEnable:
  1126.             player.EndKeyWalkingImmediately()
  1127.             self.console.OpenWindow()
  1128.  
  1129.     def ShowName(self):
  1130.         self.ShowNameFlag = TRUE
  1131.         self.playerGauge.EnableShowAlways()
  1132.         player.SetQuickPage(self.quickSlotPageIndex+1)
  1133.  
  1134.     # ADD_ALWAYS_SHOW_NAME
  1135.     def __IsShowName(self):
  1136.  
  1137.         if systemSetting.IsAlwaysShowName():
  1138.             return TRUE
  1139.  
  1140.         if self.ShowNameFlag:
  1141.             return TRUE
  1142.  
  1143.         return FALSE
  1144.     # END_OF_ADD_ALWAYS_SHOW_NAME
  1145.    
  1146.     def HideName(self):
  1147.         self.ShowNameFlag = FALSE
  1148.         self.playerGauge.DisableShowAlways()
  1149.         player.SetQuickPage(self.quickSlotPageIndex)
  1150.  
  1151.     def ShowMouseImage(self):
  1152.         self.interface.ShowMouseImage()
  1153.  
  1154.     def HideMouseImage(self):
  1155.         self.interface.HideMouseImage()
  1156.  
  1157.     def StartAttack(self):
  1158.         player.SetAttackKeyState(TRUE)
  1159.  
  1160.     def EndAttack(self):
  1161.         player.SetAttackKeyState(FALSE)
  1162.  
  1163.     def MoveUp(self):
  1164.         player.SetSingleDIKKeyState(app.DIK_UP, TRUE)
  1165.  
  1166.     def MoveDown(self):
  1167.         player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)
  1168.  
  1169.     def MoveLeft(self):
  1170.         player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)
  1171.  
  1172.     def MoveRight(self):
  1173.         player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)
  1174.  
  1175.     def StopUp(self):
  1176.         player.SetSingleDIKKeyState(app.DIK_UP, FALSE)
  1177.  
  1178.     def StopDown(self):
  1179.         player.SetSingleDIKKeyState(app.DIK_DOWN, FALSE)
  1180.  
  1181.     def StopLeft(self):
  1182.         player.SetSingleDIKKeyState(app.DIK_LEFT, FALSE)
  1183.  
  1184.     def StopRight(self):
  1185.         player.SetSingleDIKKeyState(app.DIK_RIGHT, FALSE)
  1186.  
  1187.     def PickUpItem(self):
  1188.         player.PickCloseItem()
  1189.  
  1190.     ###############################################################################################
  1191.     ###############################################################################################
  1192.     ## Event Handler
  1193.  
  1194.     def OnKeyDown(self, key):
  1195.         if self.interface.wndWeb and self.interface.wndWeb.IsShow():
  1196.             return
  1197.  
  1198.         constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
  1199.  
  1200.         try:
  1201.             self.onPressKeyDict[key]()
  1202.         except KeyError:
  1203.             pass
  1204.         except:
  1205.             raise
  1206.  
  1207.         return TRUE
  1208.  
  1209.     def OnKeyUp(self, key):
  1210.         try:
  1211.             self.onClickKeyDict[key]()
  1212.         except KeyError:
  1213.             pass
  1214.         except:
  1215.             raise
  1216.  
  1217.         return TRUE
  1218.  
  1219.     def OnMouseLeftButtonDown(self):
  1220.         if self.interface.BUILD_OnMouseLeftButtonDown():
  1221.             return
  1222.  
  1223.         if mouseModule.mouseController.isAttached():
  1224.             self.CheckFocus()
  1225.         else:
  1226.             hyperlink = ui.GetHyperlink()
  1227.             if hyperlink:
  1228.                 return
  1229.             else:
  1230.                 self.CheckFocus()
  1231.                 player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  1232.  
  1233.         return TRUE
  1234.  
  1235.     def OnMouseLeftButtonUp(self):
  1236.  
  1237.         if self.interface.BUILD_OnMouseLeftButtonUp():
  1238.             return
  1239.  
  1240.         if mouseModule.mouseController.isAttached():
  1241.  
  1242.             attachedType = mouseModule.mouseController.GetAttachedType()
  1243.             attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1244.             attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1245.             attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1246.  
  1247.             ## QuickSlot
  1248.             if player.SLOT_TYPE_QUICK_SLOT == attachedType:
  1249.                 player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)
  1250.  
  1251.             ## Inventory
  1252.             elif player.SLOT_TYPE_INVENTORY == attachedType:
  1253.  
  1254.                 if player.ITEM_MONEY == attachedItemIndex:
  1255.                     self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1256.                 else:
  1257.                     self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1258.  
  1259.             mouseModule.mouseController.DeattachObject()
  1260.  
  1261.         else:
  1262.             hyperlink = ui.GetHyperlink()
  1263.             if hyperlink:
  1264.                 if app.IsPressed(app.DIK_LALT):
  1265.                     link = chat.GetLinkFromHyperlink(hyperlink)
  1266.                     ime.PasteString(link)
  1267.                 else:
  1268.                     self.interface.MakeHyperlinkTooltip(hyperlink)
  1269.                 return
  1270.             else:
  1271.                 player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  1272.  
  1273.         #player.EndMouseWalking()
  1274.         return TRUE
  1275.  
  1276.     def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
  1277.         if TRUE == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1278.             if player.IsEquipmentSlot(attachedItemSlotPos):
  1279.                 self.stream.popupWindow.Close()
  1280.                 self.stream.popupWindow.Open(locale.EXCHANGE_FAILURE_EQUIP_ITEM, 0, locale.UI_OK)
  1281.             else:
  1282.                 if chr.IsNPC(dstChrID):
  1283.                     net.SendGiveItemPacket(dstChrID, attachedItemSlotPos, attachedItemCount)
  1284.                 else:
  1285.                     net.SendExchangeStartPacket(dstChrID)
  1286.                     net.SendExchangeItemAddPacket(attachedItemSlotPos, 0)
  1287.         else:
  1288.             self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1289.  
  1290.     def __PutMoney(self, attachedType, attachedMoney, dstChrID):
  1291.         if TRUE == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1292.             net.SendExchangeStartPacket(dstChrID)
  1293.             net.SendExchangeElkAddPacket(attachedMoney)
  1294.         else:
  1295.             self.__DropMoney(attachedType, attachedMoney)
  1296.  
  1297.     def __DropMoney(self, attachedType, attachedMoney):
  1298.         # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1299.         if uiPrivateShopBuilder.IsBuildingPrivateShop():           
  1300.             chat.AppendChat(chat.CHAT_TYPE_INFO, locale.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1301.             return
  1302.         # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1303.        
  1304.         if attachedMoney>=1000:
  1305.             self.stream.popupWindow.Close()
  1306.             self.stream.popupWindow.Open(locale.DROP_MONEY_FAILURE_1000_OVER, 0, locale.UI_OK)
  1307.             return
  1308.  
  1309.         itemDropQuestionDialog = uiCommon.QuestionDialog()
  1310.         itemDropQuestionDialog.SetText(locale.DO_YOU_DROP_MONEY % (attachedMoney))
  1311.         itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1312.         itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1313.         itemDropQuestionDialog.Open()
  1314.         itemDropQuestionDialog.dropType = attachedType
  1315.         itemDropQuestionDialog.dropCount = attachedMoney
  1316.         itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
  1317.         self.itemDropQuestionDialog = itemDropQuestionDialog
  1318.  
  1319.     def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
  1320.         # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1321.         if uiPrivateShopBuilder.IsBuildingPrivateShop():           
  1322.             chat.AppendChat(chat.CHAT_TYPE_INFO, locale.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1323.             return
  1324.         # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1325.        
  1326.         if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos):
  1327.             self.stream.popupWindow.Close()
  1328.             self.stream.popupWindow.Open(locale.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, locale.UI_OK)
  1329.  
  1330.         else:
  1331.             if player.SLOT_TYPE_INVENTORY == attachedType:
  1332.                 dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
  1333.  
  1334.                 item.SelectItem(dropItemIndex)
  1335.                 dropItemName = item.GetItemName()
  1336.  
  1337.                 ## Question Text
  1338.                 questionText = locale.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1339.  
  1340.                 ## Dialog
  1341.                 itemDropQuestionDialog = uiCommon.QuestionDialog()
  1342.                 itemDropQuestionDialog.SetText(questionText)
  1343.                 itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1344.                 itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1345.                 itemDropQuestionDialog.Open()
  1346.                 itemDropQuestionDialog.dropType = attachedType
  1347.                 itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1348.                 itemDropQuestionDialog.dropCount = attachedItemCount
  1349.                 self.itemDropQuestionDialog = itemDropQuestionDialog
  1350.  
  1351.                 constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
  1352.  
  1353.     def RequestDropItem(self, answer):
  1354.         if not self.itemDropQuestionDialog:
  1355.             return
  1356.  
  1357.         if answer:
  1358.             dropType = self.itemDropQuestionDialog.dropType
  1359.             dropCount = self.itemDropQuestionDialog.dropCount
  1360.             dropNumber = self.itemDropQuestionDialog.dropNumber
  1361.  
  1362.             if player.SLOT_TYPE_INVENTORY == dropType:
  1363.                 if dropNumber == player.ITEM_MONEY:
  1364.                     net.SendGoldDropPacketNew(dropCount)
  1365.                     snd.PlaySound("sound/ui/money.wav")
  1366.                 else:
  1367.                     # PRIVATESHOP_DISABLE_ITEM_DROP
  1368.                     self.__SendDropItemPacket(dropNumber, dropCount)
  1369.                     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1370.  
  1371.         self.itemDropQuestionDialog.Close()
  1372.         self.itemDropQuestionDialog = None
  1373.  
  1374.         constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
  1375.  
  1376.     # PRIVATESHOP_DISABLE_ITEM_DROP
  1377.     def __SendDropItemPacket(self, itemVNum, itemCount):
  1378.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1379.             chat.AppendChat(chat.CHAT_TYPE_INFO, locale.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1380.             return
  1381.  
  1382.         net.SendItemDropPacketNew(itemVNum, itemCount)
  1383.     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1384.  
  1385.     def OnMouseRightButtonDown(self):
  1386.  
  1387.         self.CheckFocus()
  1388.  
  1389.         if TRUE == mouseModule.mouseController.isAttached():
  1390.             mouseModule.mouseController.DeattachObject()
  1391.  
  1392.         else:
  1393.             player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
  1394.  
  1395.         return TRUE
  1396.  
  1397.     def OnMouseRightButtonUp(self):
  1398.         if TRUE == mouseModule.mouseController.isAttached():
  1399.             return TRUE
  1400.  
  1401.         player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
  1402.         return TRUE
  1403.  
  1404.     def OnMouseMiddleButtonDown(self):
  1405.         player.SetMouseMiddleButtonState(player.MBS_PRESS)
  1406.  
  1407.     def OnMouseMiddleButtonUp(self):
  1408.         player.SetMouseMiddleButtonState(player.MBS_CLICK)
  1409.  
  1410.     def OnUpdate(self):
  1411.         app.UpdateGame()
  1412.        
  1413.         if self.mapNameShower.IsShow():
  1414.             self.mapNameShower.Update()
  1415.  
  1416.         if self.isShowDebugInfo:
  1417.             self.UpdateDebugInfo()
  1418.  
  1419.         if self.enableXMasBoom:
  1420.             self.__XMasBoom_Update()
  1421.  
  1422.         self.interface.BUILD_OnUpdate()
  1423.        
  1424.        
  1425.     def UpdateDebugInfo(self):
  1426.         #
  1427.         # 캐릭터 좌표 및 FPS 출력
  1428.         (x, y, z) = player.GetMainCharacterPosition()
  1429.         nUpdateTime = app.GetUpdateTime()
  1430.         nUpdateFPS = app.GetUpdateFPS()
  1431.         nRenderFPS = app.GetRenderFPS()
  1432.         nFaceCount = app.GetFaceCount()
  1433.         fFaceSpeed = app.GetFaceSpeed()
  1434.         nST=background.GetRenderShadowTime()
  1435.         (fAveRT, nCurRT) =  app.GetRenderTime()
  1436.         (iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
  1437.         (iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
  1438.         if iPatch == 0:
  1439.             iPatch = 1
  1440.  
  1441.         #(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
  1442.  
  1443.         self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
  1444.         xMouse, yMouse = wndMgr.GetMousePosition()
  1445.         self.PrintMousePos.SetText("MousePosition: %d %d" % (xMouse, yMouse))          
  1446.  
  1447.         self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
  1448.  
  1449.         if fAveRT>1.0:
  1450.             self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
  1451.  
  1452.         self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
  1453.         #self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
  1454.         #self.TextureNum.SetText("TN : %s" % (sTextureNum))
  1455.         #self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
  1456.         self.ViewDistance.SetText("Num : %d, FS : %f, FE : %f, FC : %f" % (iNum, fFogStart, fFogEnd, fFarCilp))
  1457.  
  1458.     def OnRender(self):
  1459.         app.RenderGame()
  1460.        
  1461.         if self.console.Console.collision:
  1462.             background.RenderCollision()
  1463.             chr.RenderCollision()
  1464.  
  1465.         (x, y) = app.GetCursorPosition()
  1466.  
  1467.         ########################
  1468.         # Picking
  1469.         ########################
  1470.         textTail.UpdateAllTextTail()
  1471.  
  1472.         if TRUE == wndMgr.IsPickedWindow(self.hWnd):
  1473.  
  1474.             self.PickingCharacterIndex = chr.Pick()
  1475.  
  1476.             if -1 != self.PickingCharacterIndex:
  1477.                 textTail.ShowCharacterTextTail(self.PickingCharacterIndex)
  1478.             if 0 != self.targetBoard.GetTargetVID():
  1479.                 textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())
  1480.  
  1481.             # ADD_ALWAYS_SHOW_NAME
  1482.             if not self.__IsShowName():
  1483.                 self.PickingItemIndex = item.Pick()
  1484.                 if -1 != self.PickingItemIndex:
  1485.                     textTail.ShowItemTextTail(self.PickingItemIndex)
  1486.             # END_OF_ADD_ALWAYS_SHOW_NAME
  1487.            
  1488.         ## Show all name in the range
  1489.        
  1490.         # ADD_ALWAYS_SHOW_NAME
  1491.         if self.__IsShowName():
  1492.             textTail.ShowAllTextTail()
  1493.             self.PickingItemIndex = textTail.Pick(x, y)
  1494.         # END_OF_ADD_ALWAYS_SHOW_NAME
  1495.  
  1496.         textTail.UpdateShowingTextTail()
  1497.         textTail.ArrangeTextTail()
  1498.         if -1 != self.PickingItemIndex:
  1499.             textTail.SelectItemName(self.PickingItemIndex)
  1500.  
  1501.         grp.PopState()
  1502.         grp.SetInterfaceRenderState()
  1503.  
  1504.         textTail.Render()
  1505.         textTail.HideAllTextTail()
  1506.  
  1507.     def OnPressEscapeKey(self):
  1508.         if app.TARGET == app.GetCursor():
  1509.             app.SetCursor(app.NORMAL)
  1510.  
  1511.         elif TRUE == mouseModule.mouseController.isAttached():
  1512.             mouseModule.mouseController.DeattachObject()
  1513.  
  1514.         else:
  1515.             self.interface.OpenSystemDialog()
  1516.  
  1517.         return TRUE
  1518.  
  1519.     def OnIMEReturn(self):
  1520.         if app.IsPressed(app.DIK_LSHIFT):
  1521.             self.interface.OpenWhisperDialogWithoutTarget()
  1522.         else:
  1523.             self.interface.ToggleChat()
  1524.         return TRUE
  1525.  
  1526.     def OnPressExitKey(self):
  1527.         self.interface.ToggleSystemDialog()
  1528.         return TRUE
  1529.  
  1530.     ## BINARY CALLBACK
  1531.     ######################################################################################
  1532.    
  1533.     # WEDDING
  1534.     def BINARY_LoverInfo(self, name, lovePoint):
  1535.         if self.interface.wndMessenger:
  1536.             self.interface.wndMessenger.OnAddLover(name, lovePoint)
  1537.         if self.affectShower:
  1538.             self.affectShower.SetLoverInfo(name, lovePoint)
  1539.  
  1540.     def BINARY_UpdateLovePoint(self, lovePoint):
  1541.         if self.interface.wndMessenger:
  1542.             self.interface.wndMessenger.OnUpdateLovePoint(lovePoint)
  1543.         if self.affectShower:
  1544.             self.affectShower.OnUpdateLovePoint(lovePoint)
  1545.     # END_OF_WEDDING
  1546.    
  1547.     # QUEST_CONFIRM
  1548.     def BINARY_OnQuestConfirm(self, msg, timeout, pid):
  1549.         confirmDialog = uiCommon.QuestionDialogWithTimeLimit()
  1550.         confirmDialog.Open(msg, timeout)
  1551.         confirmDialog.SetAcceptEvent(lambda answer=TRUE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1552.         confirmDialog.SetCancelEvent(lambda answer=FALSE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1553.         self.confirmDialog = confirmDialog
  1554.     # END_OF_QUEST_CONFIRM
  1555.  
  1556.     # GIFT command
  1557.     def Gift_Show(self):
  1558.         self.interface.ShowGift()
  1559.  
  1560.     # CUBE
  1561.     def BINARY_Cube_Open(self, npcVNUM):
  1562.         self.currentCubeNPC = npcVNUM
  1563.        
  1564.         self.interface.OpenCubeWindow()
  1565.  
  1566.        
  1567.         if npcVNUM not in self.cubeInformation:
  1568.             net.SendChatPacket("/cube r_info")
  1569.         else:
  1570.             cubeInfoList = self.cubeInformation[npcVNUM]
  1571.            
  1572.             i = 0
  1573.             for cubeInfo in cubeInfoList:                              
  1574.                 self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"])
  1575.                
  1576.                 j = 0              
  1577.                 for materialList in cubeInfo["materialList"]:
  1578.                     for materialInfo in materialList:
  1579.                         itemVnum, itemCount = materialInfo
  1580.                         self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount)
  1581.                     j = j + 1                      
  1582.                        
  1583.                 i = i + 1
  1584.                
  1585.             self.interface.wndCube.Refresh()
  1586.  
  1587.     def BINARY_Cube_Close(self):
  1588.         self.interface.CloseCubeWindow()
  1589.  
  1590.     # 제작에 필요한 골드, 예상되는 완성품의 VNUM과 개수 정보 update
  1591.     def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count):
  1592.         self.interface.UpdateCubeInfo(gold, itemVnum, count)
  1593.        
  1594.     def BINARY_Cube_Succeed(self, itemVnum, count):
  1595.         print "큐브 제작 성공"
  1596.         self.interface.SucceedCubeWork(itemVnum, count)
  1597.         pass
  1598.  
  1599.     def BINARY_Cube_Failed(self):
  1600.         print "큐브 제작 실패"
  1601.         self.interface.FailedCubeWork()
  1602.         pass
  1603.  
  1604.     def BINARY_Cube_ResultList(self, npcVNUM, listText):
  1605.         # ResultList Text Format : 72723,1/72725,1/72730.1/50001,5  이런식으로 "/" 문자로 구분된 리스트를 줌
  1606.         #print listText
  1607.        
  1608.         if npcVNUM == 0:
  1609.             npcVNUM = self.currentCubeNPC
  1610.        
  1611.         self.cubeInformation[npcVNUM] = []
  1612.        
  1613.         try:
  1614.             for eachInfoText in listText.split("/"):
  1615.                 eachInfo = eachInfoText.split(",")
  1616.                 itemVnum    = int(eachInfo[0])
  1617.                 itemCount   = int(eachInfo[1])
  1618.  
  1619.                 self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount})
  1620.                 self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount)
  1621.            
  1622.             resultCount = len(self.cubeInformation[npcVNUM])
  1623.             requestCount = 7
  1624.             modCount = resultCount % requestCount
  1625.             splitCount = resultCount / requestCount
  1626.             for i in xrange(splitCount):
  1627.                 #print("/cube r_info %d %d" % (i * requestCount, requestCount))
  1628.                 net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
  1629.                
  1630.             if 0 < modCount:
  1631.                 #print("/cube r_info %d %d" % (splitCount * requestCount, modCount))               
  1632.                 net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1633.  
  1634.         except RuntimeError, msg:
  1635.             dbg.TraceError(msg)
  1636.             return 0
  1637.            
  1638.         pass
  1639.        
  1640.     def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText):
  1641.         # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000
  1642.         try:
  1643.             #print listText
  1644.            
  1645.             if 3 > len(listText):
  1646.                 dbg.TraceError("Wrong Cube Material Infomation")
  1647.                 return 0
  1648.  
  1649.            
  1650.            
  1651.             eachResultList = listText.split("@")
  1652.  
  1653.             cubeInfo = self.cubeInformation[self.currentCubeNPC]           
  1654.            
  1655.             itemIndex = 0
  1656.             for eachResultText in eachResultList:
  1657.                 cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []]
  1658.                 materialList = cubeInfo[startIndex + itemIndex]["materialList"]
  1659.                
  1660.                 gold = 0
  1661.                 splitResult = eachResultText.split("/")
  1662.                 if 1 < len(splitResult):
  1663.                     gold = int(splitResult[1])
  1664.                    
  1665.                 #print "splitResult : ", splitResult
  1666.                 eachMaterialList = splitResult[0].split("&")
  1667.                
  1668.                 i = 0
  1669.                 for eachMaterialText in eachMaterialList:
  1670.                     complicatedList = eachMaterialText.split("|")
  1671.                    
  1672.                     if 0 < len(complicatedList):
  1673.                         for complicatedText in complicatedList:
  1674.                             (itemVnum, itemCount) = complicatedText.split(",")
  1675.                             itemVnum = int(itemVnum)
  1676.                             itemCount = int(itemCount)
  1677.                             self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1678.                            
  1679.                             materialList[i].append((itemVnum, itemCount))
  1680.                            
  1681.                     else:
  1682.                         itemVnum, itemCount = eachMaterialText.split(",")
  1683.                         itemVnum = int(itemVnum)
  1684.                         itemCount = int(itemCount)
  1685.                         self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1686.                        
  1687.                         materialList[i].append((itemVnum, itemCount))
  1688.                        
  1689.                     i = i + 1
  1690.                    
  1691.                    
  1692.                    
  1693.                 itemIndex = itemIndex + 1
  1694.                
  1695.             self.interface.wndCube.Refresh()
  1696.            
  1697.                
  1698.         except RuntimeError, msg:
  1699.             dbg.TraceError(msg)
  1700.             return 0
  1701.            
  1702.         pass
  1703.    
  1704.     # END_OF_CUBE
  1705.    
  1706.     def BINARY_SetBigMessage(self, message):
  1707.         self.interface.bigBoard.SetTip(message)
  1708.  
  1709.     def BINARY_SetTipMessage(self, message):
  1710.         self.interface.tipBoard.SetTip(message)    
  1711.  
  1712.     def BINARY_AppendNotifyMessage(self, type):
  1713.         if not type in locale.NOTIFY_MESSAGE:
  1714.             return
  1715.         chat.AppendChat(chat.CHAT_TYPE_INFO, locale.NOTIFY_MESSAGE[type])
  1716.  
  1717.     def BINARY_Guild_EnterGuildArea(self, areaID):
  1718.         self.interface.BULID_EnterGuildArea(areaID)
  1719.  
  1720.     def BINARY_Guild_ExitGuildArea(self, areaID):
  1721.         self.interface.BULID_ExitGuildArea(areaID)
  1722.  
  1723.     def BINARY_GuildWar_OnSendDeclare(self, guildID):
  1724.         pass
  1725.  
  1726.     def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
  1727.         mainCharacterName = player.GetMainCharacterName()
  1728.         masterName = guild.GetGuildMasterName()
  1729.         if mainCharacterName == masterName:
  1730.             self.__GuildWar_OpenAskDialog(guildID, warType)
  1731.  
  1732.     def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
  1733.         self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
  1734.  
  1735.     def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
  1736.         self.interface.OnStartGuildWar(guildSelf, guildOpp)
  1737.  
  1738.     def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
  1739.         self.interface.OnEndGuildWar(guildSelf, guildOpp)
  1740.  
  1741.     def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
  1742.         self.interface.BINARY_SetObserverMode(isEnable)
  1743.  
  1744.     def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
  1745.         self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1746.  
  1747.     def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
  1748.         guildID1 = int(guildID1)
  1749.         guildID2 = int(guildID2)
  1750.         memberCount1 = int(memberCount1)
  1751.         memberCount2 = int(memberCount2)
  1752.         observerCount = int(observerCount)
  1753.  
  1754.         self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
  1755.         self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1756.  
  1757.     def __GuildWar_OpenAskDialog(self, guildID, warType):
  1758.  
  1759.         guildName = guild.GetGuildName(guildID)
  1760.  
  1761.         # REMOVED_GUILD_BUG_FIX
  1762.         if "Noname" == guildName:
  1763.             return
  1764.         # END_OF_REMOVED_GUILD_BUG_FIX
  1765.  
  1766.         import uiGuild
  1767.         questionDialog = uiGuild.AcceptGuildWarDialog()
  1768.         questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept)
  1769.         questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline)
  1770.         questionDialog.Open(guildName, warType)
  1771.  
  1772.         self.guildWarQuestionDialog = questionDialog
  1773.  
  1774.     def __GuildWar_CloseAskDialog(self):
  1775.         self.guildWarQuestionDialog.Close()
  1776.         self.guildWarQuestionDialog = None
  1777.  
  1778.     def __GuildWar_OnAccept(self):
  1779.  
  1780.         guildName = self.guildWarQuestionDialog.GetGuildName()
  1781.  
  1782.         net.SendChatPacket("/war " + guildName)
  1783.         self.__GuildWar_CloseAskDialog()
  1784.  
  1785.         return 1
  1786.  
  1787.     def __GuildWar_OnDecline(self):
  1788.  
  1789.         guildName = self.guildWarQuestionDialog.GetGuildName()
  1790.  
  1791.         net.SendChatPacket("/nowar " + guildName)
  1792.         self.__GuildWar_CloseAskDialog()
  1793.  
  1794.         return 1
  1795.     ## BINARY CALLBACK
  1796.     ######################################################################################
  1797.  
  1798.     def __ServerCommand_Build(self):
  1799.         serverCommandList={
  1800.             "ConsoleEnable"         : self.__Console_Enable,
  1801.             "DayMode"               : self.__DayMode_Update,
  1802.             "PRESERVE_DayMode"      : self.__PRESERVE_DayMode_Update,
  1803.             "CloseRestartWindow"    : self.__RestartDialog_Close,
  1804.             "OpenPrivateShop"       : self.__PrivateShop_Open,
  1805.             "PartyHealReady"        : self.PartyHealReady,
  1806.             "ShowMeSafeboxPassword" : self.AskSafeboxPassword,
  1807.             "CloseSafebox"          : self.CommandCloseSafebox,
  1808.  
  1809.             # ITEM_MALL
  1810.             "CloseMall"             : self.CommandCloseMall,
  1811.             "ShowMeMallPassword"    : self.AskMallPassword,
  1812.             "item_mall"             : self.__ItemMall_Open,
  1813.             # END_OF_ITEM_MALL
  1814.  
  1815.             "RefineSuceeded"        : self.RefineSuceededMessage,
  1816.             "RefineFailed"          : self.RefineFailedMessage,
  1817.             "xmas_snow"             : self.__XMasSnow_Enable,
  1818.             "xmas_boom"             : self.__XMasBoom_Enable,
  1819.             "xmas_song"             : self.__XMasSong_Enable,
  1820.             "xmas_tree"             : self.__XMasTree_Enable,
  1821.             "newyear_boom"          : self.__XMasBoom_Enable,
  1822.             "PartyRequest"          : self.__PartyRequestQuestion,
  1823.             "PartyRequestDenied"    : self.__PartyRequestDenied,
  1824.             "horse_state"           : self.__Horse_UpdateState,
  1825.             "hide_horse_state"      : self.__Horse_HideState,
  1826.             "WarUC"                 : self.__GuildWar_UpdateMemberCount,
  1827.             "test_server"           : self.__EnableTestServerFlag,
  1828.             "mall"          : self.__InGameShop_Show,
  1829.  
  1830.             # WEDDING
  1831.             "lover_login"           : self.__LoginLover,
  1832.             "lover_logout"          : self.__LogoutLover,
  1833.             "lover_near"            : self.__LoverNear,
  1834.             "lover_far"             : self.__LoverFar,
  1835.             "lover_divorce"         : self.__LoverDivorce,
  1836.             "PlayMusic"             : self.__PlayMusic,
  1837.             # END_OF_WEDDING
  1838.            
  1839.             "runeID"                    : self.SetRuneID,
  1840.             "openRune"                  : self.OpenRune,
  1841.             "setRune"                   : self.SetRune,
  1842.  
  1843.             # PRIVATE_SHOP_PRICE_LIST
  1844.             "MyShopPriceList"       : self.__PrivateShop_PriceList,
  1845.             # END_OF_PRIVATE_SHOP_PRICE_LIST
  1846.         }
  1847.  
  1848.         self.serverCommander=stringCommander.Analyzer()
  1849.         for serverCommandItem in serverCommandList.items():
  1850.             self.serverCommander.SAFE_RegisterCallBack(
  1851.                 serverCommandItem[0], serverCommandItem[1]
  1852.             )
  1853.  
  1854.     def BINARY_ServerCommand_Run(self, line):
  1855.         #dbg.TraceError(line)
  1856.         try:
  1857.             #print " BINARY_ServerCommand_Run", line
  1858.             return self.serverCommander.Run(line)
  1859.         except RuntimeError, msg:
  1860.             dbg.TraceError(msg)
  1861.             return 0
  1862.  
  1863.     def __ProcessPreservedServerCommand(self):
  1864.         try:
  1865.             command = net.GetPreservedServerCommand()
  1866.             while command:
  1867.                 print " __ProcessPreservedServerCommand", command
  1868.                 self.serverCommander.Run(command)
  1869.                 command = net.GetPreservedServerCommand()
  1870.         except RuntimeError, msg:
  1871.             dbg.TraceError(msg)
  1872.             return 0
  1873.  
  1874.     def PartyHealReady(self):
  1875.         self.interface.PartyHealReady()
  1876.  
  1877.     def AskSafeboxPassword(self):
  1878.         self.interface.AskSafeboxPassword()
  1879.  
  1880.     # ITEM_MALL
  1881.     def AskMallPassword(self):
  1882.         self.interface.AskMallPassword()
  1883.  
  1884.     def __ItemMall_Open(self):
  1885.         self.interface.OpenItemMall();
  1886.  
  1887.     def CommandCloseMall(self):
  1888.         self.interface.CommandCloseMall()
  1889.     # END_OF_ITEM_MALL
  1890.  
  1891.     def RefineSuceededMessage(self):
  1892.         snd.PlaySound("sound/ui/make_soket.wav")
  1893.         self.PopupMessage(locale.REFINE_SUCCESS)
  1894.  
  1895.     def RefineFailedMessage(self):
  1896.         snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1897.         self.PopupMessage(locale.REFINE_FAILURE)
  1898.  
  1899.     def CommandCloseSafebox(self):
  1900.         self.interface.CommandCloseSafebox()
  1901.  
  1902.     # PRIVATE_SHOP_PRICE_LIST
  1903.     def __PrivateShop_PriceList(self, itemVNum, itemPrice):
  1904.         uiPrivateShopBuilder.SetPrivateShopItemPrice(itemVNum, itemPrice)  
  1905.     # END_OF_PRIVATE_SHOP_PRICE_LIST
  1906.  
  1907.     def __Horse_HideState(self):
  1908.         self.affectShower.SetHorseState(0, 0, 0)
  1909.  
  1910.     def __Horse_UpdateState(self, level, health, battery):
  1911.         self.affectShower.SetHorseState(int(level), int(health), int(battery))
  1912.  
  1913.     def __IsXMasMap(self):
  1914.         mapDict = ( "metin2_map_n_flame_01",
  1915.                     "metin2_map_n_desert_01",
  1916.                     "metin2_map_spiderdungeon",
  1917.                     "metin2_map_deviltower1", )
  1918.  
  1919.         if background.GetCurrentMapName() in mapDict:
  1920.             return FALSE
  1921.  
  1922.         return TRUE
  1923.  
  1924.     def __XMasSnow_Enable(self, mode):
  1925.  
  1926.         self.__XMasSong_Enable(mode)
  1927.  
  1928.         if "1"==mode:
  1929.  
  1930.             if not self.__IsXMasMap():
  1931.                 return
  1932.  
  1933.             print "XMAS_SNOW ON"
  1934.             background.EnableSnow(1)
  1935.  
  1936.         else:
  1937.             print "XMAS_SNOW OFF"
  1938.             background.EnableSnow(0)
  1939.  
  1940.     def __XMasBoom_Enable(self, mode):
  1941.         if "1"==mode:
  1942.  
  1943.             if not self.__IsXMasMap():
  1944.                 return
  1945.  
  1946.             print "XMAS_BOOM ON"
  1947.             self.__DayMode_Update("dark")
  1948.             self.enableXMasBoom = TRUE
  1949.             self.startTimeXMasBoom = app.GetTime()
  1950.         else:
  1951.             print "XMAS_BOOM OFF"
  1952.             self.__DayMode_Update("light")
  1953.             self.enableXMasBoom = FALSE
  1954.  
  1955.     def __XMasTree_Enable(self, grade):
  1956.  
  1957.         print "XMAS_TREE ", grade
  1958.         background.SetXMasTree(int(grade))
  1959.  
  1960.     def __XMasSong_Enable(self, mode):
  1961.         if "1"==mode:
  1962.             print "XMAS_SONG ON"
  1963.  
  1964.             XMAS_BGM = "xmas.mp3"
  1965.  
  1966.             if app.IsExistFile("BGM/" + XMAS_BGM)==1:
  1967.                 if musicInfo.fieldMusic != "":
  1968.                     snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  1969.  
  1970.                 musicInfo.fieldMusic=XMAS_BGM
  1971.                 snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  1972.  
  1973.         else:
  1974.             print "XMAS_SONG OFF"
  1975.  
  1976.             if musicInfo.fieldMusic != "":
  1977.                 snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  1978.  
  1979.             musicInfo.fieldMusic=musicInfo.METIN2THEMA
  1980.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  1981.  
  1982.     def __RestartDialog_Close(self):
  1983.         self.interface.CloseRestartDialog()
  1984.  
  1985.     def __Console_Enable(self):
  1986.         constInfo.CONSOLE_ENABLE = TRUE
  1987.         self.consoleEnable = TRUE
  1988.         app.EnableSpecialCameraMode()
  1989.         ui.EnablePaste(TRUE)
  1990.  
  1991.     ## PrivateShop
  1992.     def __PrivateShop_Open(self):
  1993.         self.interface.OpenPrivateShopInputNameDialog()
  1994.  
  1995.     def BINARY_PrivateShop_Appear(self, vid, text):
  1996.         self.interface.AppearPrivateShop(vid, text)
  1997.  
  1998.     def BINARY_PrivateShop_Disappear(self, vid):
  1999.         self.interface.DisappearPrivateShop(vid)
  2000.  
  2001.     ## DayMode
  2002.     def __PRESERVE_DayMode_Update(self, mode):
  2003.         if "light"==mode:
  2004.             background.SetEnvironmentData(0)
  2005.         elif "dark"==mode:
  2006.  
  2007.             if not self.__IsXMasMap():
  2008.                 return
  2009.  
  2010.             background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2011.             background.SetEnvironmentData(1)
  2012.  
  2013.     def __DayMode_Update(self, mode):
  2014.         if "light"==mode:
  2015.             self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
  2016.         elif "dark"==mode:
  2017.  
  2018.             if not self.__IsXMasMap():
  2019.                 return
  2020.  
  2021.             self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
  2022.  
  2023.     def __DayMode_OnCompleteChangeToLight(self):
  2024.         background.SetEnvironmentData(0)
  2025.         self.curtain.FadeIn()
  2026.  
  2027.     def __DayMode_OnCompleteChangeToDark(self):
  2028.         background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2029.         background.SetEnvironmentData(1)
  2030.         self.curtain.FadeIn()
  2031.  
  2032.     ## XMasBoom
  2033.     def __XMasBoom_Update(self):
  2034.  
  2035.         self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
  2036.         if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
  2037.             return
  2038.  
  2039.         boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
  2040.         boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
  2041.  
  2042.         if app.GetTime() - self.startTimeXMasBoom > boomTime:
  2043.  
  2044.             self.indexXMasBoom += 1
  2045.  
  2046.             for i in xrange(boomCount):
  2047.                 self.__XMasBoom_Boom()
  2048.  
  2049.     def __XMasBoom_Boom(self):
  2050.         x, y, z = player.GetMainCharacterPosition()
  2051.         randX = app.GetRandom(-150, 150)
  2052.         randY = app.GetRandom(-150, 150)
  2053.  
  2054.         snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
  2055.  
  2056.     def __PartyRequestQuestion(self, vid):
  2057.         vid = int(vid)
  2058.         partyRequestQuestionDialog = uiCommon.QuestionDialog()
  2059.         partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + locale.PARTY_DO_YOU_ACCEPT)
  2060.         partyRequestQuestionDialog.SetAcceptText(locale.UI_ACCEPT)
  2061.         partyRequestQuestionDialog.SetCancelText(locale.UI_DENY)
  2062.         partyRequestQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.__AnswerPartyRequest(arg))
  2063.         partyRequestQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.__AnswerPartyRequest(arg))
  2064.         partyRequestQuestionDialog.Open()
  2065.         partyRequestQuestionDialog.vid = vid
  2066.         self.partyRequestQuestionDialog = partyRequestQuestionDialog
  2067.  
  2068.     def __AnswerPartyRequest(self, answer):
  2069.         if not self.partyRequestQuestionDialog:
  2070.             return
  2071.  
  2072.         vid = self.partyRequestQuestionDialog.vid
  2073.  
  2074.         if answer:
  2075.             net.SendChatPacket("/party_request_accept " + str(vid))
  2076.         else:
  2077.             net.SendChatPacket("/party_request_deny " + str(vid))
  2078.  
  2079.         self.partyRequestQuestionDialog.Close()
  2080.         self.partyRequestQuestionDialog = None
  2081.  
  2082.     def __PartyRequestDenied(self):
  2083.         self.PopupMessage(locale.PARTY_REQUEST_DENIED)
  2084.  
  2085.     def __EnableTestServerFlag(self):
  2086.         app.EnableTestServerFlag()
  2087.  
  2088.     def __InGameShop_Show(self, url):
  2089.         if constInfo.IN_GAME_SHOP_ENABLE:
  2090.             self.interface.OpenWebWindow(url)
  2091.  
  2092.     # WEDDING
  2093.     def __LoginLover(self):
  2094.         if self.interface.wndMessenger:
  2095.             self.interface.wndMessenger.OnLoginLover()
  2096.  
  2097.     def __LogoutLover(self):
  2098.         if self.interface.wndMessenger:
  2099.             self.interface.wndMessenger.OnLogoutLover()
  2100.         if self.affectShower:
  2101.             self.affectShower.HideLoverState()
  2102.  
  2103.     def __LoverNear(self):
  2104.         if self.affectShower:
  2105.             self.affectShower.ShowLoverState()
  2106.  
  2107.     def __LoverFar(self):
  2108.         if self.affectShower:
  2109.             self.affectShower.HideLoverState()
  2110.  
  2111.     def __LoverDivorce(self):
  2112.         if self.interface.wndMessenger:
  2113.             self.interface.wndMessenger.ClearLoverInfo()
  2114.         if self.affectShower:
  2115.             self.affectShower.ClearLoverState()
  2116.  
  2117.     def __PlayMusic(self, flag, filename):
  2118.         flag = int(flag)
  2119.         if flag:
  2120.             snd.FadeOutAllMusic()
  2121.             musicInfo.SaveLastPlayFieldMusic()
  2122.             snd.FadeInMusic("BGM/" + filename)
  2123.         else:
  2124.             snd.FadeOutAllMusic()
  2125.             musicInfo.LoadLastPlayFieldMusic()
  2126.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2127.     def OpenRune(self, data):
  2128.         self.dlgRune.OpenRune(data)
  2129.        
  2130.     def SetRune(self, text):
  2131.         data = text.split("#")
  2132.         self.dlgRune.SetData(int(data[0]), int(data[1]))
  2133.        
  2134.     def SetRuneID(self, id):
  2135.         constInfo.ID_RUNE = int(id)
  2136.  
  2137.     # END_OF_WEDDING
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement