Advertisement
Guest User

game.py

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