Advertisement
Guest User

Untitled

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