Guest User

Untitled

a guest
Sep 9th, 2017
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 88.73 KB | None | 0 0
  1. import os
  2. import app
  3. import dbg
  4. import grp
  5. import item
  6. import background
  7. import chr
  8. import chrmgr
  9. import player
  10. import snd
  11. import chat
  12. import textTail
  13. import snd
  14. import net
  15. import effect
  16. import wndMgr
  17. import fly
  18. import systemSetting
  19. import quest
  20. import guild
  21. import skill
  22. import messenger
  23. import localeInfo
  24. import constInfo
  25. import exchange
  26. import ime
  27.  
  28. import ui
  29. import uiCommon
  30. import uiPhaseCurtain
  31. import uiMapNameShower
  32. import uiAffectShower
  33. import uiPlayerGauge
  34. import uiCharacter
  35. import uiTarget
  36. import time
  37.  
  38. # PRIVATE_SHOP_PRICE_LIST
  39. import uiPrivateShopBuilder
  40. # END_OF_PRIVATE_SHOP_PRICE_LIST
  41.  
  42. import mouseModule
  43. import consoleModule
  44. import localeInfo
  45.  
  46. import playerSettingModule
  47. import interfaceModule
  48.  
  49. import musicInfo
  50. import debugInfo
  51. if app.ENABLE_PVP_ADVANCED:
  52.     import constInfo as pvp
  53.     import uiCommon as message
  54.     import uiduel
  55. import uipetsystem
  56. import stringCommander
  57.  
  58. from _weakref import proxy
  59. from switchbot import Bot
  60. from stergeitem import CubodeBasura
  61.  
  62. # TEXTTAIL_LIVINGTIME_CONTROL
  63. #if localeInfo.IsJAPAN():
  64. #   app.SetTextTailLivingTime(8.0)
  65. # END_OF_TEXTTAIL_LIVINGTIME_CONTROL
  66.  
  67. # SCREENSHOT_CWDSAVE
  68. SCREENSHOT_CWDSAVE = FALSE
  69. SCREENSHOT_DIR = None
  70.  
  71. if localeInfo.IsEUROPE():
  72.     SCREENSHOT_CWDSAVE = TRUE
  73.  
  74. if localeInfo.IsCIBN10():
  75.     SCREENSHOT_CWDSAVE = FALSE
  76.     SCREENSHOT_DIR = "YT2W"
  77.  
  78. cameraDistance = 1550.0
  79. cameraPitch = 27.0
  80. cameraRotation = 0.0
  81. cameraHeight = 100.0
  82.  
  83. testAlignment = 0
  84. BPisLodaded = 0
  85.  
  86. class GameWindow(ui.ScriptWindow):
  87.     def __init__(self, stream):
  88.         ui.ScriptWindow.__init__(self, "GAME")
  89.         self.SetWindowName("game")
  90.         net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)
  91.         player.SetGameWindow(self)
  92.  
  93.         self.quickSlotPageIndex = 0
  94.         self.lastPKModeSendedTime = 0
  95.         self.pressNumber = None
  96.  
  97.     #ifdef OFFLINE_SHOP
  98.         self.uiNewShopCreate = None
  99.         self.uiNewShop = None
  100.     #endif
  101.  
  102.         self.guildWarQuestionDialog = None
  103.         self.interface = None
  104.         self.targetBoard = None
  105.         self.console = None
  106.         self.mapNameShower = None
  107.         self.affectShower = None
  108.         self.playerGauge = None
  109.  
  110.         self.stream=stream
  111.         self.interface = interfaceModule.Interface()
  112.         self.interface.SetStream(self.stream)
  113.         self.interface.MakeInterface()
  114.         self.interface.ShowDefaultWindows()
  115.         self.stream.isAutoSelect = 0
  116.  
  117.         self.curtain = uiPhaseCurtain.PhaseCurtain()
  118.         self.curtain.speed = 0.03
  119.         self.curtain.Hide()
  120.  
  121.         self.targetBoard = uiTarget.TargetBoard()
  122.         self.targetBoard.SetWhisperEvent(ui.__mem_func__(self.interface.OpenWhisperDialog))
  123.         self.targetBoard.Hide()
  124.  
  125.         self.petmain = uipetsystem.PetSystemMain()
  126.         self.petmini = uipetsystem.PetSystemMini()
  127.  
  128.  
  129.         self.console = consoleModule.ConsoleWindow()
  130.         self.console.BindGameClass(self)
  131.         self.console.SetConsoleSize(wndMgr.GetScreenWidth(), 200)
  132.         self.console.Hide()
  133.  
  134.         self.mapNameShower = uiMapNameShower.MapNameShower()
  135.         self.affectShower = uiAffectShower.AffectShower()
  136.         if app.ENABLE_PVP_ADVANCED:
  137.             self.wndDuelGui = uiduel.Initializate()
  138.             self.wndDuelLive = uiduel.WindowLiveInformations()
  139.  
  140.         if app.ENABLE_TITLE_SYSTEM:
  141.             import title_system
  142.             self.wndTitleSystem = title_system.Title_System()
  143.  
  144.         self.playerGauge = uiPlayerGauge.PlayerGauge(self)
  145.         self.playerGauge.Hide()
  146.        
  147.         self.switchbot = Bot()
  148.         self.switchbot.Hide()
  149.        
  150.         self.elimina = CubodeBasura()
  151.         self.elimina.Hide()
  152.        
  153.         #wj 2014.1.2. ESC۸¦ ´©¸¦ ˝Ă żěĽ±ŔűŔ¸·Î DropQuestionDialog¸¦ ˛ôµµ·Ď ¸¸µéľú´Ů. ÇĎÁö¸¸ ĂłŔ˝żˇ itemDropQuestionDialog°ˇ Ľ±ľđµÇľî ŔÖÁö ľĘľĆ ERROR°ˇ ąß»ýÇĎż© initżˇĽ­ Ľ±ľđ°ú µż˝Ăżˇ ĂʱâČ­ ˝ĂĹ´.
  154.         self.itemDropQuestionDialog = None
  155.  
  156.         self.__SetQuickSlotMode()
  157.  
  158.         self.__ServerCommand_Build()
  159.         self.__ProcessPreservedServerCommand()
  160.         if app.ENABLE_FEATURES_OXEVENT:
  161.             import uioxevent
  162.             self.eventWindowLogin = uioxevent.OxEventManagerLogin()
  163.             self.eventWindowManager = uioxevent.OxEventManager()
  164.             self.eventWindow = uioxevent.OxEventWinners()
  165.  
  166.     def __del__(self):
  167.         player.SetGameWindow(0)
  168.         net.ClearPhaseWindow(net.PHASE_WINDOW_GAME, self)
  169.         ui.ScriptWindow.__del__(self)
  170.  
  171.     def Open(self):
  172.         app.SetFrameSkip(1)
  173.  
  174.         self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  175.  
  176.         self.quickSlotPageIndex = 0
  177.         self.PickingCharacterIndex = -1
  178.         self.PickingItemIndex = -1
  179.         self.consoleEnable = FALSE
  180.         self.isShowDebugInfo = FALSE
  181.         self.ShowNameFlag = FALSE
  182.  
  183.     #ifdef OFFLINE_SHOP
  184.         import uiNewShop
  185.         self.uiNewShop = uiNewShop.ShopDialog()
  186.         self.uiNewShop.Close()
  187.         self.uiNewShopCreate = uiNewShop.ShopDialogCreate()
  188.         self.uiNewShopCreate.Hide()
  189.     #endif
  190.  
  191.         self.enableXMasBoom = FALSE
  192.         self.startTimeXMasBoom = 0.0
  193.         self.indexXMasBoom = 0
  194.  
  195.         global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  196.  
  197.         app.SetCamera(cameraDistance, cameraPitch, cameraRotation, cameraHeight)
  198.  
  199.         constInfo.SET_DEFAULT_CAMERA_MAX_DISTANCE()
  200.         constInfo.SET_DEFAULT_CHRNAME_COLOR()
  201.         constInfo.SET_DEFAULT_FOG_LEVEL()
  202.         constInfo.SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE()
  203.         constInfo.SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS()
  204.         constInfo.SET_DEFAULT_USE_SKILL_EFFECT_ENABLE()
  205.  
  206.         # TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  207.         constInfo.SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE()
  208.         # END_OF_TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  209.  
  210.         import event
  211.         event.SetLeftTimeString(localeInfo.UI_LEFT_TIME)
  212.  
  213.         textTail.EnablePKTitle(constInfo.PVPMODE_ENABLE)
  214.  
  215.         if constInfo.PVPMODE_TEST_ENABLE:
  216.             self.testPKMode = ui.TextLine()
  217.             self.testPKMode.SetFontName(localeInfo.UI_DEF_FONT)
  218.             self.testPKMode.SetPosition(0, 15)
  219.             self.testPKMode.SetWindowHorizontalAlignCenter()
  220.             self.testPKMode.SetHorizontalAlignCenter()
  221.             self.testPKMode.SetFeather()
  222.             self.testPKMode.SetOutline()
  223.             self.testPKMode.Show()
  224.  
  225.             self.testAlignment = ui.TextLine()
  226.             self.testAlignment.SetFontName(localeInfo.UI_DEF_FONT)
  227.             self.testAlignment.SetPosition(0, 35)
  228.             self.testAlignment.SetWindowHorizontalAlignCenter()
  229.             self.testAlignment.SetHorizontalAlignCenter()
  230.             self.testAlignment.SetFeather()
  231.             self.testAlignment.SetOutline()
  232.             self.testAlignment.Show()
  233.  
  234.         self.__BuildKeyDict()
  235.         self.__BuildDebugInfo()
  236.  
  237.         # PRIVATE_SHOP_PRICE_LIST
  238.         uiPrivateShopBuilder.Clear()
  239.         # END_OF_PRIVATE_SHOP_PRICE_LIST
  240.  
  241.         # UNKNOWN_UPDATE
  242.         exchange.InitTrading()
  243.         # END_OF_UNKNOWN_UPDATE
  244.  
  245.         if debugInfo.IsDebugMode():
  246.             self.ToggleDebugInfo()
  247.  
  248.         ## Sound
  249.         snd.SetMusicVolume(systemSetting.GetMusicVolume()*net.GetFieldMusicVolume())
  250.         snd.SetSoundVolume(systemSetting.GetSoundVolume())
  251.  
  252.         netFieldMusicFileName = net.GetFieldMusicFileName()
  253.         if netFieldMusicFileName:
  254.             snd.FadeInMusic("BGM/" + netFieldMusicFileName)
  255.         elif musicInfo.fieldMusic != "":                       
  256.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  257.  
  258.         self.__SetQuickSlotMode()
  259.         self.__SelectQuickPage(self.quickSlotPageIndex)
  260.  
  261.         self.SetFocus()
  262.         self.Show()
  263.         app.ShowCursor()
  264.  
  265.         net.SendEnterGamePacket()
  266.  
  267.         # START_GAME_ERROR_EXIT
  268.         try:
  269.             self.StartGame()
  270.         except:
  271.             import exception
  272.             exception.Abort("GameWindow.Open")
  273.         # END_OF_START_GAME_ERROR_EXIT
  274.        
  275.         # NPC°ˇ ĹĄşę˝Ă˝şĹŰŔ¸·Î ¸¸µé Ľö ŔÖ´Â ľĆŔĚĹ۵éŔÇ ¸ń·ĎŔ» Äł˝Ě
  276.         # ex) cubeInformation[20383] = [ {"rewordVNUM": 72723, "rewordCount": 1, "materialInfo": "101,1&102,2", "price": 999 }, ... ]
  277.         self.cubeInformation = {}
  278.         self.currentCubeNPC = 0
  279.        
  280.     def Close(self):
  281.         self.Hide()
  282.  
  283.         global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  284.         (cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
  285.  
  286.         if musicInfo.fieldMusic != "":
  287.             snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
  288.  
  289.         self.onPressKeyDict = None
  290.         self.onClickKeyDict = None
  291.  
  292.     #ifdef OFFLINE_SHOP
  293.         self.uiNewShop.Hide()
  294.         self.uiNewShopCreate.Hide()
  295.         uiPrivateShopBuilder.Clear()
  296.     #endif
  297.  
  298.         chat.Close()
  299.         snd.StopAllSound()
  300.         grp.InitScreenEffect()
  301.         chr.Destroy()
  302.         textTail.Clear()
  303.         quest.Clear()
  304.         background.Destroy()
  305.         guild.Destroy()
  306.         messenger.Destroy()
  307.         skill.ClearSkillData()
  308.         wndMgr.Unlock()
  309.         mouseModule.mouseController.DeattachObject()
  310.  
  311.         if self.guildWarQuestionDialog:
  312.             self.guildWarQuestionDialog.Close()
  313.  
  314.         self.guildNameBoard = None
  315.         self.partyRequestQuestionDialog = None
  316.         self.partyInviteQuestionDialog = None
  317.         self.guildInviteQuestionDialog = None
  318.         self.guildWarQuestionDialog = None
  319.         self.messengerAddFriendQuestion = None
  320.  
  321.         # UNKNOWN_UPDATE
  322.         self.itemDropQuestionDialog = None
  323.         # END_OF_UNKNOWN_UPDATE
  324.  
  325.         # QUEST_CONFIRM
  326.         self.confirmDialog = None
  327.         # END_OF_QUEST_CONFIRM
  328.  
  329.         if app.TOURNAMENT_PVP_SYSTEM:
  330.             constInfo.TOURNAMENT_WINDOW_IS_SHOWED = 0
  331.  
  332.         self.PrintCoord = None
  333.         self.FrameRate = None
  334.         self.Pitch = None
  335.         self.Splat = None
  336.         self.TextureNum = None
  337.         self.ObjectNum = None
  338.         self.ViewDistance = None
  339.         self.PrintMousePos = None
  340.  
  341.         self.ClearDictionary()
  342.         self.petmain.Close()
  343.         self.petmini.Close()
  344.  
  345.         self.playerGauge = None
  346.         self.mapNameShower = None
  347.         self.affectShower = None
  348.  
  349.         if self.console:
  350.             self.console.BindGameClass(0)
  351.             self.console.Close()
  352.             self.console=None
  353.  
  354.         if app.ENABLE_PVP_ADVANCED:
  355.             if self.wndDuelLive.IsShow():
  356.                 self.wndDuelLive.Hide()
  357.  
  358.         if self.targetBoard:
  359.             self.targetBoard.Destroy()
  360.             self.targetBoard = None
  361.  
  362.         if app.ENABLE_FEATURES_OXEVENT:
  363.             if self.eventWindowLogin:
  364.                 self.eventWindowLogin.Hide()
  365.                
  366.             if self.eventWindowManager:
  367.                 self.eventWindowManager.Hide()
  368.        
  369.             if self.eventWindow:
  370.                 self.eventWindow.Hide()
  371.  
  372.         if app.ENABLE_TITLE_SYSTEM:        
  373.             self.wndTitleSystem.Close()
  374.    
  375.         if self.interface:
  376.             self.interface.HideAllWindows()
  377.             self.interface.Close()
  378.             self.interface=None
  379.  
  380.         player.ClearSkillDict()
  381.         player.ResetCameraRotation()
  382.  
  383.         self.KillFocus()
  384.         app.HideCursor()
  385.  
  386.         print "---------------------------------------------------------------------------- CLOSE GAME WINDOW"
  387.  
  388.     def __BuildKeyDict(self):
  389.         onPressKeyDict = {}
  390.  
  391.         ##PressKey ´Â ´©¸Ł°í ŔÖ´Â µżľČ °čĽÓ ŔűżëµÇ´Â ŰŔĚ´Ů.
  392.        
  393.         ## ĽýŔÚ ´ÜĂŕŰ Äü˝˝·Ôżˇ ŔĚżëµČ´Ů.(ŔĚČÄ ĽýŔڵ鵵 Äü ˝˝·Ôżë żąľŕ)
  394.         ## F12 ´Â Ŭ¶ó µđąö±×żë ŰŔ̹ǷΠľ˛Áö ľĘ´Â °Ô ÁÁ´Ů.
  395.         onPressKeyDict[app.DIK_1]   = lambda : self.__PressNumKey(1)
  396.         onPressKeyDict[app.DIK_2]   = lambda : self.__PressNumKey(2)
  397.         onPressKeyDict[app.DIK_3]   = lambda : self.__PressNumKey(3)
  398.         onPressKeyDict[app.DIK_4]   = lambda : self.__PressNumKey(4)
  399.         onPressKeyDict[app.DIK_5]   = lambda : self.__PressNumKey(5)
  400.         onPressKeyDict[app.DIK_6]   = lambda : self.__PressNumKey(6)
  401.         onPressKeyDict[app.DIK_7]   = lambda : self.__PressNumKey(7)
  402.         onPressKeyDict[app.DIK_8]   = lambda : self.__PressNumKey(8)
  403.         onPressKeyDict[app.DIK_9]   = lambda : self.__PressNumKey(9)
  404.         onPressKeyDict[app.DIK_F1]  = lambda : self.__PressQuickSlot(4)
  405.         onPressKeyDict[app.DIK_F2]  = lambda : self.__PressQuickSlot(5)
  406.         onPressKeyDict[app.DIK_F3]  = lambda : self.__PressQuickSlot(6)
  407.         onPressKeyDict[app.DIK_F4]  = lambda : self.__PressQuickSlot(7)
  408. #       if app.ENABLE_TITLE_SYSTEM:
  409. #           onPressKeyDict[app.DIK_F5]      = lambda : self.OpenTitleSystem()
  410. #ifdef ACHIVEMENT_SYSTEM
  411. #       onPressKeyDict[app.DIK_F6]  = lambda : self.OpenAchievementsystemWindow()
  412. #endif
  413.         #onPressKeyDict[app.DIK_F5]     = lambda : self.GenerateListVnumDragonSoul()   
  414.  
  415.         onPressKeyDict[app.DIK_LALT]        = lambda : self.ShowName()
  416.         onPressKeyDict[app.DIK_LCONTROL]    = lambda : self.ShowMouseImage()
  417.         onPressKeyDict[app.DIK_SYSRQ]       = lambda : self.SaveScreen()
  418.         onPressKeyDict[app.DIK_SPACE]       = lambda : self.StartAttack()
  419.  
  420.         #Äł¸ŻĹÍ Ŕ̵żĹ°
  421.         onPressKeyDict[app.DIK_UP]          = lambda : self.MoveUp()
  422.         onPressKeyDict[app.DIK_DOWN]        = lambda : self.MoveDown()
  423.         onPressKeyDict[app.DIK_LEFT]        = lambda : self.MoveLeft()
  424.         onPressKeyDict[app.DIK_RIGHT]       = lambda : self.MoveRight()
  425.         onPressKeyDict[app.DIK_W]           = lambda : self.MoveUp()
  426.         onPressKeyDict[app.DIK_S]           = lambda : self.MoveDown()
  427.         onPressKeyDict[app.DIK_A]           = lambda : self.MoveLeft()
  428.         onPressKeyDict[app.DIK_D]           = lambda : self.MoveRight()
  429.  
  430.         onPressKeyDict[app.DIK_E]           = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
  431.         onPressKeyDict[app.DIK_R]           = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
  432.         #onPressKeyDict[app.DIK_F]          = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  433.         onPressKeyDict[app.DIK_T]           = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
  434.         onPressKeyDict[app.DIK_G]           = self.__PressGKey
  435.         onPressKeyDict[app.DIK_Q]           = self.__PressQKey
  436.         onPressKeyDict[app.DIK_P]           = self.__PressPKey
  437.  
  438.         onPressKeyDict[app.DIK_NUMPAD9]     = lambda: app.MovieResetCamera()
  439.         onPressKeyDict[app.DIK_NUMPAD4]     = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
  440.         onPressKeyDict[app.DIK_NUMPAD6]     = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)
  441.         onPressKeyDict[app.DIK_PGUP]        = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)
  442.         onPressKeyDict[app.DIK_PGDN]        = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
  443.         onPressKeyDict[app.DIK_NUMPAD8]     = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
  444.         onPressKeyDict[app.DIK_NUMPAD2]     = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
  445.         onPressKeyDict[app.DIK_GRAVE]       = lambda : self.PickUpItem()
  446.         onPressKeyDict[app.DIK_Z]           = lambda : self.PickUpItem()
  447.         onPressKeyDict[app.DIK_C]           = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
  448.         onPressKeyDict[app.DIK_V]           = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
  449.         #onPressKeyDict[app.DIK_B]          = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
  450.         onPressKeyDict[app.DIK_N]           = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
  451.         onPressKeyDict[app.DIK_I]           = lambda : self.interface.ToggleInventoryWindow()
  452.         onPressKeyDict[app.DIK_O]           = lambda : self.interface.ToggleDragonSoulWindowWithNoInfo()
  453.         onPressKeyDict[app.DIK_M]           = lambda : self.interface.PressMKey()
  454.         #onPressKeyDict[app.DIK_H]          = lambda : self.interface.OpenHelpWindow()
  455.         onPressKeyDict[app.DIK_ADD]         = lambda : self.interface.MiniMapScaleUp()
  456.         onPressKeyDict[app.DIK_SUBTRACT]    = lambda : self.interface.MiniMapScaleDown()
  457.         onPressKeyDict[app.DIK_L]           = lambda : self.interface.ToggleChatLogWindow()
  458.         onPressKeyDict[app.DIK_COMMA]       = lambda : self.ShowConsole()       # "`" key
  459.         onPressKeyDict[app.DIK_LSHIFT]      = lambda : self.__SetQuickPageMode()
  460.  
  461.         onPressKeyDict[app.DIK_J]           = lambda : self.__PressJKey()
  462.         onPressKeyDict[app.DIK_H]           = lambda : self.__PressHKey()
  463.         onPressKeyDict[app.DIK_B]           = lambda : self.__PressBKey()
  464.         onPressKeyDict[app.DIK_F]           = lambda : self.__PressFKey()
  465.  
  466.         # CUBE_TEST
  467.         #onPressKeyDict[app.DIK_K]          = lambda : self.interface.OpenCubeWindow()
  468.         # CUBE_TEST_END
  469.  
  470.         self.onPressKeyDict = onPressKeyDict
  471.  
  472.         onClickKeyDict = {}
  473.         onClickKeyDict[app.DIK_UP] = lambda : self.StopUp()
  474.         onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown()
  475.         onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft()
  476.         onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight()
  477.         onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack()
  478.  
  479.         onClickKeyDict[app.DIK_W] = lambda : self.StopUp()
  480.         onClickKeyDict[app.DIK_S] = lambda : self.StopDown()
  481.         onClickKeyDict[app.DIK_A] = lambda : self.StopLeft()
  482.         onClickKeyDict[app.DIK_D] = lambda : self.StopRight()
  483.         onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP)
  484.         onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP)
  485.         onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  486.         onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  487.         onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP)
  488.         onClickKeyDict[app.DIK_G] = lambda: self.__ReleaseGKey()
  489.         onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  490.         onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  491.         onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  492.         onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  493.         onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  494.         onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  495.         onClickKeyDict[app.DIK_LALT] = lambda: self.HideName()
  496.         onClickKeyDict[app.DIK_LCONTROL] = lambda: self.HideMouseImage()
  497.         onClickKeyDict[app.DIK_LSHIFT] = lambda: self.__SetQuickSlotMode()
  498.         onClickKeyDict[app.DIK_P] = lambda: self.OpenPetMainGui()
  499.  
  500.         #if constInfo.PVPMODE_ACCELKEY_ENABLE:
  501.         #   onClickKeyDict[app.DIK_B] = lambda: self.ChangePKMode()
  502.  
  503.         self.onClickKeyDict=onClickKeyDict
  504.  
  505.     def __PressNumKey(self,num):
  506.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  507.  
  508.             if num >= 1 and num <= 9:
  509.                 mapDict = ( "season1/metin2_map_oxevent", )
  510.                 if background.GetCurrentMapName() in mapDict and str(player.GetName())[0] != "[":
  511.                     chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CANNOT_EMOTION_HERE)
  512.                 elif(chrmgr.IsPossibleEmoticon(-1)):
  513.                     chrmgr.SetEmoticon(-1,int(num)-1)
  514.                     net.SendEmoticon(int(num)-1)
  515.         else:
  516.             if num >= 1 and num <= 4:
  517.                 self.pressNumber(num-1)
  518.  
  519.     def __ClickBKey(self):
  520.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  521.             return
  522.         else:
  523.             if constInfo.PVPMODE_ACCELKEY_ENABLE:
  524.                 self.ChangePKMode()
  525.  
  526.     def __PressJKey(self):
  527.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  528.             if player.IsMountingHorse():
  529.                 net.SendChatPacket("/unmount")
  530.             else:
  531.                 #net.SendChatPacket("/user_horse_ride")
  532.                 if not uiPrivateShopBuilder.IsBuildingPrivateShop():
  533.                     for i in xrange(player.INVENTORY_PAGE_SIZE):
  534.                         if player.GetItemIndex(i) in (71114, 71116, 71118, 71120):
  535.                             net.SendItemUsePacket(i)
  536.                             break
  537.     def __PressHKey(self):
  538.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  539.             net.SendChatPacket("/user_horse_ride")
  540.         else:
  541.             self.interface.OpenHelpWindow()
  542.  
  543.     def __PressBKey(self):
  544.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  545.             net.SendChatPacket("/user_horse_back")
  546.         else:
  547.             state = "EMOTICON"
  548.             self.interface.ToggleCharacterWindow(state)
  549.  
  550.     def __PressFKey(self):
  551.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  552.             net.SendChatPacket("/user_horse_feed") 
  553.         else:
  554.             app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  555.  
  556.     def __PressGKey(self):
  557.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  558.             net.SendChatPacket("/ride")
  559.         else:
  560.             if self.ShowNameFlag:
  561.                 self.interface.ToggleGuildWindow()
  562.             else:
  563.                 app.PitchCamera(app.CAMERA_TO_POSITIVE)
  564.  
  565.     def __ReleaseGKey(self):
  566.         app.PitchCamera(app.CAMERA_STOP)
  567.  
  568.     if app.ENABLE_TITLE_SYSTEM:
  569.         def OpenTitleSystem(self):     
  570.             self.wndTitleSystem.OpenWindow()
  571.  
  572. #ifdef ACHIVEMENT_SYSTEM
  573.     def OpenAchievementsystemWindow(self):
  574.         import uiAchievements
  575.         self.achievement = uiAchievements.AchievementWindow()
  576.         self.achievement.Open()
  577. #endif
  578.  
  579.     def __PressQKey(self):
  580.         if (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
  581.             if (interfaceModule.IsQBHide == 0):
  582.                 interfaceModule.IsQBHide = 1
  583.                 self.interface.HideAllQuestButton()
  584.             else:
  585.                 interfaceModule.IsQBHide = 0
  586.                 self.interface.ShowAllQuestButton()
  587.         else:
  588.             app.RotateCamera(app.CAMERA_TO_NEGATIVE)
  589.  
  590.     def __PressPKey(self):
  591.         if (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
  592.             if (interfaceModule.IsWhisperHide == 0):
  593.                 interfaceModule.IsWhisperHide = 1
  594.                 self.interface.HideAllWhisperButton()
  595.             else:
  596.                 interfaceModule.IsWhisperHide = 0
  597.                 self.interface.ShowAllWhisperButton()
  598.  
  599.     def __SetQuickSlotMode(self):
  600.         self.pressNumber=ui.__mem_func__(self.__PressQuickSlot)
  601.  
  602.     def __SetQuickPageMode(self):
  603.         self.pressNumber=ui.__mem_func__(self.__SelectQuickPage)
  604.  
  605.     def __PressQuickSlot(self, localSlotIndex):
  606.         player.RequestUseLocalQuickSlot(localSlotIndex)    
  607.  
  608.     def __SelectQuickPage(self, pageIndex):
  609.         self.quickSlotPageIndex = pageIndex
  610.         player.SetQuickPage(pageIndex)
  611.  
  612.     def ToggleDebugInfo(self):
  613.         self.isShowDebugInfo = not self.isShowDebugInfo
  614.  
  615.         if self.isShowDebugInfo:
  616.             self.PrintCoord.Show()
  617.             self.FrameRate.Show()
  618.             self.Pitch.Show()
  619.             self.Splat.Show()
  620.             self.TextureNum.Show()
  621.             self.ObjectNum.Show()
  622.             self.ViewDistance.Show()
  623.             self.PrintMousePos.Show()
  624.         else:
  625.             self.PrintCoord.Hide()
  626.             self.FrameRate.Hide()
  627.             self.Pitch.Hide()
  628.             self.Splat.Hide()
  629.             self.TextureNum.Hide()
  630.             self.ObjectNum.Hide()
  631.             self.ViewDistance.Hide()
  632.             self.PrintMousePos.Hide()
  633.  
  634.     def __BuildDebugInfo(self):
  635.         ## Character Position Coordinate
  636.         self.PrintCoord = ui.TextLine()
  637.         self.PrintCoord.SetFontName(localeInfo.UI_DEF_FONT)
  638.         self.PrintCoord.SetPosition(wndMgr.GetScreenWidth() - 270, 0)
  639.        
  640.         ## Frame Rate
  641.         self.FrameRate = ui.TextLine()
  642.         self.FrameRate.SetFontName(localeInfo.UI_DEF_FONT)
  643.         self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
  644.  
  645.         ## Camera Pitch
  646.         self.Pitch = ui.TextLine()
  647.         self.Pitch.SetFontName(localeInfo.UI_DEF_FONT)
  648.         self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
  649.  
  650.         ## Splat
  651.         self.Splat = ui.TextLine()
  652.         self.Splat.SetFontName(localeInfo.UI_DEF_FONT)
  653.         self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
  654.        
  655.         ##
  656.         self.PrintMousePos = ui.TextLine()
  657.         self.PrintMousePos.SetFontName(localeInfo.UI_DEF_FONT)
  658.         self.PrintMousePos.SetPosition(wndMgr.GetScreenWidth() - 270, 80)
  659.  
  660.         # TextureNum
  661.         self.TextureNum = ui.TextLine()
  662.         self.TextureNum.SetFontName(localeInfo.UI_DEF_FONT)
  663.         self.TextureNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
  664.  
  665.         # żŔşęÁ§Ć® ±×¸®´Â °łĽö
  666.         self.ObjectNum = ui.TextLine()
  667.         self.ObjectNum.SetFontName(localeInfo.UI_DEF_FONT)
  668.         self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 120)
  669.  
  670.         # ˝Ăľß°Ĺ¸®
  671.         self.ViewDistance = ui.TextLine()
  672.         self.ViewDistance.SetFontName(localeInfo.UI_DEF_FONT)
  673.         self.ViewDistance.SetPosition(0, 0)
  674.  
  675.     def __NotifyError(self, msg):
  676.         chat.AppendChat(chat.CHAT_TYPE_INFO, msg)
  677.  
  678.     def ChangePKMode(self):
  679.  
  680.         if not app.IsPressed(app.DIK_LCONTROL):
  681.             return
  682.  
  683.         if player.GetStatus(player.LEVEL)<constInfo.PVPMODE_PROTECTED_LEVEL:
  684.             self.__NotifyError(localeInfo.OPTION_PVPMODE_PROTECT % (constInfo.PVPMODE_PROTECTED_LEVEL))
  685.             return
  686.  
  687.         curTime = app.GetTime()
  688.         if curTime - self.lastPKModeSendedTime < constInfo.PVPMODE_ACCELKEY_DELAY:
  689.             return
  690.  
  691.         self.lastPKModeSendedTime = curTime
  692.  
  693.         curPKMode = player.GetPKMode()
  694.         nextPKMode = curPKMode + 1
  695.         if nextPKMode == player.PK_MODE_PROTECT:
  696.             if 0 == player.GetGuildID():
  697.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
  698.                 nextPKMode = 0
  699.             else:
  700.                 nextPKMode = player.PK_MODE_GUILD
  701.  
  702.         elif nextPKMode == player.PK_MODE_MAX_NUM:
  703.             nextPKMode = 0
  704.  
  705.         net.SendChatPacket("/PKMode " + str(nextPKMode))
  706.         print "/PKMode " + str(nextPKMode)
  707.  
  708.     def OnChangePKMode(self):
  709.  
  710.         self.interface.OnChangePKMode()
  711.  
  712.         try:
  713.             self.__NotifyError(localeInfo.OPTION_PVPMODE_MESSAGE_DICT[player.GetPKMode()])
  714.         except KeyError:
  715.             print "UNKNOWN PVPMode[%d]" % (player.GetPKMode())
  716.  
  717.         if constInfo.PVPMODE_TEST_ENABLE:
  718.             curPKMode = player.GetPKMode()
  719.             alignment, grade = chr.testGetPKData()
  720.             self.pkModeNameDict = { 0 : "PEACE", 1 : "REVENGE", 2 : "FREE", 3 : "PROTECT", }
  721.             self.testPKMode.SetText("Current PK Mode : " + self.pkModeNameDict.get(curPKMode, "UNKNOWN"))
  722.             self.testAlignment.SetText("Current Alignment : " + str(alignment) + " (" + localeInfo.TITLE_NAME_LIST[grade] + ")")
  723.  
  724.     ###############################################################################################
  725.     ###############################################################################################
  726.     ## Game Callback Functions
  727.  
  728.     # Start
  729.     def StartGame(self):
  730.         self.RefreshInventory()
  731.         self.RefreshEquipment()
  732.         self.RefreshCharacter()
  733.         self.RefreshSkill()
  734.  
  735.     # Refresh
  736.     def CheckGameButton(self):
  737.         if self.interface:
  738.             self.interface.CheckGameButton()
  739.  
  740.     def RefreshAlignment(self):
  741.         self.interface.RefreshAlignment()
  742.  
  743.     def RefreshStatus(self):
  744.         self.CheckGameButton()
  745.  
  746.         if self.interface:
  747.             self.interface.RefreshStatus()
  748.  
  749.         if self.playerGauge:
  750.             self.playerGauge.RefreshGauge()
  751.  
  752.     def RefreshStamina(self):
  753.         self.interface.RefreshStamina()
  754.  
  755.     def RefreshSkill(self):
  756.         self.CheckGameButton()
  757.         if self.interface:
  758.             self.interface.RefreshSkill()
  759.  
  760.     def RefreshQuest(self):
  761.         self.interface.RefreshQuest()
  762.  
  763.     def RefreshMessenger(self):
  764.         self.interface.RefreshMessenger()
  765.  
  766.     def RefreshGuildInfoPage(self):
  767.         self.interface.RefreshGuildInfoPage()
  768.  
  769.     def RefreshGuildBoardPage(self):
  770.         self.interface.RefreshGuildBoardPage()
  771.  
  772.     def RefreshGuildMemberPage(self):
  773.         self.interface.RefreshGuildMemberPage()
  774.  
  775.     def RefreshGuildMemberPageGradeComboBox(self):
  776.         self.interface.RefreshGuildMemberPageGradeComboBox()
  777.  
  778.     def RefreshGuildSkillPage(self):
  779.         self.interface.RefreshGuildSkillPage()
  780.  
  781.     def RefreshGuildGradePage(self):
  782.         self.interface.RefreshGuildGradePage()
  783.  
  784.     def RefreshMobile(self):
  785.         if self.interface:
  786.             self.interface.RefreshMobile()
  787.  
  788.     def OnMobileAuthority(self):
  789.         self.interface.OnMobileAuthority()
  790.  
  791.     def OnBlockMode(self, mode):
  792.         self.interface.OnBlockMode(mode)
  793.  
  794.     def OpenQuestWindow(self, skin, idx):
  795.         self.interface.OpenQuestWindow(skin, idx)
  796.  
  797.     def HideAllQuestWindow(self):
  798.         self.interface.HideAllQuestWindow()
  799.  
  800.     def AskGuildName(self):
  801.  
  802.         guildNameBoard = uiCommon.InputDialog()
  803.         guildNameBoard.SetTitle(localeInfo.GUILD_NAME)
  804.         guildNameBoard.SetAcceptEvent(ui.__mem_func__(self.ConfirmGuildName))
  805.         guildNameBoard.SetCancelEvent(ui.__mem_func__(self.CancelGuildName))
  806.         guildNameBoard.Open()
  807.  
  808.         self.guildNameBoard = guildNameBoard
  809.  
  810.     def ConfirmGuildName(self):
  811.         guildName = self.guildNameBoard.GetText()
  812.         if not guildName:
  813.             return
  814.  
  815.         if net.IsInsultIn(guildName):
  816.             self.PopupMessage(localeInfo.GUILD_CREATE_ERROR_INSULT_NAME)
  817.             return
  818.  
  819.         net.SendAnswerMakeGuildPacket(guildName)
  820.         self.guildNameBoard.Close()
  821.         self.guildNameBoard = None
  822.         return TRUE
  823.  
  824.     def CancelGuildName(self):
  825.         self.guildNameBoard.Close()
  826.         self.guildNameBoard = None
  827.         return TRUE
  828.  
  829.     ## Refine
  830.     def PopupMessage(self, msg):
  831.         self.stream.popupWindow.Close()
  832.         self.stream.popupWindow.Open(msg, 0, localeInfo.UI_OK)
  833.  
  834.     def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type=0):
  835.         self.interface.OpenRefineDialog(targetItemPos, nextGradeItemVnum, cost, prob, type)
  836.  
  837.     def AppendMaterialToRefineDialog(self, vnum, count):
  838.         self.interface.AppendMaterialToRefineDialog(vnum, count)
  839.  
  840.     def RunUseSkillEvent(self, slotIndex, coolTime):
  841.         self.interface.OnUseSkill(slotIndex, coolTime)
  842.  
  843.     def ClearAffects(self):
  844.         self.affectShower.ClearAffects()
  845.  
  846.     def SetAffect(self, affect):
  847.         self.affectShower.SetAffect(affect)
  848.  
  849.     def ResetAffect(self, affect):
  850.         self.affectShower.ResetAffect(affect)
  851.  
  852.     # UNKNOWN_UPDATE
  853.     def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  854.         self.affectShower.BINARY_NEW_AddAffect(type, pointIdx, value, duration)
  855.         if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  856.             self.interface.DragonSoulActivate(type - chr.NEW_AFFECT_DRAGON_SOUL_DECK1)
  857.         #elif chr.NEW_AFFECT_DRAGON_SOUL_QUALIFIED == type:
  858.         #   self.BINARY_DragonSoulGiveQualification()
  859.  
  860.     def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  861.         self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  862.         if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  863.             self.interface.DragonSoulDeactivate()
  864.    
  865.  
  866.  
  867.     # END_OF_UNKNOWN_UPDATE
  868.  
  869.     def ActivateSkillSlot(self, slotIndex):
  870.         if self.interface:
  871.             self.interface.OnActivateSkill(slotIndex)
  872.  
  873.     def DeactivateSkillSlot(self, slotIndex):
  874.         if self.interface:
  875.             self.interface.OnDeactivateSkill(slotIndex)
  876.  
  877.     def RefreshEquipment(self):
  878.         if self.interface:
  879.             self.interface.RefreshInventory()
  880.  
  881.     def RefreshInventory(self):
  882.         if self.interface:
  883.             self.interface.RefreshInventory()
  884.  
  885.     def RefreshCharacter(self):
  886.         if self.interface:
  887.             self.interface.RefreshCharacter()
  888.  
  889.     def OnGameOver(self):
  890.         self.CloseTargetBoard()
  891.         self.OpenRestartDialog()
  892.  
  893.     def OpenRestartDialog(self):
  894.         self.interface.OpenRestartDialog()
  895.  
  896.     def ChangeCurrentSkill(self, skillSlotNumber):
  897.         self.interface.OnChangeCurrentSkill(skillSlotNumber)
  898.  
  899.     ## TargetBoard
  900.     def SetPCTargetBoard(self, vid, name):
  901.         self.targetBoard.Open(vid, name)
  902.        
  903.         if app.IsPressed(app.DIK_LCONTROL):
  904.            
  905.             if not player.IsSameEmpire(vid):
  906.                 return
  907.  
  908.             if player.IsMainCharacterIndex(vid):
  909.                 return     
  910.             elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(vid):
  911.                 return
  912.  
  913.             self.interface.OpenWhisperDialog(name)
  914.            
  915.  
  916.     def RefreshTargetBoardByVID(self, vid):
  917.         self.targetBoard.RefreshByVID(vid)
  918.  
  919.     def RefreshTargetBoardByName(self, name):
  920.         self.targetBoard.RefreshByName(name)
  921.        
  922.     def __RefreshTargetBoard(self):
  923.         self.targetBoard.Refresh()
  924.        
  925.     def SetHPTargetBoard(self, vid, hpPercentage):
  926.         if vid != self.targetBoard.GetTargetVID():
  927.             self.targetBoard.ResetTargetBoard()
  928.             self.targetBoard.SetEnemyVID(vid)
  929.  
  930.         self.targetBoard.SetHP(hpPercentage)
  931.         self.targetBoard.Show()
  932.  
  933.     def CloseTargetBoardIfDifferent(self, vid):
  934.         if vid != self.targetBoard.GetTargetVID():
  935.             self.targetBoard.Close()
  936.  
  937.     def CloseTargetBoard(self):
  938.         self.targetBoard.Close()
  939.  
  940.     ## View Equipment
  941.     def OpenEquipmentDialog(self, vid):
  942.         if app.ENABLE_PVP_ADVANCED:
  943.             pvp.DUEL_IS_SHOW_EQUIP = 0
  944.             pvp.DUEL_SAVE_VID = (int(vid))
  945.  
  946.         self.interface.OpenEquipmentDialog(vid)
  947.  
  948.     def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
  949.         self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
  950.  
  951.     def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
  952.         self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
  953.  
  954.     def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
  955.         self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
  956.  
  957.     # SHOW_LOCAL_MAP_NAME
  958.     def ShowMapName(self, mapName, x, y):
  959.  
  960.         if self.mapNameShower:
  961.             self.mapNameShower.ShowMapName(mapName, x, y)
  962.  
  963.         if self.interface:
  964.             self.interface.SetMapName(mapName)
  965.     # END_OF_SHOW_LOCAL_MAP_NAME   
  966.  
  967.     def BINARY_OpenAtlasWindow(self):
  968.         self.interface.BINARY_OpenAtlasWindow()
  969.  
  970.     ## Chat
  971.     #def OnRecvWhisper(self, mode, name, line):
  972.     #   if mode == chat.WHISPER_TYPE_GM:
  973.     #       self.interface.RegisterGameMasterName(name)
  974.     #   chat.AppendWhisper(mode, name, line)
  975.     #   self.interface.RecvWhisper(name)
  976.  
  977.     def OnRecvWhisper(self, mode, name, line):
  978.         if mode != chat.WHISPER_TYPE_GM:
  979.             if os.path.exists("ignore.cfg"):
  980.                 ignored = open("ignore.cfg", "r")
  981.                 ignoredList = ignored.read()
  982.                 ignoredPlayer = ignoredList.split(",\n")
  983.                 ignored.close()
  984.                 for i in xrange(str(ignoredList).count(",\n")):
  985.                     if str(ignoredPlayer[i]) != name:
  986.                         pass
  987.                     else:
  988.                         return
  989.  
  990.         else:
  991.             self.interface.RegisterGameMasterName(name)
  992.         chat.AppendWhisper(mode, name, line)
  993.         self.interface.RecvWhisper(name)
  994.  
  995.     def OnRecvWhisperSystemMessage(self, mode, name, line):
  996.         chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
  997.         self.interface.RecvWhisper(name)
  998.  
  999.     def OnRecvWhisperError(self, mode, name, line):
  1000.         if localeInfo.WHISPER_ERROR.has_key(mode):
  1001.             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name))
  1002.         else:
  1003.             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
  1004.         self.interface.RecvWhisper(name)
  1005.  
  1006.     def RecvWhisper(self, name):
  1007.         self.interface.RecvWhisper(name)
  1008.  
  1009.     def OnPickMoney(self, money):
  1010.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_PICK_MONEY % (money))
  1011.  
  1012.     def OnShopError(self, type):
  1013.         try:
  1014.             self.PopupMessage(localeInfo.SHOP_ERROR_DICT[type])
  1015.         except KeyError:
  1016.             self.PopupMessage(localeInfo.SHOP_ERROR_UNKNOWN % (type))
  1017.  
  1018.     def OnSafeBoxError(self):
  1019.         self.PopupMessage(localeInfo.SAFEBOX_ERROR)
  1020.  
  1021.     def OnFishingSuccess(self, isFish, fishName):
  1022.         chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_SUCCESS(isFish, fishName), 2000)
  1023.  
  1024.     # ADD_FISHING_MESSAGE
  1025.     def OnFishingNotifyUnknown(self):
  1026.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_UNKNOWN)
  1027.  
  1028.     def OnFishingWrongPlace(self):
  1029.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_WRONG_PLACE)
  1030.     # END_OF_ADD_FISHING_MESSAGE
  1031.  
  1032.     def OnFishingNotify(self, isFish, fishName):
  1033.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_NOTIFY(isFish, fishName))
  1034.  
  1035.     def OnFishingFailure(self):
  1036.         chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_FAILURE, 2000)
  1037.  
  1038.     def OnCannotPickItem(self):
  1039.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_PICK_ITEM)
  1040.  
  1041.     # MINING
  1042.     def OnCannotMining(self):
  1043.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_MINING)
  1044.     # END_OF_MINING
  1045.  
  1046.     def OnCannotUseSkill(self, vid, type):
  1047.         if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
  1048.             textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type])
  1049.  
  1050.         if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
  1051.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type])
  1052.  
  1053.     def OnCannotShotError(self, vid, type):
  1054.         textTail.RegisterInfoTail(vid, localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type)))
  1055.  
  1056.     ## PointReset
  1057.     def StartPointReset(self):
  1058.         self.interface.OpenPointResetDialog()
  1059.  
  1060.     ## Shop
  1061.     def StartShop(self, vid):
  1062.         self.interface.OpenShopDialog(vid)
  1063.  
  1064.     def EndShop(self):
  1065.         self.interface.CloseShopDialog()
  1066.  
  1067.     def RefreshShop(self):
  1068.         self.interface.RefreshShopDialog()
  1069.  
  1070.     def SetShopSellingPrice(self, Price):
  1071.         pass
  1072.  
  1073.     ## Exchange
  1074.     def StartExchange(self):
  1075.         self.interface.StartExchange()
  1076.  
  1077.     def EndExchange(self):
  1078.         self.interface.EndExchange()
  1079.  
  1080.     def RefreshExchange(self):
  1081.         self.interface.RefreshExchange()
  1082.  
  1083.     ## Party
  1084.     def RecvPartyInviteQuestion(self, leaderVID, leaderName):
  1085.         partyInviteQuestionDialog = uiCommon.QuestionDialog()
  1086.         partyInviteQuestionDialog.SetText(leaderName + localeInfo.PARTY_DO_YOU_JOIN)
  1087.         partyInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerPartyInvite(arg))
  1088.         partyInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerPartyInvite(arg))
  1089.         partyInviteQuestionDialog.Open()
  1090.         partyInviteQuestionDialog.partyLeaderVID = leaderVID
  1091.         self.partyInviteQuestionDialog = partyInviteQuestionDialog
  1092.  
  1093.     def AnswerPartyInvite(self, answer):
  1094.         if not self.partyInviteQuestionDialog:
  1095.             return
  1096.  
  1097.         if str(player.GetName())[0] == "[" and str(player.GetName()) != "[GP]CrossFire" and str(player.GetName()) != "[GP]Savage":
  1098.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CANNOT_BECAUSE_GM)
  1099.             answer = FALSE
  1100.             self.partyInviteQuestionDialog.Close()
  1101.             self.partyInviteQuestionDialog = None
  1102.             return
  1103.  
  1104.         partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
  1105.  
  1106.         distance = player.GetCharacterDistance(partyLeaderVID)
  1107.         if distance < 0.0 or distance > 5000:
  1108.             answer = FALSE
  1109.  
  1110.         net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
  1111.  
  1112.         self.partyInviteQuestionDialog.Close()
  1113.         self.partyInviteQuestionDialog = None
  1114.  
  1115.     def AddPartyMember(self, pid, name):
  1116.         self.interface.AddPartyMember(pid, name)
  1117.  
  1118.     def UpdatePartyMemberInfo(self, pid):
  1119.         self.interface.UpdatePartyMemberInfo(pid)
  1120.  
  1121.     def RemovePartyMember(self, pid):
  1122.         self.interface.RemovePartyMember(pid)
  1123.         self.__RefreshTargetBoard()
  1124.  
  1125.     def LinkPartyMember(self, pid, vid):
  1126.         self.interface.LinkPartyMember(pid, vid)
  1127.  
  1128.     def UnlinkPartyMember(self, pid):
  1129.         self.interface.UnlinkPartyMember(pid)
  1130.  
  1131.     def UnlinkAllPartyMember(self):
  1132.         self.interface.UnlinkAllPartyMember()
  1133.  
  1134.     def ExitParty(self):
  1135.         self.interface.ExitParty()
  1136.         self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID())
  1137.  
  1138.     def ChangePartyParameter(self, distributionMode):
  1139.         self.interface.ChangePartyParameter(distributionMode)
  1140.  
  1141.     ## Messenger
  1142.     def OnMessengerAddFriendQuestion(self, name):
  1143.         messengerAddFriendQuestion = uiCommon.QuestionDialog2()
  1144.         messengerAddFriendQuestion.SetText1(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
  1145.         messengerAddFriendQuestion.SetText2(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2)
  1146.         messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend))
  1147.         messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend))
  1148.         messengerAddFriendQuestion.Open()
  1149.         messengerAddFriendQuestion.name = name
  1150.         self.messengerAddFriendQuestion = messengerAddFriendQuestion
  1151.  
  1152.     def OnAcceptAddFriend(self):
  1153.         name = self.messengerAddFriendQuestion.name
  1154.         net.SendChatPacket("/messenger_auth y " + name)
  1155.         self.OnCloseAddFriendQuestionDialog()
  1156.         return TRUE
  1157.  
  1158.     def OnDenyAddFriend(self):
  1159.         name = self.messengerAddFriendQuestion.name
  1160.         net.SendChatPacket("/messenger_auth n " + name)
  1161.         self.OnCloseAddFriendQuestionDialog()
  1162.         return TRUE
  1163.  
  1164.     def OnCloseAddFriendQuestionDialog(self):
  1165.         self.messengerAddFriendQuestion.Close()
  1166.         self.messengerAddFriendQuestion = None
  1167.         return TRUE
  1168.  
  1169.     ## SafeBox
  1170.     def OpenSafeboxWindow(self, size):
  1171.         self.interface.OpenSafeboxWindow(size)
  1172.  
  1173.     def RefreshSafebox(self):
  1174.         self.interface.RefreshSafebox()
  1175.  
  1176.     def RefreshSafeboxMoney(self):
  1177.         self.interface.RefreshSafeboxMoney()
  1178.  
  1179.     # ITEM_MALL
  1180.     def OpenMallWindow(self, size):
  1181.         self.interface.OpenMallWindow(size)
  1182.  
  1183.     def RefreshMall(self):
  1184.         self.interface.RefreshMall()
  1185.     # END_OF_ITEM_MALL
  1186.  
  1187.     ## Guild
  1188.     def RecvGuildInviteQuestion(self, guildID, guildName):
  1189.         guildInviteQuestionDialog = uiCommon.QuestionDialog()
  1190.         guildInviteQuestionDialog.SetText(guildName + localeInfo.GUILD_DO_YOU_JOIN)
  1191.         guildInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerGuildInvite(arg))
  1192.         guildInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerGuildInvite(arg))
  1193.         guildInviteQuestionDialog.Open()
  1194.         guildInviteQuestionDialog.guildID = guildID
  1195.         self.guildInviteQuestionDialog = guildInviteQuestionDialog
  1196.  
  1197.     def AnswerGuildInvite(self, answer):
  1198.  
  1199.         if not self.guildInviteQuestionDialog:
  1200.             return
  1201.  
  1202.         guildLeaderVID = self.guildInviteQuestionDialog.guildID
  1203.         net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
  1204.  
  1205.         self.guildInviteQuestionDialog.Close()
  1206.         self.guildInviteQuestionDialog = None
  1207.  
  1208.    
  1209.     def DeleteGuild(self):
  1210.         self.interface.DeleteGuild()
  1211.  
  1212.     ## Clock
  1213.     def ShowClock(self, second):
  1214.         self.interface.ShowClock(second)
  1215.  
  1216.     def HideClock(self):
  1217.         self.interface.HideClock()
  1218.  
  1219.     ## Emotion
  1220.     def BINARY_ActEmotion(self, emotionIndex):
  1221.         if self.interface.wndCharacter:
  1222.             self.interface.wndCharacter.ActEmotion(emotionIndex)
  1223.  
  1224.     ###############################################################################################
  1225.     ###############################################################################################
  1226.     ## Keyboard Functions
  1227.  
  1228.     def CheckFocus(self):
  1229.         if FALSE == self.IsFocus():
  1230.             if TRUE == self.interface.IsOpenChat():
  1231.                 self.interface.ToggleChat()
  1232.  
  1233.             self.SetFocus()
  1234.  
  1235.     def SaveScreen(self):
  1236.         print "save screen"
  1237.  
  1238.         # SCREENSHOT_CWDSAVE
  1239.         if SCREENSHOT_CWDSAVE:
  1240.             if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
  1241.                 os.mkdir(os.getcwd()+os.sep+"screenshot")
  1242.  
  1243.             (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep)
  1244.         elif SCREENSHOT_DIR:
  1245.             (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
  1246.         else:
  1247.             (succeeded, name) = grp.SaveScreenShot()
  1248.         # END_OF_SCREENSHOT_CWDSAVE
  1249.  
  1250.         if succeeded:
  1251.             pass
  1252.             """
  1253.             chat.AppendChat(chat.CHAT_TYPE_INFO, name + localeInfo.SCREENSHOT_SAVE1)
  1254.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE2)
  1255.             """
  1256.         else:
  1257.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE_FAILURE)
  1258.  
  1259.     def ShowConsole(self):
  1260.         if debugInfo.IsDebugMode() or TRUE == self.consoleEnable:
  1261.             player.EndKeyWalkingImmediately()
  1262.             self.console.OpenWindow()
  1263.  
  1264.     def ShowName(self):
  1265.         self.ShowNameFlag = TRUE
  1266.         self.playerGauge.EnableShowAlways()
  1267.         player.SetQuickPage(self.quickSlotPageIndex+1)
  1268.  
  1269.     # ADD_ALWAYS_SHOW_NAME
  1270.     def __IsShowName(self):
  1271.  
  1272.         if systemSetting.IsAlwaysShowName():
  1273.             return TRUE
  1274.  
  1275.         if self.ShowNameFlag:
  1276.             return TRUE
  1277.  
  1278.         return FALSE
  1279.     # END_OF_ADD_ALWAYS_SHOW_NAME
  1280.    
  1281.     def HideName(self):
  1282.         self.ShowNameFlag = FALSE
  1283.         self.playerGauge.DisableShowAlways()
  1284.         player.SetQuickPage(self.quickSlotPageIndex)
  1285.  
  1286.     def ShowMouseImage(self):
  1287.         self.interface.ShowMouseImage()
  1288.  
  1289.     def HideMouseImage(self):
  1290.         self.interface.HideMouseImage()
  1291.  
  1292.     def StartAttack(self):
  1293.         player.SetAttackKeyState(TRUE)
  1294.  
  1295.     def EndAttack(self):
  1296.         player.SetAttackKeyState(FALSE)
  1297.  
  1298.     def MoveUp(self):
  1299.         player.SetSingleDIKKeyState(app.DIK_UP, TRUE)
  1300.  
  1301.     def MoveDown(self):
  1302.         player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)
  1303.  
  1304.     def MoveLeft(self):
  1305.         player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)
  1306.  
  1307.     def MoveRight(self):
  1308.         player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)
  1309.  
  1310.     def StopUp(self):
  1311.         player.SetSingleDIKKeyState(app.DIK_UP, FALSE)
  1312.  
  1313.     def StopDown(self):
  1314.         player.SetSingleDIKKeyState(app.DIK_DOWN, FALSE)
  1315.  
  1316.     def StopLeft(self):
  1317.         player.SetSingleDIKKeyState(app.DIK_LEFT, FALSE)
  1318.  
  1319.     def StopRight(self):
  1320.         player.SetSingleDIKKeyState(app.DIK_RIGHT, FALSE)
  1321.  
  1322.     def PickUpItem(self):
  1323.         player.PickCloseItem()
  1324.  
  1325.     ###############################################################################################
  1326.     ###############################################################################################
  1327.     ## Event Handler
  1328.  
  1329.     def OnKeyDown(self, key):
  1330.         if self.interface.wndWeb and self.interface.wndWeb.IsShow():
  1331.             return
  1332.  
  1333.         if key == app.DIK_ESC:
  1334.             self.RequestDropItem(FALSE)
  1335.             constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1336.  
  1337.         try:
  1338.             self.onPressKeyDict[key]()
  1339.         except KeyError:
  1340.             pass
  1341.         except:
  1342.             raise
  1343.  
  1344.         return TRUE
  1345.  
  1346.     def OnKeyUp(self, key):
  1347.         try:
  1348.             self.onClickKeyDict[key]()
  1349.         except KeyError:
  1350.             pass
  1351.         except:
  1352.             raise
  1353.  
  1354.         return TRUE
  1355.  
  1356.     def OnMouseLeftButtonDown(self):
  1357.         if self.interface.BUILD_OnMouseLeftButtonDown():
  1358.             return
  1359.  
  1360.         if mouseModule.mouseController.isAttached():
  1361.             self.CheckFocus()
  1362.         else:
  1363.             hyperlink = ui.GetHyperlink()
  1364.             if hyperlink:
  1365.                 return
  1366.             else:
  1367.                 self.CheckFocus()
  1368.                 player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  1369.  
  1370.         return TRUE
  1371.  
  1372.     def OnMouseLeftButtonUp(self):
  1373.  
  1374.         if self.interface.BUILD_OnMouseLeftButtonUp():
  1375.             return
  1376.  
  1377.         if mouseModule.mouseController.isAttached():
  1378.  
  1379.             attachedType = mouseModule.mouseController.GetAttachedType()
  1380.             attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1381.             attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1382.             attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1383.  
  1384.             ## QuickSlot
  1385.             if player.SLOT_TYPE_QUICK_SLOT == attachedType:
  1386.                 player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)
  1387.  
  1388.             ## Inventory
  1389.             elif player.SLOT_TYPE_INVENTORY == attachedType:
  1390.  
  1391.                 if player.ITEM_MONEY == attachedItemIndex:
  1392.                     self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1393.                 else:
  1394.                     self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1395.  
  1396.             ## DragonSoul
  1397.             elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1398.                 self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1399.            
  1400.             mouseModule.mouseController.DeattachObject()
  1401.  
  1402.         else:
  1403.             hyperlink = ui.GetHyperlink()
  1404.             if hyperlink:
  1405.                 if app.IsPressed(app.DIK_LALT):
  1406.                     link = chat.GetLinkFromHyperlink(hyperlink)
  1407.                     ime.PasteString(link)
  1408.                 else:
  1409.                     self.interface.MakeHyperlinkTooltip(hyperlink)
  1410.                 return
  1411.             else:
  1412.                 player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  1413.  
  1414.         #player.EndMouseWalking()
  1415.         return TRUE
  1416.  
  1417.     def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
  1418.         if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1419.             attachedInvenType = player.SlotTypeToInvenType(attachedType)
  1420.             if TRUE == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1421.                 if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType:
  1422.                     self.stream.popupWindow.Close()
  1423.                     self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1424.                 else:
  1425.                     if chr.IsNPC(dstChrID):
  1426.                         net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1427.                     else:
  1428.                         if (str(player.GetName())[0] == "[" or str(chr.GetNameByVID(dstChrID))[0] == "[") and str(player.GetName()) != "[GP]CrossFire" and str(player.GetName()) != "[GP]Savage":
  1429.                             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CANNOT_BECAUSE_GM)
  1430.                         else:
  1431.                             net.SendExchangeStartPacket(dstChrID)
  1432.                             net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1433.             else:
  1434.                 self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1435.  
  1436.     def __PutMoney(self, attachedType, attachedMoney, dstChrID):
  1437.         if TRUE == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1438.             if str(player.GetName())[0] == "[" and str(player.GetName()) != "[GP]CrossFire" and str(player.GetName()) != "[GP]Savage":
  1439.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CANNOT_BECAUSE_GM)
  1440.             else:
  1441.                 net.SendExchangeStartPacket(dstChrID)
  1442.                 net.SendExchangeElkAddPacket(attachedMoney)
  1443.         else:
  1444.             self.__DropMoney(attachedType, attachedMoney)
  1445.  
  1446.     def __DropMoney(self, attachedType, attachedMoney):
  1447.         # PRIVATESHOP_DISABLE_ITEM_DROP - °łŔλóÁˇ ż­°í ŔÖ´Â µżľČ ľĆŔĚĹŰ ąö¸˛ ąćÁö
  1448.         if uiPrivateShopBuilder.IsBuildingPrivateShop():           
  1449.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1450.             return
  1451.         # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1452.        
  1453.         if attachedMoney>=1000:
  1454.             self.stream.popupWindow.Close()
  1455.             self.stream.popupWindow.Open(localeInfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeInfo.UI_OK)
  1456.             return
  1457.  
  1458.         itemDropQuestionDialog = uiCommon.QuestionDialog()
  1459.         itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_MONEY % (attachedMoney))
  1460.         itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1461.         itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1462.         itemDropQuestionDialog.Open()
  1463.         itemDropQuestionDialog.dropType = attachedType
  1464.         itemDropQuestionDialog.dropCount = attachedMoney
  1465.         itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
  1466.         self.itemDropQuestionDialog = itemDropQuestionDialog
  1467.  
  1468.     def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
  1469.         # PRIVATESHOP_DISABLE_ITEM_DROP - °łŔλóÁˇ ż­°í ŔÖ´Â µżľČ ľĆŔĚĹŰ ąö¸˛ ąćÁö
  1470.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1471.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1472.             return
  1473.         # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1474.        
  1475.         if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos):
  1476.             self.stream.popupWindow.Close()
  1477.             self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1478.  
  1479.         else:
  1480.             mapDict = ( "season1/metin2_map_oxevent", )
  1481.             if background.GetCurrentMapName() in mapDict and str(player.GetName()) != "[GP]CrossFire" and str(player.GetName()) != "[GP]Savage":
  1482.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CANNOT_DROP_HERE)
  1483.  
  1484.             elif str(player.GetName())[0] == "[" and str(player.GetName()) != "[GP]CrossFire" and str(player.GetName()) != "[GP]Savage":
  1485.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CANNOT_BECAUSE_GM)
  1486.  
  1487.             elif player.SLOT_TYPE_INVENTORY == attachedType:
  1488.                 dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
  1489.  
  1490.                 item.SelectItem(dropItemIndex)
  1491.                 dropItemName = item.GetItemName()
  1492.  
  1493.                 ## Question Text
  1494.                 questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1495.  
  1496.                 ## Dialog
  1497.                 # itemDropQuestionDialog = uiCommon.QuestionDialog()
  1498.                 itemDropQuestionDialog = uiCommon.QuestionDialog_drop()
  1499.                 itemDropQuestionDialog.SetText(questionText)
  1500.                 itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1501.                 itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1502.                 itemDropQuestionDialog.Open()
  1503.                 itemDropQuestionDialog.dropType = attachedType
  1504.                 itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1505.                 itemDropQuestionDialog.dropCount = attachedItemCount
  1506.                 self.itemDropQuestionDialog = itemDropQuestionDialog
  1507.  
  1508.                 constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1509.             elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1510.                 dropItemIndex = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, attachedItemSlotPos)
  1511.  
  1512.                 item.SelectItem(dropItemIndex)
  1513.                 dropItemName = item.GetItemName()
  1514.  
  1515.                 ## Question Text
  1516.                 questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1517.  
  1518.                 ## Dialog
  1519.                 itemDropQuestionDialog = uiCommon.QuestionDialog()
  1520.                 itemDropQuestionDialog.SetText(questionText)
  1521.                 itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1522.                 itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1523.                 itemDropQuestionDialog.Open()
  1524.                 itemDropQuestionDialog.dropType = attachedType
  1525.                 itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1526.                 itemDropQuestionDialog.dropCount = attachedItemCount
  1527.                 self.itemDropQuestionDialog = itemDropQuestionDialog
  1528.  
  1529.                 constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1530.  
  1531.     def RequestDropItem(self, answer):
  1532.         if not self.itemDropQuestionDialog:
  1533.             return
  1534.  
  1535.         if answer:
  1536.             dropType = self.itemDropQuestionDialog.dropType
  1537.             dropCount = self.itemDropQuestionDialog.dropCount
  1538.             dropNumber = self.itemDropQuestionDialog.dropNumber
  1539.  
  1540.             if player.SLOT_TYPE_INVENTORY == dropType:
  1541.                 if dropNumber == player.ITEM_MONEY:
  1542.                     net.SendGoldDropPacketNew(dropCount)
  1543.                     snd.PlaySound("sound/ui/money.wav")
  1544.                 else:
  1545.                     # PRIVATESHOP_DISABLE_ITEM_DROP
  1546.                     self.__SendDropItemPacket(dropNumber, dropCount)
  1547.                     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1548.             elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == dropType:
  1549.                     # PRIVATESHOP_DISABLE_ITEM_DROP
  1550.                     self.__SendDropItemPacket(dropNumber, dropCount, player.DRAGON_SOUL_INVENTORY)
  1551.                     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1552.  
  1553.         self.itemDropQuestionDialog.Close()
  1554.         self.itemDropQuestionDialog = None
  1555.  
  1556.         constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1557.  
  1558.     # PRIVATESHOP_DISABLE_ITEM_DROP
  1559.     def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
  1560.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1561.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1562.             return
  1563.  
  1564.         net.SendItemDropPacketNew(itemInvenType, itemVNum, itemCount)
  1565.     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1566.  
  1567.     def OnMouseRightButtonDown(self):
  1568.  
  1569.         self.CheckFocus()
  1570.  
  1571.         if TRUE == mouseModule.mouseController.isAttached():
  1572.             mouseModule.mouseController.DeattachObject()
  1573.  
  1574.         else:
  1575.             player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
  1576.  
  1577.         return TRUE
  1578.  
  1579.     def OnMouseRightButtonUp(self):
  1580.         if TRUE == mouseModule.mouseController.isAttached():
  1581.             return TRUE
  1582.  
  1583.         player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
  1584.         return TRUE
  1585.  
  1586.     def OnMouseMiddleButtonDown(self):
  1587.         player.SetMouseMiddleButtonState(player.MBS_PRESS)
  1588.  
  1589.     def OnMouseMiddleButtonUp(self):
  1590.         player.SetMouseMiddleButtonState(player.MBS_CLICK)
  1591.  
  1592.     def OnUpdate(self):
  1593.         app.UpdateGame()
  1594.         if app.ENABLE_PVP_ADVANCED:
  1595.             if pvp.DUEL_IS_SHOW_EQUIP == int(1):
  1596.                 self.interface.CloseEquipmentDialog(int(pvp.DUEL_SAVE_VID))
  1597.  
  1598.         if app.ENABLE_TITLE_SYSTEM:    
  1599.             self.wndTitleSystem.OnUpdate() 
  1600.        
  1601.         if self.mapNameShower.IsShow():
  1602.             self.mapNameShower.Update()
  1603.  
  1604.         if self.isShowDebugInfo:
  1605.             self.UpdateDebugInfo()
  1606.  
  1607.         if self.enableXMasBoom:
  1608.             self.__XMasBoom_Update()
  1609.            
  1610.         if constInfo.SWITCHBOT == 1:
  1611.             if self.switchbot.bot_shown == 1:
  1612.                 self.switchbot.Hide()
  1613.             else:
  1614.                 self.switchbot.Show()
  1615.             constInfo.SWITCHBOT = 0  
  1616.  
  1617.         if constInfo.sterge == 1:
  1618.             if self.elimina.IsShow() == 1:
  1619.                 self.elimina.DinosZiceMergi()
  1620.                 self.elimina.Hide()
  1621.                 self.elimina.DinosZiceMergi1()
  1622.             else:
  1623.                 self.elimina.Open()
  1624.             constInfo.sterge = 0           
  1625.  
  1626.         self.interface.BUILD_OnUpdate()
  1627.  
  1628.     def UpdateDebugInfo(self):
  1629.         #
  1630.         # Äł¸ŻĹÍ ÁÂÇĄ ą× FPS Ăâ·Â
  1631.         (x, y, z) = player.GetMainCharacterPosition()
  1632.         nUpdateTime = app.GetUpdateTime()
  1633.         nUpdateFPS = app.GetUpdateFPS()
  1634.         nRenderFPS = app.GetRenderFPS()
  1635.         nFaceCount = app.GetFaceCount()
  1636.         fFaceSpeed = app.GetFaceSpeed()
  1637.         nST=background.GetRenderShadowTime()
  1638.         (fAveRT, nCurRT) =  app.GetRenderTime()
  1639.         (iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
  1640.         (iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
  1641.         if iPatch == 0:
  1642.             iPatch = 1
  1643.  
  1644.         #(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
  1645.  
  1646.         #self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
  1647.         #xMouse, yMouse = wndMgr.GetMousePosition()
  1648.         #self.PrintMousePos.SetText("MousePosition: %d %d" % (xMouse, yMouse))         
  1649.  
  1650.         #self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
  1651.  
  1652.         #if fAveRT>1.0:
  1653.             #self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
  1654.  
  1655.         #self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
  1656.         #self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
  1657.         #self.TextureNum.SetText("TN : %s" % (sTextureNum))
  1658.         #self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
  1659.         #self.ViewDistance.SetText("Num : %d, FS : %f, FE : %f, FC : %f" % (iNum, fFogStart, fFogEnd, fFarCilp))
  1660.  
  1661.     def OnRender(self):
  1662.         app.RenderGame()
  1663.        
  1664.         if self.console.Console.collision:
  1665.             background.RenderCollision()
  1666.             chr.RenderCollision()
  1667.  
  1668.         (x, y) = app.GetCursorPosition()
  1669.  
  1670.         ########################
  1671.         # Picking
  1672.         ########################
  1673.         textTail.UpdateAllTextTail()
  1674.  
  1675.         if TRUE == wndMgr.IsPickedWindow(self.hWnd):
  1676.  
  1677.             self.PickingCharacterIndex = chr.Pick()
  1678.  
  1679.             if -1 != self.PickingCharacterIndex:
  1680.                 textTail.ShowCharacterTextTail(self.PickingCharacterIndex)
  1681.             if 0 != self.targetBoard.GetTargetVID():
  1682.                 textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())
  1683.  
  1684.             # ADD_ALWAYS_SHOW_NAME
  1685.             if not self.__IsShowName():
  1686.                 self.PickingItemIndex = item.Pick()
  1687.                 if -1 != self.PickingItemIndex:
  1688.                     textTail.ShowItemTextTail(self.PickingItemIndex)
  1689.             # END_OF_ADD_ALWAYS_SHOW_NAME
  1690.            
  1691.         ## Show all name in the range
  1692.        
  1693.         # ADD_ALWAYS_SHOW_NAME
  1694.         if self.__IsShowName():
  1695.             textTail.ShowAllTextTail()
  1696.             self.PickingItemIndex = textTail.Pick(x, y)
  1697.         # END_OF_ADD_ALWAYS_SHOW_NAME
  1698.  
  1699.     #ifdef OFFLINE_SHOP
  1700.         if systemSetting.IsShowSalesText():
  1701.             uiPrivateShopBuilder.UpdateADBoard()
  1702.     #endif
  1703.  
  1704.         textTail.UpdateShowingTextTail()
  1705.         textTail.ArrangeTextTail()
  1706.         if -1 != self.PickingItemIndex:
  1707.             textTail.SelectItemName(self.PickingItemIndex)
  1708.  
  1709.         grp.PopState()
  1710.         grp.SetInterfaceRenderState()
  1711.  
  1712.         textTail.Render()
  1713.         textTail.HideAllTextTail()
  1714.  
  1715.     def OnPressEscapeKey(self):
  1716.         if app.TARGET == app.GetCursor():
  1717.             app.SetCursor(app.NORMAL)
  1718.  
  1719.         elif TRUE == mouseModule.mouseController.isAttached():
  1720.             mouseModule.mouseController.DeattachObject()
  1721.  
  1722.         else:
  1723.             self.interface.OpenSystemDialog()
  1724.  
  1725.         return TRUE
  1726.  
  1727.     def OnIMEReturn(self):
  1728.         if app.IsPressed(app.DIK_LSHIFT):
  1729.             self.interface.OpenWhisperDialogWithoutTarget()
  1730.         else:
  1731.             self.interface.ToggleChat()
  1732.         return TRUE
  1733.  
  1734.     def OnPressExitKey(self):
  1735.         self.interface.ToggleSystemDialog()
  1736.         return TRUE
  1737.  
  1738.     ## BINARY CALLBACK
  1739.     ######################################################################################
  1740.    
  1741.     # WEDDING
  1742.     def BINARY_LoverInfo(self, name, lovePoint):
  1743.         if self.interface.wndMessenger:
  1744.             self.interface.wndMessenger.OnAddLover(name, lovePoint)
  1745.         if self.affectShower:
  1746.             self.affectShower.SetLoverInfo(name, lovePoint)
  1747.  
  1748.     def BINARY_UpdateLovePoint(self, lovePoint):
  1749.         if self.interface.wndMessenger:
  1750.             self.interface.wndMessenger.OnUpdateLovePoint(lovePoint)
  1751.         if self.affectShower:
  1752.             self.affectShower.OnUpdateLovePoint(lovePoint)
  1753.     # END_OF_WEDDING
  1754.    
  1755.     if app.ENABLE_SEND_TARGET_INFO:
  1756.         def BINARY_AddTargetMonsterDropInfo(self, raceNum, itemVnum, itemCount):
  1757.             if not raceNum in constInfo.MONSTER_INFO_DATA:
  1758.                 constInfo.MONSTER_INFO_DATA.update({raceNum : {}})
  1759.                 constInfo.MONSTER_INFO_DATA[raceNum].update({"items" : []})
  1760.             curList = constInfo.MONSTER_INFO_DATA[raceNum]["items"]
  1761.  
  1762.             isUpgradeable = False
  1763.             isMetin = False
  1764.             item.SelectItem(itemVnum)
  1765.             if item.GetItemType() == item.ITEM_TYPE_WEAPON or item.GetItemType() == item.ITEM_TYPE_ARMOR:
  1766.                 isUpgradeable = True
  1767.             elif item.GetItemType() == item.ITEM_TYPE_METIN:
  1768.                 isMetin = True
  1769.  
  1770.             for curItem in curList:
  1771.                 if isUpgradeable:
  1772.                     if curItem.has_key("vnum_list") and curItem["vnum_list"][0] / 10 * 10 == itemVnum / 10 * 10:
  1773.                         if not (itemVnum in curItem["vnum_list"]):
  1774.                             curItem["vnum_list"].append(itemVnum)
  1775.                         return
  1776.                 elif isMetin:
  1777.                     if curItem.has_key("vnum_list"):
  1778.                         baseVnum = curItem["vnum_list"][0]
  1779.                     if curItem.has_key("vnum_list") and (baseVnum - baseVnum%1000) == (itemVnum - itemVnum%1000):
  1780.                         if not (itemVnum in curItem["vnum_list"]):
  1781.                             curItem["vnum_list"].append(itemVnum)
  1782.                         return
  1783.                 else:
  1784.                     if curItem.has_key("vnum") and curItem["vnum"] == itemVnum and curItem["count"] == itemCount:
  1785.                         return
  1786.  
  1787.             if isUpgradeable or isMetin:
  1788.                 curList.append({"vnum_list":[itemVnum], "count":itemCount})
  1789.             else:
  1790.                 curList.append({"vnum":itemVnum, "count":itemCount})
  1791.  
  1792.         def BINARY_RefreshTargetMonsterDropInfo(self, raceNum):
  1793.             self.targetBoard.RefreshMonsterInfoBoard()
  1794.    
  1795.     # QUEST_CONFIRM
  1796.     def BINARY_OnQuestConfirm(self, msg, timeout, pid):
  1797.         confirmDialog = uiCommon.QuestionDialogWithTimeLimit()
  1798.         confirmDialog.Open(msg, timeout)
  1799.         confirmDialog.SetAcceptEvent(lambda answer=TRUE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1800.         confirmDialog.SetCancelEvent(lambda answer=FALSE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1801.         self.confirmDialog = confirmDialog
  1802.     # END_OF_QUEST_CONFIRM
  1803.  
  1804.     # CUBE
  1805.     def BINARY_Cube_Open(self, npcVNUM):
  1806.         self.currentCubeNPC = npcVNUM
  1807.        
  1808.         self.interface.OpenCubeWindow()
  1809.  
  1810.        
  1811.         if npcVNUM not in self.cubeInformation:
  1812.             net.SendChatPacket("/cube r_info")
  1813.         else:
  1814.             cubeInfoList = self.cubeInformation[npcVNUM]
  1815.            
  1816.             i = 0
  1817.             for cubeInfo in cubeInfoList:                              
  1818.                 self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"])
  1819.                
  1820.                 j = 0              
  1821.                 for materialList in cubeInfo["materialList"]:
  1822.                     for materialInfo in materialList:
  1823.                         itemVnum, itemCount = materialInfo
  1824.                         self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount)
  1825.                     j = j + 1                      
  1826.                        
  1827.                 i = i + 1
  1828.                
  1829.             self.interface.wndCube.Refresh()
  1830.  
  1831.     def BINARY_Cube_Close(self):
  1832.         self.interface.CloseCubeWindow()
  1833.  
  1834.     # Á¦ŔŰżˇ ÇĘżäÇŃ °ńµĺ, żą»óµÇ´Â żĎĽşÇ°ŔÇ VNUM°ú °łĽö Á¤ş¸ update
  1835.     def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count):
  1836.         self.interface.UpdateCubeInfo(gold, itemVnum, count)
  1837.        
  1838.     def BINARY_Cube_Succeed(self, itemVnum, count):
  1839.         print "ĹĄşę Á¦ŔŰ Ľş°ř"
  1840.         self.interface.SucceedCubeWork(itemVnum, count)
  1841.         pass
  1842.  
  1843.     def BINARY_Cube_Failed(self):
  1844.         print "ĹĄşę Á¦ŔŰ ˝ÇĆĐ"
  1845.         self.interface.FailedCubeWork()
  1846.         pass
  1847.  
  1848.     def BINARY_Cube_ResultList(self, npcVNUM, listText):
  1849.         # ResultList Text Format : 72723,1/72725,1/72730.1/50001,5  ŔĚ·±˝ÄŔ¸·Î "/" ą®ŔÚ·Î ±¸şĐµČ ¸®˝şĆ®¸¦ ÁÜ
  1850.         #print listText
  1851.        
  1852.         if npcVNUM == 0:
  1853.             npcVNUM = self.currentCubeNPC
  1854.        
  1855.         self.cubeInformation[npcVNUM] = []
  1856.        
  1857.         try:
  1858.             for eachInfoText in listText.split("/"):
  1859.                 eachInfo = eachInfoText.split(",")
  1860.                 itemVnum    = int(eachInfo[0])
  1861.                 itemCount   = int(eachInfo[1])
  1862.  
  1863.                 self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount})
  1864.                 self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount)
  1865.            
  1866.             resultCount = len(self.cubeInformation[npcVNUM])
  1867.             requestCount = 7
  1868.             modCount = resultCount % requestCount
  1869.             splitCount = resultCount / requestCount
  1870.             for i in xrange(splitCount):
  1871.                 #print("/cube r_info %d %d" % (i * requestCount, requestCount))
  1872.                 net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
  1873.                
  1874.             if 0 < modCount:
  1875.                 #print("/cube r_info %d %d" % (splitCount * requestCount, modCount))               
  1876.                 net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1877.  
  1878.         except RuntimeError, msg:
  1879.             dbg.TraceError(msg)
  1880.             return 0
  1881.            
  1882.         pass
  1883.        
  1884.     def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText):
  1885.         # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000
  1886.         try:
  1887.             #print listText
  1888.            
  1889.             if 3 > len(listText):
  1890.                 dbg.TraceError("Wrong Cube Material Infomation")
  1891.                 return 0
  1892.  
  1893.            
  1894.            
  1895.             eachResultList = listText.split("@")
  1896.  
  1897.             cubeInfo = self.cubeInformation[self.currentCubeNPC]           
  1898.            
  1899.             itemIndex = 0
  1900.             for eachResultText in eachResultList:
  1901.                 cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []]
  1902.                 materialList = cubeInfo[startIndex + itemIndex]["materialList"]
  1903.                
  1904.                 gold = 0
  1905.                 splitResult = eachResultText.split("/")
  1906.                 if splitResult[1]!="":
  1907.                     gold = int(splitResult[1])
  1908.                    
  1909.                 #print "splitResult : ", splitResult
  1910.                 eachMaterialList = splitResult[0].split("&")
  1911.                
  1912.                 i = 0
  1913.                 for eachMaterialText in eachMaterialList:
  1914.                     complicatedList = eachMaterialText.split("|")
  1915.                    
  1916.                     if 0 < len(complicatedList):
  1917.                         for complicatedText in complicatedList:
  1918.                             (itemVnum, itemCount) = complicatedText.split(",")
  1919.                             itemVnum = int(itemVnum)
  1920.                             itemCount = int(itemCount)
  1921.                             self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1922.                            
  1923.                             materialList[i].append((itemVnum, itemCount))
  1924.                            
  1925.                     else:
  1926.                         itemVnum, itemCount = eachMaterialText.split(",")
  1927.                         itemVnum = int(itemVnum)
  1928.                         itemCount = int(itemCount)
  1929.                         self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1930.                        
  1931.                         materialList[i].append((itemVnum, itemCount))
  1932.                        
  1933.                     i = i + 1
  1934.                    
  1935.                    
  1936.                    
  1937.                 itemIndex = itemIndex + 1
  1938.                
  1939.             self.interface.wndCube.Refresh()
  1940.            
  1941.                
  1942.         except RuntimeError, msg:
  1943.             dbg.TraceError(msg)
  1944.             return 0
  1945.            
  1946.         pass
  1947.    
  1948.     # END_OF_CUBE
  1949.  
  1950.     def BINARY_AttrTransfer_Open(self):
  1951.             self.interface.OpenAttrTransferWindow()
  1952.  
  1953.     def BINARY_AttrTransfer_Close(self):
  1954.         self.interface.CloseAttrTransferWindow()
  1955.  
  1956.     def BINARY_AttrTransfer_Success(self):
  1957.         self.interface.AttrTransferSuccess()
  1958.  
  1959.     # żëČĄĽ® 
  1960.     def BINARY_Highlight_Item(self, inven_type, inven_pos):
  1961.         if self.interface:
  1962.             self.interface.Highlight_Item(inven_type, inven_pos)
  1963.  
  1964.     def BINARY_Cards_UpdateInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points):
  1965.         self.interface.UpdateCardsInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points)
  1966.  
  1967.     def BINARY_Cards_FieldUpdateInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
  1968.         self.interface.UpdateCardsFieldInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)
  1969.  
  1970.     def BINARY_Cards_PutReward(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
  1971.         self.interface.CardsPutReward(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)
  1972.  
  1973.     def BINARY_Cards_ShowIcon(self):
  1974.         self.interface.CardsShowIcon()
  1975.  
  1976.     def BINARY_Cards_Open(self, safemode):
  1977.         self.interface.OpenCardsWindow(safemode)
  1978.  
  1979.     #def BINARY_DragonSoulGiveQualification(self):
  1980.     #   self.interface.DragonSoulGiveQualification()
  1981.        
  1982.     def BINARY_DragonSoulRefineWindow_Open(self):
  1983.         self.interface.OpenDragonSoulRefineWindow()
  1984.  
  1985.     def BINARY_DragonSoulRefineWindow_RefineFail(self, reason, inven_type, inven_pos):
  1986.         self.interface.FailDragonSoulRefine(reason, inven_type, inven_pos)
  1987.  
  1988.     def BINARY_DragonSoulRefineWindow_RefineSucceed(self, inven_type, inven_pos):
  1989.         self.interface.SucceedDragonSoulRefine(inven_type, inven_pos)
  1990.    
  1991.     # END of DRAGON SOUL REFINE WINDOW
  1992.    
  1993.     def BINARY_SetBigMessage(self, message):
  1994.         self.interface.bigBoard.SetTip(message)
  1995.  
  1996.     def BINARY_SetTipMessage(self, message):
  1997.         self.interface.tipBoard.SetTip(message)    
  1998.  
  1999.     def BINARY_AppendNotifyMessage(self, type):
  2000.         if not type in localeInfo.NOTIFY_MESSAGE:
  2001.             return
  2002.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.NOTIFY_MESSAGE[type])
  2003.  
  2004.     def BINARY_Guild_EnterGuildArea(self, areaID):
  2005.         self.interface.BULID_EnterGuildArea(areaID)
  2006.  
  2007.     def BINARY_Guild_ExitGuildArea(self, areaID):
  2008.         self.interface.BULID_ExitGuildArea(areaID)
  2009.  
  2010.     def BINARY_GuildWar_OnSendDeclare(self, guildID):
  2011.         pass
  2012.  
  2013.     def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
  2014.         mainCharacterName = player.GetMainCharacterName()
  2015.         masterName = guild.GetGuildMasterName()
  2016.         if mainCharacterName == masterName:
  2017.             self.__GuildWar_OpenAskDialog(guildID, warType)
  2018.  
  2019.     def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
  2020.         self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
  2021.  
  2022.     def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
  2023.         self.interface.OnStartGuildWar(guildSelf, guildOpp)
  2024.  
  2025.     def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
  2026.         self.interface.OnEndGuildWar(guildSelf, guildOpp)
  2027.  
  2028.     def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
  2029.         self.interface.BINARY_SetObserverMode(isEnable)
  2030.  
  2031.     def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
  2032.         self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  2033.  
  2034.     def BINARY_UpdateUserCount(self, userCount):
  2035.         self.interface.wndMiniMap.UpdateUserCount(userCount)
  2036.  
  2037.     def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
  2038.         guildID1 = int(guildID1)
  2039.         guildID2 = int(guildID2)
  2040.         memberCount1 = int(memberCount1)
  2041.         memberCount2 = int(memberCount2)
  2042.         observerCount = int(observerCount)
  2043.  
  2044.         self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
  2045.         self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  2046.  
  2047.     def __GuildWar_OpenAskDialog(self, guildID, warType):
  2048.  
  2049.         guildName = guild.GetGuildName(guildID)
  2050.  
  2051.         # REMOVED_GUILD_BUG_FIX
  2052.         if "Noname" == guildName:
  2053.             return
  2054.         # END_OF_REMOVED_GUILD_BUG_FIX
  2055.  
  2056.         import uiGuild
  2057.         questionDialog = uiGuild.AcceptGuildWarDialog()
  2058.         questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept)
  2059.         questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline)
  2060.         questionDialog.Open(guildName, warType)
  2061.  
  2062.         self.guildWarQuestionDialog = questionDialog
  2063.  
  2064.     def __GuildWar_CloseAskDialog(self):
  2065.         self.guildWarQuestionDialog.Close()
  2066.         self.guildWarQuestionDialog = None
  2067.  
  2068.     def __GuildWar_OnAccept(self):
  2069.  
  2070.         guildName = self.guildWarQuestionDialog.GetGuildName()
  2071.  
  2072.         net.SendChatPacket("/war " + guildName)
  2073.         self.__GuildWar_CloseAskDialog()
  2074.  
  2075.         return 1
  2076.  
  2077.     def __GuildWar_OnDecline(self):
  2078.  
  2079.         guildName = self.guildWarQuestionDialog.GetGuildName()
  2080.  
  2081.         net.SendChatPacket("/nowar " + guildName)
  2082.         self.__GuildWar_CloseAskDialog()
  2083.  
  2084.         return 1
  2085.     ## BINARY CALLBACK
  2086.     ######################################################################################
  2087.  
  2088.     def __ServerCommand_Build(self):
  2089.         serverCommandList={
  2090.             "ConsoleEnable"         : self.__Console_Enable,
  2091.             "DayMode"               : self.__DayMode_Update,
  2092.             "refreshinven"            : self.Update_inventory_ref,
  2093.             "update_envanter_lazim"   : self.Update_inventory_lazim,
  2094.             "PRESERVE_DayMode"      : self.__PRESERVE_DayMode_Update,
  2095.             "CloseRestartWindow"    : self.__RestartDialog_Close,
  2096.             "OpenPrivateShop"       : self.__PrivateShop_Open,
  2097.             "PartyHealReady"        : self.PartyHealReady,
  2098.             "ShowMeSafeboxPassword" : self.AskSafeboxPassword,
  2099.             "CloseSafebox"          : self.CommandCloseSafebox,
  2100.  
  2101.             # ITEM_MALL
  2102.             "CloseMall"             : self.CommandCloseMall,
  2103.             "ShowMeMallPassword"    : self.AskMallPassword,
  2104.             "item_mall"             : self.__ItemMall_Open,
  2105.             # END_OF_ITEM_MALL
  2106.            
  2107.             # SYSTEM_TWIX
  2108.             "Teleport"               : self.__MakeTeleport,
  2109.             "Stack"                  : self.__MakeStack,
  2110.             "Depozit"                : self.__MakeDepozit,
  2111.             "ItemShop"               : self.__MakeItemShop,
  2112.             # END_OF_SYSTEM_TWIX
  2113.  
  2114.             "RefineSuceeded"        : self.RefineSuceededMessage,
  2115.             "RefineFailed"          : self.RefineFailedMessage,
  2116.             "xmas_snow"             : self.__XMasSnow_Enable,
  2117.             "xmas_boom"             : self.__XMasBoom_Enable,
  2118.             "xmas_song"             : self.__XMasSong_Enable,
  2119.             "xmas_tree"             : self.__XMasTree_Enable,
  2120.             "newyear_boom"          : self.__XMasBoom_Enable,
  2121.             "PartyRequest"          : self.__PartyRequestQuestion,
  2122.             "PartyRequestDenied"    : self.__PartyRequestDenied,
  2123.             "horse_state"           : self.__Horse_UpdateState,
  2124.             "hide_horse_state"      : self.__Horse_HideState,
  2125.             "WarUC"                 : self.__GuildWar_UpdateMemberCount,
  2126.             "test_server"           : self.__EnableTestServerFlag,
  2127.             "mall"                  : self.__InGameShop_Show,
  2128. #ifdef ACHIVEMENT_SYSTEM
  2129.             "ACHIEVEMENTS"          : self.ManagerAchievements,
  2130. #endif
  2131.             "PetEvolution"          : self.SetPetEvolution,
  2132.             "PetName"               : self.SetPetName,
  2133.             "PetLevel"              : self.SetPetLevel,
  2134.             "PetDuration"           : self.SetPetDuration,
  2135.             ##Pet Ya? Bugu Fixi##
  2136.             "PetDurationYas"        : self.SetPetDurationYas,
  2137.             ##Pet Ya? Bugu Fixi##
  2138.             "PetBonus"              : self.SetPetBonus,
  2139.             "PetSkill"              : self.SetPetskill,
  2140.             "PetIcon"               : self.SetPetIcon,
  2141.             "PetExp"                : self.SetPetExp,
  2142.             "PetUnsummon"           : self.PetUnsummon,
  2143.             "OpenPetIncubator"      : self.OpenPetIncubator,
  2144.  
  2145.             # WEDDING
  2146.             "lover_login"           : self.__LoginLover,
  2147.             "lover_logout"          : self.__LogoutLover,
  2148.             "lover_near"            : self.__LoverNear,
  2149.             "lover_far"             : self.__LoverFar,
  2150.             "lover_divorce"         : self.__LoverDivorce,
  2151.             "PlayMusic"             : self.__PlayMusic,
  2152.             # END_OF_WEDDING
  2153.  
  2154.             "AttrTransferMessage"   : self.AttrTransferMessage,
  2155.  
  2156.             # PRIVATE_SHOP_PRICE_LIST
  2157.             "MyShopPriceList"       : self.__PrivateShop_PriceList,
  2158.             # END_OF_PRIVATE_SHOP_PRICE_LIST
  2159.             #################################################
  2160.             # Duel System                       #
  2161.             "BINARY_Duel_GetInfo"           : self.BINARY_Duel_GetInfo,
  2162.             "BINARY_Duel_Request"           : self.BINARY_Duel_Request,
  2163.             "BINARY_Duel_LiveInterface"         : self.BINARY_Duel_LiveInterface,
  2164.             "BINARY_Duel_Delete"            : self.BINARY_Duel_Delete,
  2165.             "BINARY_Duel_SendMessage"           : self.BINARY_Duel_SendMessage,
  2166.             #################################################
  2167.  
  2168.             ##TEAM_LOGIN_WITH_LIST
  2169.             "SetTeamOnline"         : self.__TeamLogin,
  2170.             "SetTeamOffline"        : self.__TeamLogout,
  2171.             ##END_OF_TEAM_LOGIN_WITH_LIST
  2172.            
  2173.         #ifdef OFFLINE_SHOP
  2174.             "shop"              :self.NewShop,
  2175.             "shop_clear"        :self.ShopClear,
  2176.             "shop_add"          :self.ShopAdd,
  2177.             "shop_item"         :self.ShopItem,
  2178.             "shop_cost"         :self.ShopCost,
  2179.             "shop_cost_clear"   :self.ShopCostClear,
  2180.             "shop_item_clear"   :self.ShopItemClear,
  2181.             "shop_item_end"     :self.ShopItemEnd,
  2182.         #endif
  2183.         #ifdef GIFT_SYSTEM
  2184.             "gift_clear"    :self.gift_clear,
  2185.             "gift_item"     :self.gift_item,
  2186.             "gift_info"     :self.gift_show,
  2187.             "gift_load"     :self.gift_load,
  2188.         #endif
  2189.         }
  2190.        
  2191.         if app.ENABLE_FEATURES_OXEVENT:
  2192.             serverCommandList["BINARY_OxEvent_Window"] = self.BINARY_OxEvent_Window
  2193.  
  2194.         self.serverCommander=stringCommander.Analyzer()
  2195.         for serverCommandItem in serverCommandList.items():
  2196.             self.serverCommander.SAFE_RegisterCallBack(serverCommandItem[0], serverCommandItem[1])
  2197.        
  2198.     if app.ENABLE_FEATURES_OXEVENT:
  2199.         def BINARY_OxEvent_Window(self):
  2200.             if self.eventWindowLogin.IsShow():
  2201.                 self.eventWindowLogin.Hide()
  2202.             else:
  2203.                 self.eventWindowLogin.Show()
  2204.        
  2205.     def __MakeTeleport(self, qid):
  2206.         constInfo.Teleportqin= int(qid)
  2207.        
  2208.     def __MakeStack(self, qid):
  2209.         constInfo.Stack= int(qid)  
  2210.        
  2211.     def __MakeDepozit(self, qid):
  2212.         constInfo.Depozitqin= int(qid)  
  2213.  
  2214.     def __MakeItemShop(self, qid):
  2215.         constInfo.ItemShop= int(qid)    
  2216.        
  2217.     def BINARY_ServerCommand_Run(self, line):
  2218.         #dbg.TraceError(line)
  2219.         try:
  2220.             #print " BINARY_ServerCommand_Run", line
  2221.             return self.serverCommander.Run(line)
  2222.         except RuntimeError, msg:
  2223.             dbg.TraceError(msg)
  2224.             return 0
  2225.  
  2226.     def __ProcessPreservedServerCommand(self):
  2227.         try:
  2228.             command = net.GetPreservedServerCommand()
  2229.             while command:
  2230.                 print " __ProcessPreservedServerCommand", command
  2231.                 self.serverCommander.Run(command)
  2232.                 command = net.GetPreservedServerCommand()
  2233.         except RuntimeError, msg:
  2234.             dbg.TraceError(msg)
  2235.             return 0
  2236.  
  2237.     def PartyHealReady(self):
  2238.         self.interface.PartyHealReady()
  2239.  
  2240.     def AskSafeboxPassword(self):
  2241.         self.interface.AskSafeboxPassword()
  2242.  
  2243.     # ITEM_MALL
  2244.     def AskMallPassword(self):
  2245.         self.interface.AskMallPassword()
  2246.  
  2247.     def __ItemMall_Open(self):
  2248.         self.interface.OpenItemMall();
  2249.  
  2250.     def CommandCloseMall(self):
  2251.         self.interface.CommandCloseMall()
  2252.     # END_OF_ITEM_MALL
  2253.  
  2254.     def AttrTransferMessage(self):
  2255.         snd.PlaySound("sound/ui/make_soket.wav")
  2256.         self.PopupMessage(localeInfo.COMB_ALERT)
  2257.  
  2258.     def RefineSuceededMessage(self):
  2259.         snd.PlaySound("sound/ui/make_soket.wav")
  2260.         self.PopupMessage(localeInfo.REFINE_SUCCESS)
  2261.  
  2262.     def RefineFailedMessage(self):
  2263.         snd.PlaySound("sound/ui/jaeryun_fail.wav")
  2264.         self.PopupMessage(localeInfo.REFINE_FAILURE)
  2265.  
  2266.     def CommandCloseSafebox(self):
  2267.         self.interface.CommandCloseSafebox()
  2268.  
  2269.     # PRIVATE_SHOP_PRICE_LIST
  2270.     def __PrivateShop_PriceList(self, itemVNum, itemPrice):
  2271.         uiPrivateShopBuilder.SetPrivateShopItemPrice(itemVNum, itemPrice)
  2272.     # END_OF_PRIVATE_SHOP_PRICE_LIST
  2273.  
  2274.     def SetPetEvolution(self, evo):
  2275.         petname = [localeInfo.PET_SYSTEM_EVO1, localeInfo.PET_SYSTEM_EVO2, localeInfo.PET_SYSTEM_EVO3, localeInfo.PET_SYSTEM_EVO4]
  2276.         self.petmain.SetEvolveName(petname[int(evo)])
  2277.  
  2278.     def SetPetName(self, name):
  2279.         if len(name) > 1 and name != "":
  2280.             self.petmini.Show()
  2281.         self.petmain.SetName(name)
  2282.  
  2283.     def SetPetLevel(self, level):
  2284.         self.petmain.SetLevel(level)
  2285.  
  2286.     def SetPetDuration(self, dur, durt):
  2287.         if int(durt) > 0:
  2288.             self.petmini.SetDuration(dur, durt)
  2289.         self.petmain.SetDuration(dur, durt)
  2290.  
  2291.     ##Pet Ya? Bugu Fixi##
  2292.     def SetPetDurationYas(self, dur_yas):
  2293.         if int(dur_yas) > 0:
  2294.             self.petmain.SetDurationYas(dur_yas)
  2295.     ##Pet Ya? Bugu Fixi##
  2296.  
  2297.     def SetPetBonus(self, hp, dif, sp):
  2298.         self.petmain.SetHp(hp)
  2299.         self.petmain.SetDef(dif)
  2300.         self.petmain.SetSp(sp)
  2301.  
  2302.     def SetPetskill(self, slot, idx, lv):
  2303.         if int(lv) > 0:
  2304.             self.petmini.SetSkill(slot, idx, lv)
  2305.         self.petmain.SetSkill(slot, idx, lv)
  2306.         self.affectShower.BINARY_NEW_AddAffect(5400+int(idx),int(constInfo.LASTAFFECT_POINT)+1,int(constInfo.LASTAFFECT_VALUE)+1, 0)
  2307.         if int(slot)==0:
  2308.             constInfo.SKILL_PET1=5400+int(idx)
  2309.         if int(slot)==1:
  2310.             constInfo.SKILL_PET2=5400+int(idx)
  2311.         if int(slot)==2:
  2312.             constInfo.SKILL_PET3=5400+int(idx)
  2313.  
  2314.     def SetPetIcon(self, vnum):
  2315.         if int(vnum) > 0:
  2316.             self.petmini.SetImageSlot(vnum)
  2317.         self.petmain.SetImageSlot(vnum)
  2318.  
  2319.     def SetPetExp(self, exp, expi, exptot):
  2320.         if int(exptot) > 0:
  2321.             self.petmini.SetExperience(exp, expi, exptot)
  2322.         self.petmain.SetExperience(exp, expi, exptot)
  2323.  
  2324.     def PetUnsummon(self):
  2325.         self.petmini.SetDefaultInfo()
  2326.         self.petmini.Close()
  2327.         self.petmain.SetDefaultInfo()
  2328.         self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET1),0)
  2329.         self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET2),0)
  2330.         self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET3),0)
  2331.         constInfo.SKILL_PET1 = 0
  2332.         constInfo.SKILL_PET2 = 0
  2333.         constInfo.SKILL_PET3 = 0
  2334.  
  2335.     def OpenPetMainGui(self):
  2336.         self.petmain.Show()
  2337.         self.petmain.SetTop()
  2338.  
  2339.     def OpenPetIncubator(self, pet_new = 0):
  2340.         import uipetincubatrice
  2341.         self.petinc = uipetincubatrice.PetSystemIncubator(pet_new)
  2342.         self.petinc.Show()
  2343.         self.petinc.SetTop()
  2344.  
  2345.     def OpenPetMini(self):
  2346.         self.petmini.Show()
  2347.         self.petmini.SetTop()
  2348.  
  2349.     def OpenPetFeed(self):
  2350.  
  2351.         self.feedwind = uipetfeed.PetFeedWindow()
  2352.         self.feedwind.Show()
  2353.         self.feedwind.SetTop()
  2354.  
  2355. #ifdef OFFLINE_SHOP
  2356.     def NewShop(self):
  2357.         if self.uiNewShop:
  2358.             self.uiNewShop.Show()
  2359.  
  2360.     def ShopClear(self):
  2361.         if self.uiNewShop:
  2362.             self.uiNewShop.HideAll()
  2363.         constInfo.MyShops=[]
  2364.  
  2365.     def ShopCostClear(self):
  2366.         constInfo.shop_cost=[]
  2367.  
  2368.     def ShopCost(self,id,time,time_val,price):
  2369.         constInfo.shop_cost.append({"id":int(id),"time":int(time),"time_val":int(time_val),"price":int(price)})
  2370.  
  2371.     def ShopAdd(self,shop_id,shop_vid,szSign,gold,count,sold,days,date_close):
  2372.         if self.uiNewShop:
  2373.             shop={
  2374.                 "id":shop_id,
  2375.                 "vid":shop_vid,
  2376.                 "name":szSign.replace("\\"," ").replace("_","#"),
  2377.                 "gold":gold,
  2378.                 "sold":sold,
  2379.                 "items":int(count)-int(sold),
  2380.                 "days":days,
  2381.                 "time":date_close
  2382.             }
  2383.             self.uiNewShop.Load(shop)
  2384.             constInfo.MyShops.append(shop)
  2385.  
  2386.     def ShopItemClear(self):
  2387.         if self.uiNewShop:
  2388.             self.uiNewShop.ClearItems()
  2389.  
  2390.     def ShopItemEnd(self):
  2391.         if self.uiNewShop:
  2392.             self.uiNewShop.CloseEdit()
  2393.  
  2394.     def ShopItem(self,data):
  2395.         d=data.split("#")
  2396.         id=d[0]
  2397.         vnum=d[1]
  2398.         count=d[2]
  2399.         slot=d[3]
  2400.         price=d[4]
  2401.         s=d[5]
  2402.         a=d[6]
  2403.         sockets=[]
  2404.         for key in s.split("|"):
  2405.             sockets.append(int(key))
  2406.  
  2407.         attrs=[]
  2408.         for key in a.split("|"):
  2409.             a=key.split(",")
  2410.             attrs.append([int(a[1]),int(a[0])])
  2411.         if self.uiNewShop:
  2412.             self.uiNewShop.AddItem(slot,{"id":id,"vnum":vnum,"count":count,"price":price,"sockets":sockets,"attrs":attrs})
  2413. #endif
  2414.  
  2415. #ifdef GIFT_SYSTEM
  2416.     def gift_clear(self):
  2417.         constInfo.gift_items={}
  2418.         self.interface.ClearGift()
  2419.  
  2420.     def gift_item(self, id, vnum, count, pos, date_add, give, reason, szSockets, szAttrs):
  2421.         sockets=[]
  2422.         for key in szSockets.split("|"):
  2423.             sockets.append(int(key))
  2424.  
  2425.         attrs=[]
  2426.         for key in szAttrs.split("|"):
  2427.             a=key.split(",")
  2428.             attrs.append([int(a[0]),int(a[1])])
  2429.         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}
  2430.  
  2431.     def gift_load(self):
  2432.         self.interface.wndGiftBox.Refresh()
  2433.  
  2434.     def gift_show(self,pages):
  2435.         self.interface.wndGiftBox.pageNum=int(pages)
  2436.         self.interface.OpenGift()
  2437. #endif
  2438.  
  2439.     def __Horse_HideState(self):
  2440.         self.affectShower.SetHorseState(0, 0, 0)
  2441.  
  2442.     if app.ENABLE_PVP_ADVANCED:
  2443.         def BINARY_Duel_GetInfo(self, a, b, c, d, e, f, g, h):
  2444.             self.wndDuelGui.OpenDialog(a, b, c, d, e, f, g, h)
  2445.  
  2446.         def BINARY_Duel_Request(self, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q):
  2447.             self.wndDuelGui.OpenDialog(a, b, c, d, e, f, g, h)
  2448.             self.wndDuelGui.Selected([int(i), int(j), int(k), int(l), int(m), int(n), int(o), int(p), int(q)])
  2449.  
  2450.         def BINARY_Duel_Delete(self):
  2451.             self.wndDuelGui.Remove()
  2452.  
  2453.             if self.wndDuelLive.IsShow():
  2454.                 self.wndDuelLive.Hide()
  2455.  
  2456.         def BINARY_Duel_LiveInterface(self, a, b, c, d, e, f, g, h, i, j, k, l):
  2457.             self.wndDuelLive.ShowInformations([str(a), int(b), int(c), int(d), int(e), int(f), int(g), int(h), int(i), int(j), int(k), int(l)])
  2458.  
  2459.         def BINARY_Duel_SendMessage(self, textLine):
  2460.             if str(textLine) != "":
  2461.                 self.wndMsg = message.PopupDialog()
  2462.                 self.wndMsg.SetWidth(550)
  2463.                 self.wndMsg.SetText((str(textLine).replace("$"," ")))
  2464.                 self.wndMsg.Show()
  2465.             else:
  2466.                 chat.AppendChat(chat.CHAT_TYPE_INFO, "Error, i could not initialize message from server!")
  2467.  
  2468.     def __Horse_UpdateState(self, level, health, battery):
  2469.         self.affectShower.SetHorseState(int(level), int(health), int(battery))
  2470.  
  2471.     def __IsXMasMap(self):
  2472.         mapDict = ( "metin2_map_n_flame_01",
  2473.                     "metin2_map_n_desert_01",
  2474.                     "metin2_map_spiderdungeon",
  2475.                     "metin2_map_deviltower1", )
  2476.  
  2477.         if background.GetCurrentMapName() in mapDict:
  2478.             return FALSE
  2479.  
  2480.         return TRUE
  2481.  
  2482.     def __XMasSnow_Enable(self, mode):
  2483.  
  2484.         self.__XMasSong_Enable(mode)
  2485.  
  2486.         if "1"==mode:
  2487.  
  2488.             if not self.__IsXMasMap():
  2489.                 return
  2490.  
  2491.             print "XMAS_SNOW ON"
  2492.             background.EnableSnow(1)
  2493.  
  2494.         else:
  2495.             print "XMAS_SNOW OFF"
  2496.             background.EnableSnow(0)
  2497.  
  2498.     def __XMasBoom_Enable(self, mode):
  2499.         if "1"==mode:
  2500.  
  2501.             if not self.__IsXMasMap():
  2502.                 return
  2503.  
  2504.             print "XMAS_BOOM ON"
  2505.             self.__DayMode_Update("dark")
  2506.             self.enableXMasBoom = TRUE
  2507.             self.startTimeXMasBoom = app.GetTime()
  2508.         else:
  2509.             print "XMAS_BOOM OFF"
  2510.             self.__DayMode_Update("light")
  2511.             self.enableXMasBoom = FALSE
  2512.  
  2513.     def __XMasTree_Enable(self, grade):
  2514.  
  2515.         print "XMAS_TREE ", grade
  2516.         background.SetXMasTree(int(grade))
  2517.  
  2518.     def __XMasSong_Enable(self, mode):
  2519.         if "1"==mode:
  2520.             print "XMAS_SONG ON"
  2521.  
  2522.             XMAS_BGM = "xmas.mp3"
  2523.  
  2524.             if app.IsExistFile("BGM/" + XMAS_BGM)==1:
  2525.                 if musicInfo.fieldMusic != "":
  2526.                     snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2527.  
  2528.                 musicInfo.fieldMusic=XMAS_BGM
  2529.                 snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2530.  
  2531.         else:
  2532.             print "XMAS_SONG OFF"
  2533.  
  2534.             if musicInfo.fieldMusic != "":
  2535.                 snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2536.  
  2537.             musicInfo.fieldMusic=musicInfo.METIN2THEMA
  2538.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2539.  
  2540.     def __RestartDialog_Close(self):
  2541.         self.interface.CloseRestartDialog()
  2542.  
  2543.     def __Console_Enable(self):
  2544.         constInfo.CONSOLE_ENABLE = TRUE
  2545.         self.consoleEnable = TRUE
  2546.         app.EnableSpecialCameraMode()
  2547.         ui.EnablePaste(TRUE)
  2548.  
  2549.     ## PrivateShop
  2550.     def __PrivateShop_Open(self):
  2551.     #ifdef OFFLINE_SHOP
  2552.         self.uiNewShop.Show()
  2553.     #else
  2554.         #self.interface.OpenPrivateShopInputNameDialog()
  2555.     #endif
  2556.  
  2557.     def BINARY_PrivateShop_Appear(self, vid, text):
  2558.     #ifdef OFFLINE_SHOP
  2559.         self.interface.AppearPrivateShop(vid, text)
  2560.     #else
  2561.         #if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_PLAYER):
  2562.         #   self.interface.AppearPrivateShop(vid, text)
  2563.     #endif
  2564.  
  2565.     def BINARY_PrivateShop_Disappear(self, vid):
  2566.         #if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_PLAYER):
  2567.         self.interface.DisappearPrivateShop(vid)
  2568.  
  2569.     ## DayMode
  2570.     def __PRESERVE_DayMode_Update(self, mode):
  2571.         if "light"==mode:
  2572.             background.SetEnvironmentData(0)
  2573.         elif "dark"==mode:
  2574.  
  2575.             if not self.__IsXMasMap():
  2576.                 return
  2577.  
  2578.             background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2579.             background.SetEnvironmentData(1)
  2580.  
  2581.     def __DayMode_Update(self, mode):
  2582.         if "light"==mode:
  2583.             self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
  2584.         elif "dark"==mode:
  2585.  
  2586.             if not self.__IsXMasMap():
  2587.                 return
  2588.  
  2589.             self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
  2590.  
  2591.     def __DayMode_OnCompleteChangeToLight(self):
  2592.         background.SetEnvironmentData(0)
  2593.         self.curtain.FadeIn()
  2594.  
  2595.     def __DayMode_OnCompleteChangeToDark(self):
  2596.         background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2597.         background.SetEnvironmentData(1)
  2598.         self.curtain.FadeIn()
  2599.  
  2600.     ## XMasBoom
  2601.     def __XMasBoom_Update(self):
  2602.  
  2603.         self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
  2604.         if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
  2605.             return
  2606.  
  2607.         boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
  2608.         boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
  2609.  
  2610.         if app.GetTime() - self.startTimeXMasBoom > boomTime:
  2611.  
  2612.             self.indexXMasBoom += 1
  2613.  
  2614.             for i in xrange(boomCount):
  2615.                 self.__XMasBoom_Boom()
  2616.  
  2617.     def __XMasBoom_Boom(self):
  2618.         x, y, z = player.GetMainCharacterPosition()
  2619.         randX = app.GetRandom(-150, 150)
  2620.         randY = app.GetRandom(-150, 150)
  2621.  
  2622.         snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
  2623.  
  2624.     def __PartyRequestQuestion(self, vid):
  2625.         vid = int(vid)
  2626.         partyRequestQuestionDialog = uiCommon.QuestionDialog()
  2627.         partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + localeInfo.PARTY_DO_YOU_ACCEPT)
  2628.         partyRequestQuestionDialog.SetAcceptText(localeInfo.UI_ACCEPT)
  2629.         partyRequestQuestionDialog.SetCancelText(localeInfo.UI_DENY)
  2630.         partyRequestQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.__AnswerPartyRequest(arg))
  2631.         partyRequestQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.__AnswerPartyRequest(arg))
  2632.         partyRequestQuestionDialog.Open()
  2633.         partyRequestQuestionDialog.vid = vid
  2634.         self.partyRequestQuestionDialog = partyRequestQuestionDialog
  2635.  
  2636.     def __AnswerPartyRequest(self, answer):
  2637.         if not self.partyRequestQuestionDialog:
  2638.             return
  2639.  
  2640.         vid = self.partyRequestQuestionDialog.vid
  2641.  
  2642.         if answer:
  2643.             net.SendChatPacket("/party_request_accept " + str(vid))
  2644.         else:
  2645.             net.SendChatPacket("/party_request_deny " + str(vid))
  2646.  
  2647.         self.partyRequestQuestionDialog.Close()
  2648.         self.partyRequestQuestionDialog = None
  2649.  
  2650.     def __PartyRequestDenied(self):
  2651.         self.PopupMessage(localeInfo.PARTY_REQUEST_DENIED)
  2652.  
  2653.     if app.TOURNAMENT_PVP_SYSTEM:
  2654.         def BINARY_Tournament_OnRecvData(self, leftTime, membersOnline_A, membersOnline_B, membersDead_A, membersDead_B, memberLives):
  2655.             self.interface.AddTournamentResultWindow(leftTime, membersOnline_A, membersOnline_B, membersDead_A, membersDead_B, memberLives)
  2656.  
  2657.     def __EnableTestServerFlag(self):
  2658.         app.EnableTestServerFlag()
  2659.  
  2660.     def __InGameShop_Show(self, url):
  2661.         if constInfo.IN_GAME_SHOP_ENABLE:
  2662.             self.interface.OpenWebWindow(url)
  2663. #ifdef ACHIVEMENT_SYSTEM
  2664.     def ManagerAchievements(self, cmd):
  2665.         cmd = cmd.split("#")
  2666.         if cmd[0] == 'QID':
  2667.             constInfo.Achievements['QID'] = int(cmd[1])
  2668.         elif cmd[0] == 'INPUT':
  2669.             constInfo.INPUT_IGNORE = int(cmd[1])
  2670.         elif cmd[0] == 'SEND':
  2671.             net.SendQuestInputStringPacket(constInfo.Achievements['QCMD'])
  2672.             constInfo.Achievements['QCMD'] = ''
  2673.         elif cmd[0] == 'SET_CATEGORY':
  2674.             constInfo.Achievements['achievements'][int(cmd[1])] = []
  2675.         elif cmd[0] == 'SET_ACHIEVEMENT':
  2676.             constInfo.Achievements['achievements'][int(cmd[1])].append([int(cmd[2]), int(cmd[3]), int(cmd[4]), int(cmd[5])])
  2677.         elif cmd[0] == 'UPDATE_ACHIEVEMENT':
  2678.             for i in xrange(len(constInfo.Achievements['achievements'][int(cmd[1])])):
  2679.                 if int(cmd[1]) == 2 or int(cmd[1]) == 3 or int(cmd[1]) == 4:
  2680.                     if constInfo.Achievements['achievements'][int(cmd[1])][i][3] == int(cmd[3]):
  2681.                         constInfo.Achievements['achievements'][int(cmd[1])][i][0] = int(cmd[2])
  2682.                 else:
  2683.                     constInfo.Achievements['achievements'][int(cmd[1])][i][0] = int(cmd[2])
  2684.         elif cmd[0] == 'REFRESH_ACHIEVEMENTS':
  2685.             self.interface.wndAchievements.RefreshAchievements()
  2686.             self.interface.wndAchievements.RefreshGlobalProgress()
  2687.         elif cmd[0] == 'CLEAR_LAST_FINISHED':
  2688.             constInfo.Achievements['last_achievements'] = []
  2689.         elif cmd[0] == 'SET_FINISHED':
  2690.             self.interface.wndAchievements.SetAchievementFinisehd(int(cmd[1]), int(cmd[2]), int(cmd[3]), int(cmd[4]))
  2691.         elif cmd[0] == 'SET_LAST_FINISHED':
  2692.             achievementInfo = cmd[1].split(',')
  2693.             constInfo.Achievements['last_achievements'].append([int(achievementInfo[0]), int(achievementInfo[1]), int(achievementInfo[2]), int(achievementInfo[3])])
  2694.         elif cmd[0] == 'REFRESH_LAST_FINISHED':
  2695.             self.interface.wndAchievements.RefreshLastFinished()
  2696.         elif cmd[0] == 'SET_AP':
  2697.             constInfo.Achievements['POINTS'] = int(cmd[1])
  2698.         elif cmd[0] == 'SET_ACHIEVEMENTSHOP_CATEGORY':
  2699.             constInfo.Achievements['achievementshop'][int(cmd[1])] = []
  2700.         elif cmd[0] == 'SET_ACHIEVEMENTSHOP_ITEM':
  2701.             constInfo.Achievements['achievementshop'][int(cmd[1])].append([int(cmd[2]), int(cmd[3]), int(cmd[4])])
  2702. #endif
  2703.  
  2704.     # WEDDING
  2705.     def __LoginLover(self):
  2706.         if self.interface.wndMessenger:
  2707.             self.interface.wndMessenger.OnLoginLover()
  2708.  
  2709.     def __LogoutLover(self):
  2710.         if self.interface.wndMessenger:
  2711.             self.interface.wndMessenger.OnLogoutLover()
  2712.         if self.affectShower:
  2713.             self.affectShower.HideLoverState()
  2714.  
  2715.     def __LoverNear(self):
  2716.         if self.affectShower:
  2717.             self.affectShower.ShowLoverState()
  2718.  
  2719.     def __LoverFar(self):
  2720.         if self.affectShower:
  2721.             self.affectShower.HideLoverState()
  2722.  
  2723.     if app.ENABLE_FEATURES_OXEVENT:
  2724.         def BINARY_OxEvent_Append(self, event, participantsCount, observersCount):
  2725.             import oxevent
  2726.             tokens = int(event)
  2727.  
  2728.             if tokens == oxevent.APPEND_WINNERS:
  2729.                 self.eventWindow.Append()
  2730.  
  2731.             elif tokens == oxevent.APPEND_REFRESH:
  2732.                 self.eventWindowManager.RefreshCounter(participantsCount, observersCount)      
  2733.  
  2734.             elif tokens == oxevent.APPEND_WINDOW:
  2735.                 self.eventWindowManager.Show()
  2736.  
  2737.     def __LoverDivorce(self):
  2738.         if self.interface.wndMessenger:
  2739.             self.interface.wndMessenger.ClearLoverInfo()
  2740.         if self.affectShower:
  2741.             self.affectShower.ClearLoverState()
  2742.  
  2743.     def __PlayMusic(self, flag, filename):
  2744.         flag = int(flag)
  2745.         if flag:
  2746.             snd.FadeOutAllMusic()
  2747.             musicInfo.SaveLastPlayFieldMusic()
  2748.             snd.FadeInMusic("BGM/" + filename)
  2749.         else:
  2750.             snd.FadeOutAllMusic()
  2751.             musicInfo.LoadLastPlayFieldMusic()
  2752.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2753.  
  2754.     if app.ENABLE_SASH_SYSTEM:
  2755.         def ActSash(self, iAct, bWindow):
  2756.             if self.interface:
  2757.                 self.interface.ActSash(iAct, bWindow)
  2758.  
  2759.         def AlertSash(self, bWindow):
  2760.             snd.PlaySound("sound/ui/make_soket.wav")
  2761.             if bWindow:
  2762.                 self.PopupMessage(localeInfo.SASH_DEL_SERVEITEM)
  2763.             else:
  2764.                 self.PopupMessage(localeInfo.SASH_DEL_ABSORDITEM)
  2765.  
  2766.     # END_OF_WEDDING
  2767.  
  2768.     if app.ADD_INVENTORY:  
  2769.         def Update_inventory_ref(self):
  2770.             if self.interface:
  2771.                 self.interface.SetInventoryPageKilit()
  2772.                
  2773.         def Update_inventory_lazim(self, lazim):
  2774.             self.wndPopupDialog = uiCommon.PopupDialog()
  2775.             self.wndPopupDialog.SetText(localeInfo.ENVANTER_ANAH_LAZIM1 + lazim + " " + localeInfo.ENVANTER_ANAH_LAZIM)
  2776.             self.wndPopupDialog.Open()
  2777.  
  2778. # TEAM_LIST
  2779.     def __TeamLogin(self, name):
  2780.         if self.interface.wndMessenger:
  2781.             self.interface.wndMessenger.OnLogin(2, name)
  2782.  
  2783.     def __TeamLogout(self, name):
  2784.         if self.interface.wndMessenger:
  2785.             self.interface.wndMessenger.OnLogout(2, name)
  2786. # END_OF_TEAM_LIST
Advertisement
Add Comment
Please, Sign In to add comment