Guest User

Untitled

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