Zatoky

File "game.py", line 1826, in BINARY_Cube_ResultList

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