ZorkeOfficial

game.py

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