Advertisement
Guest User

Sw. by Mijago

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