Advertisement
Guest User

Untitled

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