Guest User

game.py galet

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