SHARE
TWEET

Untitled

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