teamturker

game.py

Feb 24th, 2016
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 83.99 KB | None | 0 0
  1. import os
  2. import app
  3. import dbg
  4. import grp
  5. import item
  6. import background
  7. import chr
  8. import chrmgr
  9. import player
  10. import snd
  11. import chat
  12. import event
  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. import itemchance
  30.  
  31. import ui
  32. import uiCommon
  33. import uiPhaseCurtain
  34. import uiMapNameShower
  35. import uiAffectShower
  36. import uiPlayerGauge
  37. import uiCharacter
  38. import uiTarget
  39. import time
  40. import day
  41. import uiHealth
  42.  
  43. # PRIVATE_SHOP_PRICE_LIST
  44. import uiPrivateShopBuilder
  45. # END_OF_PRIVATE_SHOP_PRICE_LIST
  46.  
  47. import mouseModule
  48. import consoleModule
  49.  
  50. import playerSettingModule
  51. import interfaceModule
  52.  
  53. import musicInfo
  54. import debugInfo
  55. import stringCommander
  56.  
  57.  
  58. from _weakref import proxy
  59. from switchbot import Bot
  60. ##Oyuna girdi##
  61. bildirimler = 0
  62. kisi = ""
  63. oyunagirdi = 0
  64. oyunagirdibeklemesuresi = 2
  65. oyunagirdiglobaltimesuresi = app.GetTime() - 2
  66. ##Oyuna girdi##
  67.  
  68.  
  69. # TEXTTAIL_LIVINGTIME_CONTROL
  70. #if localeInfo.IsJAPAN():
  71. #   app.SetTextTailLivingTime(8.0)
  72. # END_OF_TEXTTAIL_LIVINGTIME_CONTROL
  73.  
  74. # SCREENSHOT_CWDSAVE
  75. SCREENSHOT_CWDSAVE = FALSE
  76. SCREENSHOT_DIR = None
  77.  
  78. if localeInfo.IsEUROPE():
  79.     SCREENSHOT_CWDSAVE = TRUE
  80.  
  81. if localeInfo.IsCIBN10():
  82.     SCREENSHOT_CWDSAVE = FALSE
  83.         SCREENSHOT_DIR = "YT2W"
  84.  
  85. cameraDistance = 1550.0
  86. cameraPitch = 27.0
  87. cameraRotation = 0.0
  88. cameraHeight = 100.0
  89.  
  90. testAlignment = 0
  91. BPisLodaded = 0
  92.  
  93. class GameWindow(ui.ScriptWindow):
  94.     def __init__(self, stream):
  95.         ui.ScriptWindow.__init__(self, "GAME")
  96.         self.SetWindowName("game")
  97.         net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)
  98.         player.SetGameWindow(self)
  99.  
  100.         self.quickSlotPageIndex = 0
  101.         self.lastPKModeSendedTime = 0
  102.         self.pressNumber = None
  103.  
  104.         self.guildWarQuestionDialog = None
  105.         self.interface = None
  106.         self.targetBoard = None
  107.         self.console = None
  108.         self.mapNameShower = None
  109.         self.affectShower = None
  110.         self.playerGauge = None
  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.         self.playerGauge = uiPlayerGauge.PlayerGauge(self)
  134.         self.playerGauge.Hide()
  135.  
  136.         self.__SetQuickSlotMode()
  137.  
  138.         self.__ServerCommand_Build()
  139.         self.__ProcessPreservedServerCommand()
  140.        
  141.         self.timeLine = ui.TextLine()
  142.         self.timeLine.SetFontName(localeInfo.UI_DEF_FONT_LARGE )
  143.         self.timeLine.SetFontColor(10, 10, 0)
  144.         self.timeLine.SetPosition((wndMgr.GetScreenWidth() - 145) / 2, 205)
  145.        
  146.         self.wndItemChance = itemchance.ItemChance()
  147.        
  148.         self.switchbot = Bot()
  149.         self.switchbot.Hide()
  150.        
  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.         app.SetFrameSkip(1)
  159.  
  160.         self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  161.        
  162.         ##Oyuna girdi##
  163.         self.interface.ToggleMessenger()
  164.         self.interface.ToggleMessenger()
  165.        
  166.         self.GirdiButton = ui.Button()
  167.         self.GirdiButton.SetParent(self)
  168.         self.GirdiButton.SetUpVisual("onlineboard.tga")
  169.         self.GirdiButton.SetOverVisual("onlineboard.tga")
  170.         self.GirdiButton.SetDownVisual("onlineboard.tga")
  171.         self.GirdiButton.SetPosition(wndMgr.GetScreenWidth() - 150 - 100 + 30, wndMgr.GetScreenHeight() - 100 - 100 + 85 - 30 - 5)
  172.        
  173.         self.TextLines = ui.TextLine()
  174.         self.TextLines.SetParent(self.GirdiButton)
  175.         self.TextLines.SetPosition(40,17)
  176.         self.TextLines.SetText("@Vectors")
  177.         self.TextLines.Show()
  178.        
  179.         self.GirdiKapat = ui.Button()
  180.         self.GirdiKapat.SetParent(self.GirdiButton)
  181.         self.GirdiKapat.SetUpVisual("d:/ymir work/ui/public/close_button_01.sub")
  182.         self.GirdiKapat.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub")
  183.         self.GirdiKapat.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub")
  184.         self.GirdiKapat.SetPosition(185-9-5-2,1+4)
  185.         self.GirdiKapat.SetEvent(self.LanKapat)
  186.         ##Oyuna girdi##
  187.  
  188.         self.quickSlotPageIndex = 0
  189.         self.PickingCharacterIndex = -1
  190.         self.PickingItemIndex = -1
  191.         self.consoleEnable = FALSE
  192.         self.isShowDebugInfo = FALSE
  193.         self.ShowNameFlag = FALSE
  194.  
  195.         self.enableXMasBoom = FALSE
  196.         self.startTimeXMasBoom = 0.0
  197.         self.indexXMasBoom = 0
  198.  
  199.         global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  200.  
  201.         app.SetCamera(cameraDistance, cameraPitch, cameraRotation, cameraHeight)
  202.  
  203.         constInfo.SET_DEFAULT_CAMERA_MAX_DISTANCE()
  204.         constInfo.SET_DEFAULT_CHRNAME_COLOR()
  205.         constInfo.SET_DEFAULT_FOG_LEVEL()
  206.         constInfo.SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE()
  207.         constInfo.SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS()
  208.         constInfo.SET_DEFAULT_USE_SKILL_EFFECT_ENABLE()
  209.  
  210.         # TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  211.         constInfo.SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE()
  212.         # END_OF_TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  213.  
  214.         import event
  215.         event.SetLeftTimeString(localeInfo.UI_LEFT_TIME)
  216.  
  217.         textTail.EnablePKTitle(constInfo.PVPMODE_ENABLE)
  218.  
  219.         if constInfo.PVPMODE_TEST_ENABLE:
  220.             self.testPKMode = ui.TextLine()
  221.             self.testPKMode.SetFontName(localeInfo.UI_DEF_FONT)
  222.             self.testPKMode.SetPosition(0, 15)
  223.             self.testPKMode.SetWindowHorizontalAlignCenter()
  224.             self.testPKMode.SetHorizontalAlignCenter()
  225.             self.testPKMode.SetFeather()
  226.             self.testPKMode.SetOutline()
  227.             self.testPKMode.Show()
  228.  
  229.             self.testAlignment = ui.TextLine()
  230.             self.testAlignment.SetFontName(localeInfo.UI_DEF_FONT)
  231.             self.testAlignment.SetPosition(0, 35)
  232.             self.testAlignment.SetWindowHorizontalAlignCenter()
  233.             self.testAlignment.SetHorizontalAlignCenter()
  234.             self.testAlignment.SetFeather()
  235.             self.testAlignment.SetOutline()
  236.             self.testAlignment.Show()
  237.  
  238.         self.__BuildKeyDict()
  239.         self.__BuildDebugInfo()
  240.  
  241.         # PRIVATE_SHOP_PRICE_LIST
  242.         uiPrivateShopBuilder.Clear()
  243.         # END_OF_PRIVATE_SHOP_PRICE_LIST
  244.  
  245.         # UNKNOWN_UPDATE
  246.         exchange.InitTrading()
  247.         # END_OF_UNKNOWN_UPDATE
  248.  
  249.  
  250.         ## Sound
  251.         snd.SetMusicVolume(systemSetting.GetMusicVolume()*net.GetFieldMusicVolume())
  252.         snd.SetSoundVolume(systemSetting.GetSoundVolume())
  253.  
  254.         netFieldMusicFileName = net.GetFieldMusicFileName()
  255.         if netFieldMusicFileName:
  256.             snd.FadeInMusic("BGM/" + netFieldMusicFileName)
  257.         elif musicInfo.fieldMusic != "":                       
  258.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  259.  
  260.         self.__SetQuickSlotMode()
  261.         self.__SelectQuickPage(self.quickSlotPageIndex)
  262.  
  263.         self.SetFocus()
  264.         self.Show()
  265.         app.ShowCursor()
  266.  
  267.         net.SendEnterGamePacket()
  268.  
  269.         # START_GAME_ERROR_EXIT
  270.         try:
  271.             self.StartGame()
  272.         except:
  273.             import exception
  274.             exception.Abort("GameWindow.Open")
  275.         # END_OF_START_GAME_ERROR_EXIT
  276.        
  277.         # NPC가 큐브시스템으로 만들 수 있는 아이템들의 목록을 캐싱
  278.         # ex) cubeInformation[20383] = [ {"rewordVNUM": 72723, "rewordCount": 1, "materialInfo": "101,1&102,2", "price": 999 }, ... ]
  279.         self.cubeInformation = {}
  280.         self.currentCubeNPC = 0
  281.        
  282.     def Close(self):
  283.         self.Hide()
  284.  
  285.         global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  286.         (cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
  287.  
  288.         if musicInfo.fieldMusic != "":
  289.             snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
  290.  
  291.         self.onPressKeyDict = None
  292.         self.onClickKeyDict = None
  293.  
  294.         chat.Close()
  295.         snd.StopAllSound()
  296.         grp.InitScreenEffect()
  297.         chr.Destroy()
  298.         textTail.Clear()
  299.         quest.Clear()
  300.         background.Destroy()
  301.         guild.Destroy()
  302.         messenger.Destroy()
  303.         skill.ClearSkillData()
  304.         wndMgr.Unlock()
  305.         mouseModule.mouseController.DeattachObject()
  306.  
  307.         if self.guildWarQuestionDialog:
  308.             self.guildWarQuestionDialog.Close()
  309.  
  310.         self.guildNameBoard = None
  311.         self.partyRequestQuestionDialog = None
  312.         self.partyInviteQuestionDialog = None
  313.         self.guildInviteQuestionDialog = None
  314.         self.guildWarQuestionDialog = None
  315.         self.messengerAddFriendQuestion = None
  316.  
  317.         # UNKNOWN_UPDATE
  318.         self.itemDropQuestionDialog = None
  319.         # END_OF_UNKNOWN_UPDATE
  320.  
  321.         # QUEST_CONFIRM
  322.         self.confirmDialog = None
  323.         # END_OF_QUEST_CONFIRM
  324.  
  325.         self.PrintCoord = None
  326.         self.FrameRate = None
  327.         self.Pitch = None
  328.         self.Splat = None
  329.         self.TextureNum = None
  330.         self.ObjectNum = None
  331.         self.ViewDistance = None
  332.         self.PrintMousePos = None
  333.  
  334.         self.ClearDictionary()
  335.  
  336.         self.playerGauge = None
  337.         self.mapNameShower = None
  338.         self.affectShower = None
  339.  
  340.         if self.console:
  341.             self.console.BindGameClass(0)
  342.             self.console.Close()
  343.             self.console=None
  344.        
  345.         if self.targetBoard:
  346.             self.targetBoard.Destroy()
  347.             self.targetBoard = None
  348.    
  349.         if self.interface:
  350.             self.interface.HideAllWindows()
  351.             self.interface.Close()
  352.             self.interface=None
  353.            
  354.         if self.wndItemChance.IsShow():
  355.             self.wndItemChance.Open()
  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.         onPressKeyDict[app.DIK_F5]  = lambda : self.__toggleSwitchbot()    
  386.         onPressKeyDict[app.DIK_F6]  = lambda : self.__ArayuzManager()
  387.         onPressKeyDict[app.DIK_F7]  = lambda : self.EgeSwitchbot()
  388.         onPressKeyDict[app.DIK_X]  = lambda : self.__BonusPage()
  389.  
  390.         onPressKeyDict[app.DIK_LALT]        = lambda : self.ShowName()
  391.         onPressKeyDict[app.DIK_LCONTROL]    = lambda : self.ShowMouseImage()
  392.         onPressKeyDict[app.DIK_SYSRQ]       = lambda : self.SaveScreen()
  393.         onPressKeyDict[app.DIK_SPACE]       = lambda : self.StartAttack()
  394.  
  395.         #캐릭터 이동키
  396.         onPressKeyDict[app.DIK_UP]          = lambda : self.MoveUp()
  397.         onPressKeyDict[app.DIK_DOWN]        = lambda : self.MoveDown()
  398.         onPressKeyDict[app.DIK_LEFT]        = lambda : self.MoveLeft()
  399.         onPressKeyDict[app.DIK_RIGHT]       = lambda : self.MoveRight()
  400.         onPressKeyDict[app.DIK_W]           = lambda : self.MoveUp()
  401.         onPressKeyDict[app.DIK_S]           = lambda : self.MoveDown()
  402.         onPressKeyDict[app.DIK_A]           = lambda : self.MoveLeft()
  403.         onPressKeyDict[app.DIK_D]           = lambda : self.MoveRight()
  404.  
  405.         onPressKeyDict[app.DIK_E]           = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
  406.         onPressKeyDict[app.DIK_R]           = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
  407.         #onPressKeyDict[app.DIK_F]          = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  408.         onPressKeyDict[app.DIK_T]           = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
  409.         onPressKeyDict[app.DIK_G]           = self.__PressGKey
  410.         onPressKeyDict[app.DIK_Q]           = self.__PressQKey
  411.         onPressKeyDict[app.DIK_P]           = self.__PressPKey
  412.  
  413.         onPressKeyDict[app.DIK_NUMPAD9]     = lambda: app.MovieResetCamera()
  414.         onPressKeyDict[app.DIK_NUMPAD4]     = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
  415.         onPressKeyDict[app.DIK_NUMPAD6]     = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)
  416.         onPressKeyDict[app.DIK_PGUP]        = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)
  417.         onPressKeyDict[app.DIK_PGDN]        = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
  418.         onPressKeyDict[app.DIK_NUMPAD8]     = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
  419.         onPressKeyDict[app.DIK_NUMPAD2]     = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
  420.         onPressKeyDict[app.DIK_GRAVE]       = lambda : self.PickUpItem()
  421.         onPressKeyDict[app.DIK_Z]           = lambda : self.PickUpItem()
  422.         onPressKeyDict[app.DIK_C]           = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
  423.         onPressKeyDict[app.DIK_V]           = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
  424.         #onPressKeyDict[app.DIK_B]          = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
  425.         onPressKeyDict[app.DIK_N]           = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
  426.         onPressKeyDict[app.DIK_I]           = lambda : self.interface.ToggleInventoryWindow()
  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.     def __PressQKey(self):
  540.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  541.             if 0==interfaceModule.IsQBHide:
  542.                 interfaceModule.IsQBHide = 1
  543.                 self.interface.HideAllQuestButton()
  544.             else:
  545.                 interfaceModule.IsQBHide = 0
  546.                 self.interface.ShowAllQuestButton()
  547.         else:
  548.             app.RotateCamera(app.CAMERA_TO_NEGATIVE)
  549.  
  550.     def __PressPKey(self):
  551.         if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  552.             if 0==interfaceModule.IsWisperHide:
  553.                 interfaceModule.IsWisperHide = 1
  554.                 self.interface.HideAllWhisperButton()
  555.             else:
  556.                 interfaceModule.IsWisperHide= 0
  557.                 self.interface.ShowAllWhisperButton()
  558.  
  559.     def __SetQuickSlotMode(self):
  560.         self.pressNumber=ui.__mem_func__(self.__PressQuickSlot)
  561.  
  562.     def __SetQuickPageMode(self):
  563.         self.pressNumber=ui.__mem_func__(self.__SelectQuickPage)
  564.  
  565.     def __PressQuickSlot(self, localSlotIndex):
  566.         if localeInfo.IsARABIC():
  567.             if 0 <= localSlotIndex and localSlotIndex < 4:
  568.                 player.RequestUseLocalQuickSlot(3-localSlotIndex)
  569.             else:
  570.                 player.RequestUseLocalQuickSlot(11-localSlotIndex)
  571.         else:
  572.             player.RequestUseLocalQuickSlot(localSlotIndex)        
  573.  
  574.     def __SelectQuickPage(self, pageIndex):
  575.         self.quickSlotPageIndex = pageIndex
  576.         player.SetQuickPage(pageIndex)
  577.  
  578.     def ToggleDebugInfo(self):
  579.         self.isShowDebugInfo = not self.isShowDebugInfo
  580.  
  581.         if self.isShowDebugInfo:
  582.             self.PrintCoord.Show()
  583.             self.FrameRate.Show()
  584.             self.Pitch.Show()
  585.             self.Splat.Show()
  586.             self.TextureNum.Show()
  587.             self.ObjectNum.Show()
  588.             self.ViewDistance.Show()
  589.             self.PrintMousePos.Show()
  590.         else:
  591.             self.PrintCoord.Hide()
  592.             self.FrameRate.Hide()
  593.             self.Pitch.Hide()
  594.             self.Splat.Hide()
  595.             self.TextureNum.Hide()
  596.             self.ObjectNum.Hide()
  597.             self.ViewDistance.Hide()
  598.             self.PrintMousePos.Hide()
  599.  
  600.     def __BuildDebugInfo(self):
  601.         ## Character Position Coordinate
  602.         self.PrintCoord = ui.TextLine()
  603.         self.PrintCoord.SetFontName(localeInfo.UI_DEF_FONT)
  604.         self.PrintCoord.SetPosition(wndMgr.GetScreenWidth() - 270, 0)
  605.        
  606.         ## Frame Rate
  607.         self.FrameRate = ui.TextLine()
  608.         self.FrameRate.SetFontName(localeInfo.UI_DEF_FONT)
  609.         self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
  610.  
  611.         ## Camera Pitch
  612.         self.Pitch = ui.TextLine()
  613.         self.Pitch.SetFontName(localeInfo.UI_DEF_FONT)
  614.         self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
  615.  
  616.         ## Splat
  617.         self.Splat = ui.TextLine()
  618.         self.Splat.SetFontName(localeInfo.UI_DEF_FONT)
  619.         self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
  620.        
  621.         ##
  622.         self.PrintMousePos = ui.TextLine()
  623.         self.PrintMousePos.SetFontName(localeInfo.UI_DEF_FONT)
  624.         self.PrintMousePos.SetPosition(wndMgr.GetScreenWidth() - 270, 80)
  625.  
  626.         # TextureNum
  627.         self.TextureNum = ui.TextLine()
  628.         self.TextureNum.SetFontName(localeInfo.UI_DEF_FONT)
  629.         self.TextureNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
  630.  
  631.         # 오브젝트 그리는 개수
  632.         self.ObjectNum = ui.TextLine()
  633.         self.ObjectNum.SetFontName(localeInfo.UI_DEF_FONT)
  634.         self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 120)
  635.  
  636.         # 시야거리
  637.         self.ViewDistance = ui.TextLine()
  638.         self.ViewDistance.SetFontName(localeInfo.UI_DEF_FONT)
  639.         self.ViewDistance.SetPosition(0, 0)
  640.        
  641.         #SAAT
  642.         self.timeLine.SetWindowHorizontalAlignCenter()
  643.         self.timeLine.SetHorizontalAlignCenter()
  644.         self.timeLine.SetFeather()
  645.         self.timeLine.SetOutline()
  646.         self.timeLine.Show()
  647.  
  648.     def __NotifyError(self, msg):
  649.         chat.AppendChat(chat.CHAT_TYPE_INFO, msg)
  650.  
  651.     def ChangePKMode(self):
  652.  
  653.         if not app.IsPressed(app.DIK_LCONTROL):
  654.             return
  655.  
  656.         if player.GetStatus(player.LEVEL)<constInfo.PVPMODE_PROTECTED_LEVEL:
  657.             self.__NotifyError(localeInfo.OPTION_PVPMODE_PROTECT % (constInfo.PVPMODE_PROTECTED_LEVEL))
  658.             return
  659.  
  660.         curTime = app.GetTime()
  661.         if curTime - self.lastPKModeSendedTime < constInfo.PVPMODE_ACCELKEY_DELAY:
  662.             return
  663.  
  664.         self.lastPKModeSendedTime = curTime
  665.  
  666.         curPKMode = player.GetPKMode()
  667.         nextPKMode = curPKMode + 1
  668.         if nextPKMode == player.PK_MODE_PROTECT:
  669.             if 0 == player.GetGuildID():
  670.                 chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
  671.                 nextPKMode = 0
  672.             else:
  673.                 nextPKMode = player.PK_MODE_GUILD
  674.  
  675.         elif nextPKMode == player.PK_MODE_MAX_NUM:
  676.             nextPKMode = 0
  677.  
  678.         net.SendChatPacket("/PKMode " + str(nextPKMode))
  679.         print "/PKMode " + str(nextPKMode)
  680.  
  681.     def OnChangePKMode(self):
  682.  
  683.         self.interface.OnChangePKMode()
  684.  
  685.         try:
  686.             self.__NotifyError(localeInfo.OPTION_PVPMODE_MESSAGE_DICT[player.GetPKMode()])
  687.         except KeyError:
  688.             print "UNKNOWN PVPMode[%d]" % (player.GetPKMode())
  689.  
  690.         if constInfo.PVPMODE_TEST_ENABLE:
  691.             curPKMode = player.GetPKMode()
  692.             alignment, grade = chr.testGetPKData()
  693.             self.pkModeNameDict = { 0 : "PEACE", 1 : "REVENGE", 2 : "FREE", 3 : "PROTECT", }
  694.             self.testPKMode.SetText("Current PK Mode : " + self.pkModeNameDict.get(curPKMode, "UNKNOWN"))
  695.             self.testAlignment.SetText("Current Alignment : " + str(alignment) + " (" + localeInfo.TITLE_NAME_LIST[grade] + ")")
  696.  
  697.     ###############################################################################################
  698.     ###############################################################################################
  699.     ## Game Callback Functions
  700.  
  701.     # Start
  702.     def StartGame(self):
  703.         self.RefreshInventory()
  704.         self.RefreshEquipment()
  705.         self.RefreshCharacter()
  706.         self.RefreshSkill()
  707.  
  708.     # Refresh
  709.     def CheckGameButton(self):
  710.         if self.interface:
  711.             self.interface.CheckGameButton()
  712.  
  713.     def RefreshAlignment(self):
  714.         self.interface.RefreshAlignment()
  715.  
  716.     def RefreshStatus(self):
  717.         self.CheckGameButton()
  718.  
  719.         if self.interface:
  720.             self.interface.RefreshStatus()
  721.  
  722.         if self.playerGauge:
  723.             self.playerGauge.RefreshGauge()
  724.  
  725.     def RefreshStamina(self):
  726.         self.interface.RefreshStamina()
  727.  
  728.     def RefreshSkill(self):
  729.         self.CheckGameButton()
  730.         if self.interface:
  731.             self.interface.RefreshSkill()
  732.  
  733.     def RefreshQuest(self):
  734.         self.interface.RefreshQuest()
  735.  
  736.     def RefreshMessenger(self):
  737.         self.interface.RefreshMessenger()
  738.  
  739.     def RefreshGuildInfoPage(self):
  740.         self.interface.RefreshGuildInfoPage()
  741.  
  742.     def RefreshGuildBoardPage(self):
  743.         self.interface.RefreshGuildBoardPage()
  744.  
  745.     def RefreshGuildMemberPage(self):
  746.         self.interface.RefreshGuildMemberPage()
  747.  
  748.     def RefreshGuildMemberPageGradeComboBox(self):
  749.         self.interface.RefreshGuildMemberPageGradeComboBox()
  750.  
  751.     def RefreshGuildSkillPage(self):
  752.         self.interface.RefreshGuildSkillPage()
  753.  
  754.     def RefreshGuildGradePage(self):
  755.         self.interface.RefreshGuildGradePage()
  756.  
  757.     def RefreshMobile(self):
  758.         if self.interface:
  759.             self.interface.RefreshMobile()
  760.  
  761.     def OnMobileAuthority(self):
  762.         self.interface.OnMobileAuthority()
  763.  
  764.     def OnBlockMode(self, mode):
  765.         self.interface.OnBlockMode(mode)
  766.  
  767.     def OpenQuestWindow(self, skin, idx):
  768.         if constInfo.INPUT_IGNORE == 1:
  769.             return
  770.         elif constInfo.CApiSetHide == 1:
  771.             net.SendQuestInputStringPacket(str(constInfo.SendString))
  772.             constInfo.CApiSetHide = 0
  773.             return
  774.         self.interface.OpenQuestWindow(skin, idx)
  775.  
  776.     def AskGuildName(self):
  777.  
  778.         guildNameBoard = uiCommon.InputDialog()
  779.         guildNameBoard.SetTitle(localeInfo.GUILD_NAME)
  780.         guildNameBoard.SetAcceptEvent(ui.__mem_func__(self.ConfirmGuildName))
  781.         guildNameBoard.SetCancelEvent(ui.__mem_func__(self.CancelGuildName))
  782.         guildNameBoard.Open()
  783.  
  784.         self.guildNameBoard = guildNameBoard
  785.  
  786.     def ConfirmGuildName(self):
  787.         guildName = self.guildNameBoard.GetText()
  788.         if not guildName:
  789.             return
  790.  
  791.         if net.IsInsultIn(guildName):
  792.             self.PopupMessage(localeInfo.GUILD_CREATE_ERROR_INSULT_NAME)
  793.             return
  794.  
  795.         net.SendAnswerMakeGuildPacket(guildName)
  796.         self.guildNameBoard.Close()
  797.         self.guildNameBoard = None
  798.         return TRUE
  799.  
  800.     def CancelGuildName(self):
  801.         self.guildNameBoard.Close()
  802.         self.guildNameBoard = None
  803.         return TRUE
  804.  
  805.     ## Refine
  806.     def PopupMessage(self, msg):
  807.         self.stream.popupWindow.Close()
  808.         self.stream.popupWindow.Open(msg, 0, localeInfo.UI_OK)
  809.  
  810.     def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type=0):
  811.         self.interface.OpenRefineDialog(targetItemPos, nextGradeItemVnum, cost, prob, type)
  812.  
  813.     def AppendMaterialToRefineDialog(self, vnum, count):
  814.         self.interface.AppendMaterialToRefineDialog(vnum, count)
  815.  
  816.     def RunUseSkillEvent(self, slotIndex, coolTime):
  817.         self.interface.OnUseSkill(slotIndex, coolTime)
  818.  
  819.     def ClearAffects(self):
  820.         self.affectShower.ClearAffects()
  821.  
  822.     def SetAffect(self, affect):
  823.         self.affectShower.SetAffect(affect)
  824.  
  825.     def ResetAffect(self, affect):
  826.         self.affectShower.ResetAffect(affect)
  827.  
  828.     # UNKNOWN_UPDATE
  829.     def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  830.         self.affectShower.BINARY_NEW_AddAffect(type, pointIdx, value, duration)
  831.         if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  832.             self.interface.DragonSoulActivate(type - chr.NEW_AFFECT_DRAGON_SOUL_DECK1)
  833.         elif chr.NEW_AFFECT_DRAGON_SOUL_QUALIFIED == type:
  834.             self.BINARY_DragonSoulGiveQuilification()
  835.  
  836.     def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  837.         self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  838.         if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  839.             self.interface.DragonSoulDeactivate()
  840.    
  841.  
  842.  
  843.     # END_OF_UNKNOWN_UPDATE
  844.  
  845.     def ActivateSkillSlot(self, slotIndex):
  846.         if self.interface:
  847.             self.interface.OnActivateSkill(slotIndex)
  848.  
  849.     def DeactivateSkillSlot(self, slotIndex):
  850.         if self.interface:
  851.             self.interface.OnDeactivateSkill(slotIndex)
  852.  
  853.     def RefreshEquipment(self):
  854.         if self.interface:
  855.             self.interface.RefreshInventory()
  856.  
  857.     def RefreshInventory(self):
  858.         if self.interface:
  859.             self.interface.RefreshInventory()
  860.  
  861.     def RefreshCharacter(self):
  862.         if self.interface:
  863.             self.interface.RefreshCharacter()
  864.  
  865.     def OnGameOver(self):
  866.         self.CloseTargetBoard()
  867.         self.OpenRestartDialog()
  868.  
  869.     def OpenRestartDialog(self):
  870.         self.interface.OpenRestartDialog()
  871.  
  872.     def ChangeCurrentSkill(self, skillSlotNumber):
  873.         self.interface.OnChangeCurrentSkill(skillSlotNumber)
  874.  
  875.     ## TargetBoard
  876.     def SetPCTargetBoard(self, vid, name):
  877.         self.targetBoard.Open(vid, name)
  878.        
  879.         if app.IsPressed(app.DIK_LCONTROL):
  880.            
  881.             if not player.IsSameEmpire(vid):
  882.                 return
  883.  
  884.             if player.IsMainCharacterIndex(vid):
  885.                 return     
  886.             elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(vid):
  887.                 return
  888.  
  889.             self.interface.OpenWhisperDialog(name)
  890.            
  891.  
  892.     def RefreshTargetBoardByVID(self, vid):
  893.         self.targetBoard.RefreshByVID(vid)
  894.  
  895.     def RefreshTargetBoardByName(self, name):
  896.         self.targetBoard.RefreshByName(name)
  897.        
  898.     def __RefreshTargetBoard(self):
  899.         self.targetBoard.Refresh()
  900.        
  901.     def SetHPTargetBoard(self, vid, hpPercentage):
  902.         if vid != self.targetBoard.GetTargetVID():
  903.             self.targetBoard.ResetTargetBoard()
  904.             self.targetBoard.SetEnemyVID(vid)
  905.  
  906.         self.targetBoard.SetHP(hpPercentage)
  907.         self.targetBoard.Show()
  908.  
  909.     def CloseTargetBoardIfDifferent(self, vid):
  910.         if vid != self.targetBoard.GetTargetVID():
  911.             self.targetBoard.Close()
  912.  
  913.     def CloseTargetBoard(self):
  914.         self.targetBoard.Close()
  915.  
  916.     ## View Equipment
  917.     def OpenEquipmentDialog(self, vid):
  918.         self.interface.OpenEquipmentDialog(vid)
  919.  
  920.     def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
  921.         self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
  922.  
  923.     def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
  924.         self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
  925.  
  926.     def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
  927.         self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
  928.  
  929.     # SHOW_LOCAL_MAP_NAME
  930.     def ShowMapName(self, mapName, x, y):
  931.  
  932.         if self.mapNameShower:
  933.             self.mapNameShower.ShowMapName(mapName, x, y)
  934.  
  935.         if self.interface:
  936.             self.interface.SetMapName(mapName)
  937.     # END_OF_SHOW_LOCAL_MAP_NAME   
  938.  
  939.     def BINARY_OpenAtlasWindow(self):
  940.         self.interface.BINARY_OpenAtlasWindow()
  941.  
  942.     ## Chat
  943.     def OnRecvWhisper(self, mode, name, line):
  944.         ##koray- shop - log
  945.         if line.find("#_satin_aldi#") != -1:
  946.             bol = line.split('#')
  947.             chat.AppendChat(chat.CHAT_TYPE_INFO, name + ' Adli Oyuncu -> ' + bol[1] + ' -> ' + localeInfo.NumberToMoneyString(bol[2]) + "'a Satin aldi." + str(bol[3]))
  948.             gameInfo.PV_SHOP_LOG.append("#"+name+'#'+bol[1]+'#'+bol[2]+'#'+bol[3]+'#')
  949.             return 
  950.         if line.find("xxbanasinifiniverxx") != -1:
  951.             race = net.GetMainActorRace()
  952.             if not guild.IsGuildEnable():
  953.                 net.SendWhisperPacket(name, "xxbuyursinifimkardesimxx"+str(race)+"xx"+"Lonca yok.xx"+str(player.GetStatus(player.LEVEL))+"xx")
  954.             else:
  955.                 net.SendWhisperPacket(name, "xxbuyursinifimkardesimxx"+str(race)+"xx"+str(player.GetGuildName())+"xx"+str(player.GetStatus(player.LEVEL))+"xx")
  956.             return
  957.         if line.find("xxbuyursinifimkardesimxx") != -1:
  958.             constInfo.ticsinif = int(line.split("xx")[2])
  959.             constInfo.ticlonca = line.split("xx")[3]
  960.             constInfo.ticlevel = line.split("xx")[4]
  961.             return 
  962.     ##Oyuna girdi##
  963.         global kisi
  964.         global oyunagirdi
  965.         if line.find('oyunagirdi||') != -1:
  966.             if constInfo.bildirimler == 0:
  967.                 oyunagirdi = 1
  968.                 self.GirdiButton.Show()
  969.                 kisi = name
  970.                 self.TextLines.Show()
  971.                 self.GirdiKapat.Show()
  972.                 self.TextLines.SetText(name + " oyuna girdi.")
  973.                 self.Bekle = app.GetTime()
  974.             else:
  975.                 pass
  976.             return
  977.         else:
  978.             pass
  979.         ##PMDE ENGELLE##
  980.         if os.path.exists(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf") and open(str(constInfo.CLIENT_YOL)+"block_"+str(player.GetName())+".kf", "r").read().find("#"+str(name)+"#") != -1:
  981.             net.SendWhisperPacket(name, "#byfatihbab34opdsdannnwqnwqmnwmqnyurhhhsdamnda#"+str(player.GetStatus(player.LEVEL))+"#1#")
  982.             return
  983.         else:
  984.             pass
  985.  
  986.         if line.find("byfatihbab34opdsdannnwqnwqmnwmqnyurhhhsdamnda") != -1:
  987.             bol = line.split("#")
  988.             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Sizi engellemis, Bu kisiye mesaj atamassiniz.")
  989.             return
  990.             ##Oyuna girdi##
  991.         if line.find("kanatsanahpspq") != -1:
  992.             chat.AppendChat(chat.CHAT_TYPE_INFO, locale.RAKIPKABULETMEDILANXD)
  993.             return
  994.         if line.find("kanatsanahpsp") != -1:
  995.             chat.AppendChat(chat.CHAT_TYPE_INFO, locale.RAKIPKABULETMEDILANXD2)
  996.             return
  997.  
  998.         if line.find('HP kabul etmedi') != -1:
  999.             chat.AppendChat(chat.CHAT_TYPE_INFO, name + ' adli oyuncu HP ve SP gostermesini redetti. ')
  1000.             constInfo.DUELLODAIZINVARMI = "Kabul etmedi."
  1001.             return
  1002.         elif line.find('HP kabul ettimaq') != -1:
  1003.             chat.AppendChat(chat.CHAT_TYPE_INFO, name + " adli oyuncu duello'da HP ve SP gosterme'yi kabul etti. ")
  1004.             constInfo.DUELLODAIZINVARMI = "Kabul etti."
  1005.             return
  1006.         elif line.find('C kabul etmedi') != -1:
  1007.             chat.AppendChat(chat.CHAT_TYPE_INFO, name + ' adli oyuncu HP ve SP gotermesini redetti. ')
  1008.             constInfo.DUELLODAIZINVARMI = "Kabul etmedi."
  1009.             return
  1010.         elif line.find('C kabul ettimaq') != -1:
  1011.             chat.AppendChat(chat.CHAT_TYPE_INFO, name + " adli oyuncu duello'da HP ve SP gosterme'yi kabul etti. ")
  1012.             constInfo.DUELLODAIZINVARMI = "Kabul etti."
  1013.             return
  1014.         else:
  1015.             pass   
  1016.            
  1017.         chat.AppendWhisper(mode, name, line)
  1018.         self.interface.RecvWhisper(name)
  1019.        
  1020.     def LanKapat(self):
  1021.         global kisi
  1022.         global oyunagirdi
  1023.         if kisi == "":
  1024.             pass
  1025.         else:
  1026.             self.GirdiButton.Hide()
  1027.             oyunagirdi = 0
  1028.            
  1029.     def GirdiKapat(self):
  1030.         self.GirdiButton.Hide()
  1031.     ##Oyuna girdi##
  1032.  
  1033.     def OnRecvWhisperSystemMessage(self, mode, name, line):
  1034.         chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
  1035.         self.interface.RecvWhisper(name)
  1036.  
  1037.     def OnRecvWhisperError(self, mode, name, line):
  1038.         if localeInfo.WHISPER_ERROR.has_key(mode):
  1039.             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name))
  1040.         else:
  1041.             chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
  1042.         self.interface.RecvWhisper(name)
  1043.  
  1044.     def RecvWhisper(self, name):
  1045.         self.interface.RecvWhisper(name)
  1046.  
  1047.     def OnPickMoney(self, money):
  1048.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_PICK_MONEY % (money))
  1049.  
  1050.     def OnShopError(self, type):
  1051.         try:
  1052.             self.PopupMessage(localeInfo.SHOP_ERROR_DICT[type])
  1053.         except KeyError:
  1054.             self.PopupMessage(localeInfo.SHOP_ERROR_UNKNOWN % (type))
  1055.  
  1056.     def OnSafeBoxError(self):
  1057.         self.PopupMessage(localeInfo.SAFEBOX_ERROR)
  1058.  
  1059.     def OnFishingSuccess(self, isFish, fishName):
  1060.         chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_SUCCESS(isFish, fishName), 2000)
  1061.  
  1062.     # ADD_FISHING_MESSAGE
  1063.     def OnFishingNotifyUnknown(self):
  1064.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_UNKNOWN)
  1065.  
  1066.     def OnFishingWrongPlace(self):
  1067.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_WRONG_PLACE)
  1068.     # END_OF_ADD_FISHING_MESSAGE
  1069.  
  1070.     def OnFishingNotify(self, isFish, fishName):
  1071.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_NOTIFY(isFish, fishName))
  1072.  
  1073.     def OnFishingFailure(self):
  1074.         chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_FAILURE, 2000)
  1075.  
  1076.     def OnCannotPickItem(self):
  1077.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_PICK_ITEM)
  1078.  
  1079.     # MINING
  1080.     def OnCannotMining(self):
  1081.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_MINING)
  1082.     # END_OF_MINING
  1083.  
  1084.     def OnCannotUseSkill(self, vid, type):
  1085.         if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
  1086.             textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type])
  1087.  
  1088.         if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
  1089.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type])
  1090.  
  1091.     def OnCannotShotError(self, vid, type):
  1092.         textTail.RegisterInfoTail(vid, localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type)))
  1093.  
  1094.     ## PointReset
  1095.     def StartPointReset(self):
  1096.         self.interface.OpenPointResetDialog()
  1097.  
  1098.     ## Shop
  1099.     def StartShop(self, vid):
  1100.         self.interface.OpenShopDialog(vid)
  1101.  
  1102.     def EndShop(self):
  1103.         self.interface.CloseShopDialog()
  1104.  
  1105.     def RefreshShop(self):
  1106.         self.interface.RefreshShopDialog()
  1107.  
  1108.     def SetShopSellingPrice(self, Price):
  1109.         pass
  1110.  
  1111.     ## Exchange
  1112.     def StartExchange(self):
  1113.         self.interface.StartExchange()
  1114.  
  1115.     def EndExchange(self):
  1116.         self.interface.EndExchange()
  1117.  
  1118.     def RefreshExchange(self):
  1119.         self.interface.RefreshExchange()
  1120.  
  1121.     ## Party
  1122.     def RecvPartyInviteQuestion(self, leaderVID, leaderName):
  1123.         partyInviteQuestionDialog = uiCommon.QuestionDialog()
  1124.         partyInviteQuestionDialog.SetText(leaderName + localeInfo.PARTY_DO_YOU_JOIN)
  1125.         partyInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerPartyInvite(arg))
  1126.         partyInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerPartyInvite(arg))
  1127.         partyInviteQuestionDialog.Open()
  1128.         partyInviteQuestionDialog.partyLeaderVID = leaderVID
  1129.         self.partyInviteQuestionDialog = partyInviteQuestionDialog
  1130.  
  1131.     def AnswerPartyInvite(self, answer):
  1132.  
  1133.         if not self.partyInviteQuestionDialog:
  1134.             return
  1135.  
  1136.         partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
  1137.  
  1138.         distance = player.GetCharacterDistance(partyLeaderVID)
  1139.         if distance < 0.0 or distance > 5000:
  1140.             answer = FALSE
  1141.  
  1142.         net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
  1143.  
  1144.         self.partyInviteQuestionDialog.Close()
  1145.         self.partyInviteQuestionDialog = None
  1146.  
  1147.     def AddPartyMember(self, pid, name):
  1148.         self.interface.AddPartyMember(pid, name)
  1149.  
  1150.     def UpdatePartyMemberInfo(self, pid):
  1151.         self.interface.UpdatePartyMemberInfo(pid)
  1152.  
  1153.     def RemovePartyMember(self, pid):
  1154.         self.interface.RemovePartyMember(pid)
  1155.         self.__RefreshTargetBoard()
  1156.  
  1157.     def LinkPartyMember(self, pid, vid):
  1158.         self.interface.LinkPartyMember(pid, vid)
  1159.  
  1160.     def UnlinkPartyMember(self, pid):
  1161.         self.interface.UnlinkPartyMember(pid)
  1162.  
  1163.     def UnlinkAllPartyMember(self):
  1164.         self.interface.UnlinkAllPartyMember()
  1165.  
  1166.     def ExitParty(self):
  1167.         self.interface.ExitParty()
  1168.         self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID())
  1169.  
  1170.     def ChangePartyParameter(self, distributionMode):
  1171.         self.interface.ChangePartyParameter(distributionMode)
  1172.  
  1173.     ## Messenger
  1174.     def OnMessengerAddFriendQuestion(self, name):
  1175.         messengerAddFriendQuestion = uiCommon.QuestionDialog2()
  1176.         messengerAddFriendQuestion.SetText1(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
  1177.         messengerAddFriendQuestion.SetText2(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2)
  1178.         messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend))
  1179.         messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend))
  1180.         messengerAddFriendQuestion.Open()
  1181.         messengerAddFriendQuestion.name = name
  1182.         self.messengerAddFriendQuestion = messengerAddFriendQuestion
  1183.  
  1184.     def OnAcceptAddFriend(self):
  1185.         name = self.messengerAddFriendQuestion.name
  1186.         net.SendChatPacket("/messenger_auth y " + name)
  1187.         self.OnCloseAddFriendQuestionDialog()
  1188.         return TRUE
  1189.  
  1190.     def OnDenyAddFriend(self):
  1191.         name = self.messengerAddFriendQuestion.name
  1192.         net.SendChatPacket("/messenger_auth n " + name)
  1193.         self.OnCloseAddFriendQuestionDialog()
  1194.         return TRUE
  1195.  
  1196.     def OnCloseAddFriendQuestionDialog(self):
  1197.         self.messengerAddFriendQuestion.Close()
  1198.         self.messengerAddFriendQuestion = None
  1199.         return TRUE
  1200.  
  1201.     ## SafeBox
  1202.     def OpenSafeboxWindow(self, size):
  1203.         self.interface.OpenSafeboxWindow(size)
  1204.  
  1205.     def RefreshSafebox(self):
  1206.         self.interface.RefreshSafebox()
  1207.  
  1208.     def RefreshSafeboxMoney(self):
  1209.         self.interface.RefreshSafeboxMoney()
  1210.  
  1211.     # ITEM_MALL
  1212.     def OpenMallWindow(self, size):
  1213.         self.interface.OpenMallWindow(size)
  1214.  
  1215.     def RefreshMall(self):
  1216.         self.interface.RefreshMall()
  1217.     # END_OF_ITEM_MALL
  1218.  
  1219.     ## Guild
  1220.     def RecvGuildInviteQuestion(self, guildID, guildName):
  1221.         guildInviteQuestionDialog = uiCommon.QuestionDialog()
  1222.         guildInviteQuestionDialog.SetText(guildName + localeInfo.GUILD_DO_YOU_JOIN)
  1223.         guildInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerGuildInvite(arg))
  1224.         guildInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerGuildInvite(arg))
  1225.         guildInviteQuestionDialog.Open()
  1226.         guildInviteQuestionDialog.guildID = guildID
  1227.         self.guildInviteQuestionDialog = guildInviteQuestionDialog
  1228.  
  1229.     def AnswerGuildInvite(self, answer):
  1230.  
  1231.         if not self.guildInviteQuestionDialog:
  1232.             return
  1233.  
  1234.         guildLeaderVID = self.guildInviteQuestionDialog.guildID
  1235.         net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
  1236.  
  1237.         self.guildInviteQuestionDialog.Close()
  1238.         self.guildInviteQuestionDialog = None
  1239.  
  1240.    
  1241.     def DeleteGuild(self):
  1242.         self.interface.DeleteGuild()
  1243.  
  1244.     ## Clock
  1245.     def ShowClock(self, second):
  1246.         self.interface.ShowClock(second)
  1247.  
  1248.     def HideClock(self):
  1249.         self.interface.HideClock()
  1250.  
  1251.     ## Emotion
  1252.     def BINARY_ActEmotion(self, emotionIndex):
  1253.         if self.interface.wndCharacter:
  1254.             self.interface.wndCharacter.ActEmotion(emotionIndex)
  1255.  
  1256.     ###############################################################################################
  1257.     ###############################################################################################
  1258.     ## Keyboard Functions
  1259.  
  1260.     def CheckFocus(self):
  1261.         if FALSE == self.IsFocus():
  1262.             if TRUE == self.interface.IsOpenChat():
  1263.                 self.interface.ToggleChat()
  1264.  
  1265.             self.SetFocus()
  1266.  
  1267.     def SaveScreen(self):
  1268.         print "save screen"
  1269.  
  1270.         # SCREENSHOT_CWDSAVE
  1271.         if SCREENSHOT_CWDSAVE:
  1272.             if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
  1273.                 os.mkdir(os.getcwd()+os.sep+"screenshot")
  1274.  
  1275.             (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep)
  1276.         elif SCREENSHOT_DIR:
  1277.             (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
  1278.         else:
  1279.             (succeeded, name) = grp.SaveScreenShot()
  1280.         # END_OF_SCREENSHOT_CWDSAVE
  1281.  
  1282.         if succeeded:
  1283.             pass
  1284.             chat.AppendChat(chat.CHAT_TYPE_INFO, name)
  1285.         else:
  1286.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE_FAILURE)
  1287.  
  1288.     def ShowConsole(self):
  1289.         pass
  1290.  
  1291.     def ShowName(self):
  1292.         self.ShowNameFlag = TRUE
  1293.         self.playerGauge.EnableShowAlways()
  1294.         player.SetQuickPage(self.quickSlotPageIndex+1)
  1295.  
  1296.     # ADD_ALWAYS_SHOW_NAME
  1297.     def __IsShowName(self):
  1298.  
  1299.         if systemSetting.IsAlwaysShowName():
  1300.             return TRUE
  1301.  
  1302.         if self.ShowNameFlag:
  1303.             return TRUE
  1304.  
  1305.         return FALSE
  1306.     # END_OF_ADD_ALWAYS_SHOW_NAME
  1307.    
  1308.     def HideName(self):
  1309.         self.ShowNameFlag = FALSE
  1310.         self.playerGauge.DisableShowAlways()
  1311.         player.SetQuickPage(self.quickSlotPageIndex)
  1312.  
  1313.     def ShowMouseImage(self):
  1314.         self.interface.ShowMouseImage()
  1315.  
  1316.     def HideMouseImage(self):
  1317.         self.interface.HideMouseImage()
  1318.  
  1319.     def StartAttack(self):
  1320.         player.SetAttackKeyState(TRUE)
  1321.  
  1322.     def EndAttack(self):
  1323.         player.SetAttackKeyState(FALSE)
  1324.  
  1325.     def MoveUp(self):
  1326.         player.SetSingleDIKKeyState(app.DIK_UP, TRUE)
  1327.  
  1328.     def MoveDown(self):
  1329.         player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)
  1330.  
  1331.     def MoveLeft(self):
  1332.         player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)
  1333.  
  1334.     def MoveRight(self):
  1335.         player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)
  1336.  
  1337.     def StopUp(self):
  1338.         player.SetSingleDIKKeyState(app.DIK_UP, FALSE)
  1339.  
  1340.     def StopDown(self):
  1341.         player.SetSingleDIKKeyState(app.DIK_DOWN, FALSE)
  1342.  
  1343.     def StopLeft(self):
  1344.         player.SetSingleDIKKeyState(app.DIK_LEFT, FALSE)
  1345.  
  1346.     def StopRight(self):
  1347.         player.SetSingleDIKKeyState(app.DIK_RIGHT, FALSE)
  1348.  
  1349.     def PickUpItem(self):
  1350.         player.PickCloseItem()
  1351.  
  1352.     ###############################################################################################
  1353.     ###############################################################################################
  1354.     ## Event Handler
  1355.  
  1356.     def OnKeyDown(self, key):
  1357.         if self.interface.wndWeb and self.interface.wndWeb.IsShow():
  1358.             return
  1359.  
  1360.         constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
  1361.  
  1362.         try:
  1363.             self.onPressKeyDict[key]()
  1364.         except KeyError:
  1365.             pass
  1366.         except:
  1367.             raise
  1368.  
  1369.         return TRUE
  1370.  
  1371.     def OnKeyUp(self, key):
  1372.         try:
  1373.             self.onClickKeyDict[key]()
  1374.         except KeyError:
  1375.             pass
  1376.         except:
  1377.             raise
  1378.  
  1379.         return TRUE
  1380.  
  1381.     def OnMouseLeftButtonDown(self):
  1382.         if self.interface.BUILD_OnMouseLeftButtonDown():
  1383.             return
  1384.  
  1385.         if mouseModule.mouseController.isAttached():
  1386.             self.CheckFocus()
  1387.         else:
  1388.             hyperlink = ui.GetHyperlink()
  1389.             if hyperlink:
  1390.                 return
  1391.             else:
  1392.                 self.CheckFocus()
  1393.                 player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  1394.  
  1395.         return TRUE
  1396.  
  1397.     def OnMouseLeftButtonUp(self):
  1398.  
  1399.         if self.interface.BUILD_OnMouseLeftButtonUp():
  1400.             return
  1401.  
  1402.         if mouseModule.mouseController.isAttached():
  1403.  
  1404.             attachedType = mouseModule.mouseController.GetAttachedType()
  1405.             attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1406.             attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1407.             attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1408.  
  1409.             ## QuickSlot
  1410.             if player.SLOT_TYPE_QUICK_SLOT == attachedType:
  1411.                 player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)
  1412.  
  1413.             ## Inventory
  1414.             elif player.SLOT_TYPE_INVENTORY == attachedType:
  1415.  
  1416.                 if player.ITEM_MONEY == attachedItemIndex:
  1417.                     self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1418.                 else:
  1419.                     self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1420.  
  1421.             ## DragonSoul
  1422.             elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1423.                 self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1424.            
  1425.             mouseModule.mouseController.DeattachObject()
  1426.  
  1427.         else:
  1428.             hyperlink = ui.GetHyperlink()
  1429.             if hyperlink:
  1430.                 if app.IsPressed(app.DIK_LALT):
  1431.                     link = chat.GetLinkFromHyperlink(hyperlink)
  1432.                     ime.PasteString(link)
  1433.                 else:
  1434.                     self.interface.MakeHyperlinkTooltip(hyperlink)
  1435.                 return
  1436.             else:
  1437.                 player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  1438.  
  1439.         #player.EndMouseWalking()
  1440.         return TRUE
  1441.  
  1442.     def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
  1443.         if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1444.             attachedInvenType = player.SlotTypeToInvenType(attachedType)
  1445.             if TRUE == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1446.                 if player.IsEquipmentSlot(attachedItemSlotPos):
  1447.                     self.stream.popupWindow.Close()
  1448.                     self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1449.                 else:
  1450.                     if chr.IsNPC(dstChrID):
  1451.                         net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1452.                     else:
  1453.                         net.SendExchangeStartPacket(dstChrID)
  1454.                         net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1455.             else:
  1456.                 self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1457.  
  1458.     def __PutMoney(self, attachedType, attachedMoney, dstChrID):
  1459.         if TRUE == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1460.             net.SendExchangeStartPacket(dstChrID)
  1461.             net.SendExchangeElkAddPacket(attachedMoney)
  1462.         else:
  1463.             self.__DropMoney(attachedType, attachedMoney)
  1464.  
  1465.     def __DropMoney(self, attachedType, attachedMoney):
  1466.         # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1467.         if uiPrivateShopBuilder.IsBuildingPrivateShop():           
  1468.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1469.             return
  1470.         # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1471.        
  1472.         if attachedMoney>=1000:
  1473.             self.stream.popupWindow.Close()
  1474.             self.stream.popupWindow.Open(localeInfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeInfo.UI_OK)
  1475.             return
  1476.  
  1477.         itemDropQuestionDialog = uiCommon.QuestionDialog()
  1478.         itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_MONEY % (attachedMoney))
  1479.         itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1480.         itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1481.         itemDropQuestionDialog.Open()
  1482.         itemDropQuestionDialog.dropType = attachedType
  1483.         itemDropQuestionDialog.dropCount = attachedMoney
  1484.         itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
  1485.         self.itemDropQuestionDialog = itemDropQuestionDialog
  1486.  
  1487.     def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
  1488.         # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1489.         if uiPrivateShopBuilder.IsBuildingPrivateShop():           
  1490.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1491.             return
  1492.         # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1493.        
  1494.         if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos):
  1495.             self.stream.popupWindow.Close()
  1496.             self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1497.  
  1498.         else:
  1499.             if player.SLOT_TYPE_INVENTORY == attachedType:
  1500.                 dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
  1501.  
  1502.                 item.SelectItem(dropItemIndex)
  1503.                 dropItemName = item.GetItemName()
  1504.  
  1505.                 ## Question Text
  1506.                 questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1507.  
  1508.                 ## Dialog
  1509.                 itemDropQuestionDialog = uiCommon.QuestionDialog()
  1510.                 itemDropQuestionDialog.SetText(questionText)
  1511.                 itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1512.                 itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1513.                 itemDropQuestionDialog.Open()
  1514.                 itemDropQuestionDialog.dropType = attachedType
  1515.                 itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1516.                 itemDropQuestionDialog.dropCount = attachedItemCount
  1517.                 self.itemDropQuestionDialog = itemDropQuestionDialog
  1518.  
  1519.                 constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
  1520.             elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1521.                 dropItemIndex = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, attachedItemSlotPos)
  1522.  
  1523.                 item.SelectItem(dropItemIndex)
  1524.                 dropItemName = item.GetItemName()
  1525.  
  1526.                 ## Question Text
  1527.                 questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1528.  
  1529.                 ## Dialog
  1530.                 itemDropQuestionDialog = uiCommon.QuestionDialog()
  1531.                 itemDropQuestionDialog.SetText(questionText)
  1532.                 itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1533.                 itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1534.                 itemDropQuestionDialog.Open()
  1535.                 itemDropQuestionDialog.dropType = attachedType
  1536.                 itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1537.                 itemDropQuestionDialog.dropCount = attachedItemCount
  1538.                 self.itemDropQuestionDialog = itemDropQuestionDialog
  1539.  
  1540.                 constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
  1541.  
  1542.     def RequestDropItem(self, answer):
  1543.         if not self.itemDropQuestionDialog:
  1544.             return
  1545.  
  1546.         if answer:
  1547.             dropType = self.itemDropQuestionDialog.dropType
  1548.             dropCount = self.itemDropQuestionDialog.dropCount
  1549.             dropNumber = self.itemDropQuestionDialog.dropNumber
  1550.  
  1551.             if player.SLOT_TYPE_INVENTORY == dropType:
  1552.                 if dropNumber == player.ITEM_MONEY:
  1553.                     net.SendGoldDropPacketNew(dropCount)
  1554.                     snd.PlaySound("sound/ui/money.wav")
  1555.                 else:
  1556.                     # PRIVATESHOP_DISABLE_ITEM_DROP
  1557.                     self.__SendDropItemPacket(dropNumber, dropCount)
  1558.                     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1559.             elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == dropType:
  1560.                     # PRIVATESHOP_DISABLE_ITEM_DROP
  1561.                     self.__SendDropItemPacket(dropNumber, dropCount, player.DRAGON_SOUL_INVENTORY)
  1562.                     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1563.  
  1564.         self.itemDropQuestionDialog.Close()
  1565.         self.itemDropQuestionDialog = None
  1566.  
  1567.         constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
  1568.  
  1569.     # PRIVATESHOP_DISABLE_ITEM_DROP
  1570.     def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
  1571.         if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1572.             chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1573.             return
  1574.  
  1575.         net.SendItemDropPacketNew(itemInvenType, itemVNum, itemCount)
  1576.     # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1577.  
  1578.     def OnMouseRightButtonDown(self):
  1579.  
  1580.         self.CheckFocus()
  1581.  
  1582.         if TRUE == mouseModule.mouseController.isAttached():
  1583.             mouseModule.mouseController.DeattachObject()
  1584.  
  1585.         else:
  1586.             player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
  1587.  
  1588.         return TRUE
  1589.  
  1590.     def OnMouseRightButtonUp(self):
  1591.         if TRUE == mouseModule.mouseController.isAttached():
  1592.             return TRUE
  1593.  
  1594.         player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
  1595.         return TRUE
  1596.  
  1597.     def OnMouseMiddleButtonDown(self):
  1598.         player.SetMouseMiddleButtonState(player.MBS_PRESS)
  1599.  
  1600.     def OnMouseMiddleButtonUp(self):
  1601.         player.SetMouseMiddleButtonState(player.MBS_CLICK)
  1602.  
  1603.     def OnUpdate(self):
  1604.         app.UpdateGame()
  1605.         localtime = localtime = time.strftime("%H:%M %d %m %Y")
  1606.         self.timeLine.SetText(localtime)
  1607.         self.timeLine.Show()
  1608.         ##Oyuna girdi##
  1609.         global oyunagirdibeklemesuresi
  1610.         global oyunagirdiglobaltimesuresi
  1611.         global oyunagirdi
  1612.        
  1613.         if oyunagirdi == 1:
  1614.             if app.GetTime() < self.Bekle + 4:
  1615.                 pass
  1616.             else:
  1617.                 self.GirdiButton.Hide()
  1618.                 oyunagirdi = 0
  1619.         else:
  1620.             pass
  1621.             ##Oyuna girdi##
  1622.         if self.mapNameShower.IsShow():
  1623.             self.mapNameShower.Update()
  1624.            
  1625.         if self.isShowDebugInfo:
  1626.             self.UpdateDebugInfo()
  1627.  
  1628.         if self.enableXMasBoom:
  1629.             self.__XMasBoom_Update()
  1630.        
  1631.         if int(int(self.interface.LastContactTimeStamp) + self.interface.WaitTime) < int(app.GetTime()) and self.interface.State == "Kapali":
  1632.             self.interface.State = "Acik"
  1633.            
  1634.         if 1 == constInfo.AUTO_PICK_UP:
  1635.             self.PickUpItem()
  1636.            
  1637.         self.interface.BUILD_OnUpdate()
  1638.                    
  1639.     def UpdateDebugInfo(self):
  1640.         #
  1641.         # 캐릭터 좌표 및 FPS 출력
  1642.         (x, y, z) = player.GetMainCharacterPosition()
  1643.         nUpdateTime = app.GetUpdateTime()
  1644.         nUpdateFPS = app.GetUpdateFPS()
  1645.         nRenderFPS = app.GetRenderFPS()
  1646.         nFaceCount = app.GetFaceCount()
  1647.         fFaceSpeed = app.GetFaceSpeed()
  1648.         nST=background.GetRenderShadowTime()
  1649.         (fAveRT, nCurRT) =  app.GetRenderTime()
  1650.         (iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
  1651.         (iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
  1652.         if iPatch == 0:
  1653.             iPatch = 1
  1654.  
  1655.         #(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
  1656.  
  1657.         self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
  1658.         xMouse, yMouse = wndMgr.GetMousePosition()
  1659.         self.PrintMousePos.SetText("MousePosition: %d %d" % (xMouse, yMouse))          
  1660.  
  1661.         self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
  1662.  
  1663.         if fAveRT>1.0:
  1664.             self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
  1665.  
  1666.         self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
  1667.         #self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
  1668.         #self.TextureNum.SetText("TN : %s" % (sTextureNum))
  1669.         #self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
  1670.         self.ViewDistance.SetText("Num : %d, FS : %f, FE : %f, FC : %f" % (iNum, fFogStart, fFogEnd, fFarCilp))
  1671.  
  1672.     def OnRender(self):
  1673.         app.RenderGame()
  1674.        
  1675.         if self.console.Console.collision:
  1676.             background.RenderCollision()
  1677.             chr.RenderCollision()
  1678.  
  1679.         (x, y) = app.GetCursorPosition()
  1680.  
  1681.         ########################
  1682.         # Picking
  1683.         ########################
  1684.         textTail.UpdateAllTextTail()
  1685.  
  1686.         if TRUE == wndMgr.IsPickedWindow(self.hWnd):
  1687.  
  1688.             self.PickingCharacterIndex = chr.Pick()
  1689.  
  1690.             if -1 != self.PickingCharacterIndex:
  1691.                 textTail.ShowCharacterTextTail(self.PickingCharacterIndex)
  1692.             if 0 != self.targetBoard.GetTargetVID():
  1693.                 textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())
  1694.  
  1695.             # ADD_ALWAYS_SHOW_NAME
  1696.             if not self.__IsShowName():
  1697.                 self.PickingItemIndex = item.Pick()
  1698.                 if -1 != self.PickingItemIndex:
  1699.                     textTail.ShowItemTextTail(self.PickingItemIndex)
  1700.             # END_OF_ADD_ALWAYS_SHOW_NAME
  1701.            
  1702.         ## Show all name in the range
  1703.        
  1704.         # ADD_ALWAYS_SHOW_NAME
  1705.         if self.__IsShowName():
  1706.             textTail.ShowAllTextTail()
  1707.             self.PickingItemIndex = textTail.Pick(x, y)
  1708.         # END_OF_ADD_ALWAYS_SHOW_NAME
  1709.  
  1710.         textTail.UpdateShowingTextTail()
  1711.         textTail.ArrangeTextTail()
  1712.         if -1 != self.PickingItemIndex:
  1713.             textTail.SelectItemName(self.PickingItemIndex)
  1714.  
  1715.         grp.PopState()
  1716.         grp.SetInterfaceRenderState()
  1717.  
  1718.         textTail.Render()
  1719.         textTail.HideAllTextTail()
  1720.  
  1721.     def OnPressEscapeKey(self):
  1722.         if app.TARGET == app.GetCursor():
  1723.             app.SetCursor(app.NORMAL)
  1724.  
  1725.         elif TRUE == mouseModule.mouseController.isAttached():
  1726.             mouseModule.mouseController.DeattachObject()
  1727.  
  1728.         else:
  1729.             self.interface.OpenSystemDialog()
  1730.  
  1731.         return TRUE
  1732.  
  1733.     def OnIMEReturn(self):
  1734.         if app.IsPressed(app.DIK_LSHIFT):
  1735.             self.interface.OpenWhisperDialogWithoutTarget()
  1736.         else:
  1737.             self.interface.ToggleChat()
  1738.         return TRUE
  1739.  
  1740.     def OnPressExitKey(self):
  1741.         self.interface.ToggleSystemDialog()
  1742.         return TRUE
  1743.  
  1744.     ## BINARY CALLBACK
  1745.     ######################################################################################
  1746.    
  1747.     # WEDDING
  1748.     def BINARY_LoverInfo(self, name, lovePoint):
  1749.         if self.interface.wndMessenger:
  1750.             self.interface.wndMessenger.OnAddLover(name, lovePoint)
  1751.         if self.affectShower:
  1752.             self.affectShower.SetLoverInfo(name, lovePoint)
  1753.  
  1754.     def BINARY_UpdateLovePoint(self, lovePoint):
  1755.         if self.interface.wndMessenger:
  1756.             self.interface.wndMessenger.OnUpdateLovePoint(lovePoint)
  1757.         if self.affectShower:
  1758.             self.affectShower.OnUpdateLovePoint(lovePoint)
  1759.     # END_OF_WEDDING
  1760.    
  1761.     # QUEST_CONFIRM
  1762.     def BINARY_OnQuestConfirm(self, msg, timeout, pid):
  1763.         confirmDialog = uiCommon.QuestionDialogWithTimeLimit()
  1764.         confirmDialog.Open(msg, timeout)
  1765.         confirmDialog.SetAcceptEvent(lambda answer=TRUE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1766.         confirmDialog.SetCancelEvent(lambda answer=FALSE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1767.         self.confirmDialog = confirmDialog
  1768.     # END_OF_QUEST_CONFIRM
  1769.  
  1770.     # GIFT command
  1771.     def Gift_Show(self):
  1772.         self.interface.ShowGift()
  1773.  
  1774.     # CUBE
  1775.     def BINARY_Cube_Open(self, npcVNUM):
  1776.         self.currentCubeNPC = npcVNUM
  1777.        
  1778.         self.interface.OpenCubeWindow()
  1779.  
  1780.        
  1781.         if npcVNUM not in self.cubeInformation:
  1782.             net.SendChatPacket("/cube r_info")
  1783.         else:
  1784.             cubeInfoList = self.cubeInformation[npcVNUM]
  1785.            
  1786.             i = 0
  1787.             for cubeInfo in cubeInfoList:                              
  1788.                 self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"])
  1789.                
  1790.                 j = 0              
  1791.                 for materialList in cubeInfo["materialList"]:
  1792.                     for materialInfo in materialList:
  1793.                         itemVnum, itemCount = materialInfo
  1794.                         self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount)
  1795.                     j = j + 1                      
  1796.                        
  1797.                 i = i + 1
  1798.                
  1799.             self.interface.wndCube.Refresh()
  1800.  
  1801.     def BINARY_Cube_Close(self):
  1802.         self.interface.CloseCubeWindow()
  1803.  
  1804.     # 제작에 필요한 골드, 예상되는 완성품의 VNUM과 개수 정보 update
  1805.     def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count):
  1806.         self.interface.UpdateCubeInfo(gold, itemVnum, count)
  1807.        
  1808.     def BINARY_Cube_Succeed(self, itemVnum, count):
  1809.         print "큐브 제작 성공"
  1810.         self.interface.SucceedCubeWork(itemVnum, count)
  1811.         pass
  1812.  
  1813.     def BINARY_Cube_Failed(self):
  1814.         print "큐브 제작 실패"
  1815.         self.interface.FailedCubeWork()
  1816.         pass
  1817.  
  1818.     def BINARY_Cube_ResultList(self, npcVNUM, listText):
  1819.         # ResultList Text Format : 72723,1/72725,1/72730.1/50001,5  이런식으로 "/" 문자로 구분된 리스트를 줌
  1820.         #print listText
  1821.        
  1822.         if npcVNUM == 0:
  1823.             npcVNUM = self.currentCubeNPC
  1824.        
  1825.         self.cubeInformation[npcVNUM] = []
  1826.        
  1827.         try:
  1828.             for eachInfoText in listText.split("/"):
  1829.                 eachInfo = eachInfoText.split(",")
  1830.                 itemVnum    = int(eachInfo[0])
  1831.                 itemCount   = int(eachInfo[1])
  1832.  
  1833.                 self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount})
  1834.                 self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount)
  1835.            
  1836.             resultCount = len(self.cubeInformation[npcVNUM])
  1837.             requestCount = 7
  1838.             modCount = resultCount % requestCount
  1839.             splitCount = resultCount / requestCount
  1840.             for i in xrange(splitCount):
  1841.                 #print("/cube r_info %d %d" % (i * requestCount, requestCount))
  1842.                 net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
  1843.                
  1844.             if 0 < modCount:
  1845.                 #print("/cube r_info %d %d" % (splitCount * requestCount, modCount))               
  1846.                 net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1847.  
  1848.         except RuntimeError, msg:
  1849.             dbg.TraceError(msg)
  1850.             return 0
  1851.            
  1852.         pass
  1853.        
  1854.     def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText):
  1855.         # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000
  1856.         try:
  1857.             #print listText
  1858.            
  1859.             if 3 > len(listText):
  1860.                 dbg.TraceError("Wrong Cube Material Infomation")
  1861.                 return 0
  1862.  
  1863.            
  1864.            
  1865.             eachResultList = listText.split("@")
  1866.  
  1867.             cubeInfo = self.cubeInformation[self.currentCubeNPC]           
  1868.            
  1869.             itemIndex = 0
  1870.             for eachResultText in eachResultList:
  1871.                 cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []]
  1872.                 materialList = cubeInfo[startIndex + itemIndex]["materialList"]
  1873.                
  1874.                 gold = 0
  1875.                 splitResult = eachResultText.split("/")
  1876.                 if 1 < len(splitResult):
  1877.                     gold = int(splitResult[1])
  1878.                    
  1879.                 #print "splitResult : ", splitResult
  1880.                 eachMaterialList = splitResult[0].split("&")
  1881.                
  1882.                 i = 0
  1883.                 for eachMaterialText in eachMaterialList:
  1884.                     complicatedList = eachMaterialText.split("|")
  1885.                    
  1886.                     if 0 < len(complicatedList):
  1887.                         for complicatedText in complicatedList:
  1888.                             (itemVnum, itemCount) = complicatedText.split(",")
  1889.                             itemVnum = int(itemVnum)
  1890.                             itemCount = int(itemCount)
  1891.                             self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1892.                            
  1893.                             materialList[i].append((itemVnum, itemCount))
  1894.                            
  1895.                     else:
  1896.                         itemVnum, itemCount = eachMaterialText.split(",")
  1897.                         itemVnum = int(itemVnum)
  1898.                         itemCount = int(itemCount)
  1899.                         self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1900.                        
  1901.                         materialList[i].append((itemVnum, itemCount))
  1902.                        
  1903.                     i = i + 1
  1904.                    
  1905.                    
  1906.                    
  1907.                 itemIndex = itemIndex + 1
  1908.                
  1909.             self.interface.wndCube.Refresh()
  1910.            
  1911.                
  1912.         except RuntimeError, msg:
  1913.             dbg.TraceError(msg)
  1914.             return 0
  1915.            
  1916.         pass
  1917.    
  1918.     # END_OF_CUBE
  1919.    
  1920.     # 용혼석
  1921.     def BINARY_Highlight_Item(self, inven_type, inven_pos):
  1922.         self.interface.Highligt_Item(inven_type, inven_pos)
  1923.    
  1924.     def BINARY_DragonSoulGiveQuilification(self):
  1925.         self.interface.DragonSoulGiveQuilification()
  1926.        
  1927.     def BINARY_DragonSoulRefineWindow_Open(self):
  1928.         self.interface.OpenDragonSoulRefineWindow()
  1929.  
  1930.     def BINARY_DragonSoulRefineWindow_RefineFail(self, reason, inven_type, inven_pos):
  1931.         self.interface.FailDragonSoulRefine(reason, inven_type, inven_pos)
  1932.  
  1933.     def BINARY_DragonSoulRefineWindow_RefineSucceed(self, inven_type, inven_pos):
  1934.         self.interface.SucceedDragonSoulRefine(inven_type, inven_pos)
  1935.    
  1936.     # END of DRAGON SOUL REFINE WINDOW
  1937.    
  1938.     def BINARY_SetBigMessage(self, message):
  1939.         self.interface.bigBoard.SetTip(message)
  1940.  
  1941.     def BINARY_SetTipMessage(self, message):
  1942.         self.interface.tipBoard.SetTip(message)    
  1943.  
  1944.     def BINARY_AppendNotifyMessage(self, type):
  1945.         if not type in localeInfo.NOTIFY_MESSAGE:
  1946.             return
  1947.         chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.NOTIFY_MESSAGE[type])
  1948.  
  1949.     def BINARY_Guild_EnterGuildArea(self, areaID):
  1950.         self.interface.BULID_EnterGuildArea(areaID)
  1951.  
  1952.     def BINARY_Guild_ExitGuildArea(self, areaID):
  1953.         self.interface.BULID_ExitGuildArea(areaID)
  1954.  
  1955.     def BINARY_GuildWar_OnSendDeclare(self, guildID):
  1956.         pass
  1957.  
  1958.     def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
  1959.         mainCharacterName = player.GetMainCharacterName()
  1960.         masterName = guild.GetGuildMasterName()
  1961.         if mainCharacterName == masterName:
  1962.             self.__GuildWar_OpenAskDialog(guildID, warType)
  1963.  
  1964.     def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
  1965.         self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
  1966.  
  1967.     def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
  1968.         self.interface.OnStartGuildWar(guildSelf, guildOpp)
  1969.  
  1970.     def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
  1971.         self.interface.OnEndGuildWar(guildSelf, guildOpp)
  1972.  
  1973.     def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
  1974.         self.interface.BINARY_SetObserverMode(isEnable)
  1975.  
  1976.     def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
  1977.         self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1978.  
  1979.     def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
  1980.         guildID1 = int(guildID1)
  1981.         guildID2 = int(guildID2)
  1982.         memberCount1 = int(memberCount1)
  1983.         memberCount2 = int(memberCount2)
  1984.         observerCount = int(observerCount)
  1985.  
  1986.         self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
  1987.         self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1988.  
  1989.     def __GuildWar_OpenAskDialog(self, guildID, warType):
  1990.  
  1991.         guildName = guild.GetGuildName(guildID)
  1992.  
  1993.         # REMOVED_GUILD_BUG_FIX
  1994.         if "Noname" == guildName:
  1995.             return
  1996.         # END_OF_REMOVED_GUILD_BUG_FIX
  1997.  
  1998.         import uiGuild
  1999.         questionDialog = uiGuild.AcceptGuildWarDialog()
  2000.         questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept)
  2001.         questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline)
  2002.         questionDialog.Open(guildName, warType)
  2003.  
  2004.         self.guildWarQuestionDialog = questionDialog
  2005.  
  2006.     def __GuildWar_CloseAskDialog(self):
  2007.         self.guildWarQuestionDialog.Close()
  2008.         self.guildWarQuestionDialog = None
  2009.  
  2010.     def __GuildWar_OnAccept(self):
  2011.  
  2012.         guildName = self.guildWarQuestionDialog.GetGuildName()
  2013.  
  2014.         net.SendChatPacket("/war " + guildName)
  2015.         self.__GuildWar_CloseAskDialog()
  2016.  
  2017.         return 1
  2018.  
  2019.     def __GuildWar_OnDecline(self):
  2020.  
  2021.         guildName = self.guildWarQuestionDialog.GetGuildName()
  2022.  
  2023.         net.SendChatPacket("/nowar " + guildName)
  2024.         self.__GuildWar_CloseAskDialog()
  2025.  
  2026.         return 1
  2027.     ## BINARY CALLBACK
  2028.     ######################################################################################
  2029.  
  2030.     def __ServerCommand_Build(self):
  2031.         serverCommandList={
  2032.             "ConsoleEnable"         : self.__Console_Enable,
  2033.             "DayMode"               : self.__DayMode_Update,
  2034.             "PRESERVE_DayMode"      : self.__PRESERVE_DayMode_Update,
  2035.             "CloseRestartWindow"    : self.__RestartDialog_Close,
  2036.             "OpenPrivateShop"       : self.__PrivateShop_Open,
  2037.             "PartyHealReady"        : self.PartyHealReady,
  2038.             "ShowMeSafeboxPassword" : self.AskSafeboxPassword,
  2039.             "CloseSafebox"          : self.CommandCloseSafebox,
  2040.            
  2041.             "PythonToLua"           : self.__PythonToLua, # .python to Quest
  2042.             "PythonIslem"           : self.__PythonIslem, # .python to Quest
  2043.             "LuaToPython"           : self.__LuaToPython, # Quest to .python
  2044.            
  2045.             # Cevır Kazan Ba?la
  2046.             "STONEWHEEL"                : self.__StoneWheel,
  2047.             "STONEWHEEL_OPEN"               : self.__StoneWheelOpen,
  2048.             # Cevır Kazan Bıt
  2049.            
  2050.             # ITEM_MALL
  2051.             "CloseMall"             : self.CommandCloseMall,
  2052.             "ShowMeMallPassword"    : self.AskMallPassword,
  2053.             "item_mall"             : self.__ItemMall_Open,
  2054.             # END_OF_ITEM_MALL         
  2055.            
  2056.             #Lonca Deposu
  2057.             "GUILDSTORAGE"          : self._GuildStorageCMD,
  2058.             "GUILDSTORAGE_ADDITEM"  : self._GuildStorageAddItem,
  2059.             "GUILDSTORAGE_ADDITEMSLOT" : self._GuildStorageAddItemSlot,
  2060.             "GUILDSTORAGE_ADDMEMBER" : self._GuildStorageAddMemberToList,
  2061.             "GUILDSTORAGE_ADDTEMPSLOT" : self._GuildStorageTempSlotsAdd,
  2062.             "GUILDSTORAGE_ADDLOG"       : self._GuildStorageAddLog,
  2063.             "getinputbegin"         : self.__Inputget1,
  2064.             "getinputend"           : self.__Inputget2,
  2065.             ####
  2066.  
  2067.             "RefineSuceeded"        : self.RefineSuceededMessage,
  2068.             "RefineFailed"          : self.RefineFailedMessage,
  2069.             "xmas_snow"             : self.__XMasSnow_Enable,
  2070.             "xmas_boom"             : self.__XMasBoom_Enable,
  2071.             "xmas_song"             : self.__XMasSong_Enable,
  2072.             "xmas_tree"             : self.__XMasTree_Enable,
  2073.             "newyear_boom"          : self.__XMasBoom_Enable,
  2074.             "PartyRequest"          : self.__PartyRequestQuestion,
  2075.             "PartyRequestDenied"    : self.__PartyRequestDenied,
  2076.             "horse_state"           : self.__Horse_UpdateState,
  2077.             "hide_horse_state"      : self.__Horse_HideState,
  2078.             "WarUC"                 : self.__GuildWar_UpdateMemberCount,
  2079.             "test_server"           : self.__EnableTestServerFlag,
  2080.             "mall"          : self.__InGameShop_Show,
  2081.             "horse_button" : self.__Horse_button,      
  2082.            
  2083.             # WEDDING
  2084.             "lover_login"           : self.__LoginLover,
  2085.             "lover_logout"          : self.__LogoutLover,
  2086.             "lover_near"            : self.__LoverNear,
  2087.             "lover_far"             : self.__LoverFar,
  2088.             "lover_divorce"         : self.__LoverDivorce,
  2089.             "PlayMusic"             : self.__PlayMusic,
  2090.             # END_OF_WEDDING
  2091.  
  2092.             ##
  2093.             "ItemSil_Index"         : self.__ReceiveItemSilIndex,
  2094.             "get_item_value"        : self.__GetItemValue,
  2095.             "InputStringStart"        : self.ItemSilInputOn,
  2096.             "InputStringEnd"        : self.ItemSilGetInputOff,
  2097.  
  2098.             # PRIVATE_SHOP_PRICE_LIST
  2099.             "MyShopPriceList"       : self.__PrivateShop_PriceList,
  2100.             # END_OF_PRIVATE_SHOP_PRICE_LIST
  2101.  
  2102.         }
  2103.  
  2104.         self.serverCommander=stringCommander.Analyzer()
  2105.         for serverCommandItem in serverCommandList.items():
  2106.             self.serverCommander.SAFE_RegisterCallBack(
  2107.                 serverCommandItem[0], serverCommandItem[1]
  2108.             )
  2109.            
  2110.     def __ReceiveItemSilIndex(self, index):
  2111.         constInfo.ItemSil_Index = int(index)
  2112.        
  2113.     def __GetItemValue(self):
  2114.         net.SendQuestInputStringPacket(str(constInfo.ItemSil_Slot))
  2115.    
  2116.     def ItemSilInputOn(self):
  2117.         constInfo.INPUT_IGNORE = 1
  2118.        
  2119.     def ItemSilGetInputOff(self):
  2120.         constInfo.INPUT_IGNORE = 0
  2121.  
  2122.     def BINARY_ServerCommand_Run(self, line):
  2123.         #dbg.TraceError(line)
  2124.         try:
  2125.             #print " BINARY_ServerCommand_Run", line
  2126.             return self.serverCommander.Run(line)
  2127.         except RuntimeError, msg:
  2128.             dbg.TraceError(msg)
  2129.             return 0
  2130.  
  2131.     def __ProcessPreservedServerCommand(self):
  2132.         try:
  2133.             command = net.GetPreservedServerCommand()
  2134.             while command:
  2135.                 print " __ProcessPreservedServerCommand", command
  2136.                 self.serverCommander.Run(command)
  2137.                 command = net.GetPreservedServerCommand()
  2138.         except RuntimeError, msg:
  2139.             dbg.TraceError(msg)
  2140.             return 0
  2141.  
  2142.     def PartyHealReady(self):
  2143.         self.interface.PartyHealReady()
  2144.  
  2145.     def AskSafeboxPassword(self):
  2146.         self.interface.AskSafeboxPassword()
  2147.  
  2148.     # ITEM_MALL
  2149.     def AskMallPassword(self):
  2150.         self.interface.AskMallPassword()
  2151.  
  2152.     def __ItemMall_Open(self):
  2153.         self.interface.OpenItemMall();
  2154.  
  2155.     def CommandCloseMall(self):
  2156.         self.interface.CommandCloseMall()
  2157.     # END_OF_ITEM_MALL
  2158.  
  2159.     def RefineSuceededMessage(self):
  2160.         snd.PlaySound("sound/ui/make_soket.wav")
  2161.         net.SendChatPacket("(xVectors_Basari)")
  2162.  
  2163.     def RefineFailedMessage(self):
  2164.         snd.PlaySound("sound/ui/jaeryun_fail.wav")
  2165.         net.SendChatPacket("(xVectors_Basarisiz)")
  2166.  
  2167.     def CommandCloseSafebox(self):
  2168.         self.interface.CommandCloseSafebox()
  2169.  
  2170.     # PRIVATE_SHOP_PRICE_LIST
  2171.     def __PrivateShop_PriceList(self, itemVNum, itemPrice):
  2172.         uiPrivateShopBuilder.SetPrivateShopItemPrice(itemVNum, itemPrice)  
  2173.     # END_OF_PRIVATE_SHOP_PRICE_LIST
  2174.  
  2175.     def __Horse_HideState(self):
  2176.         self.affectShower.SetHorseState(0, 0, 0)
  2177.  
  2178.     def __Horse_UpdateState(self, level, health, battery):
  2179.         self.affectShower.SetHorseState(int(level), int(health), int(battery))
  2180.  
  2181.     def __IsXMasMap(self):
  2182.         mapDict = ( "metin2_map_n_flame_01",
  2183.                     "metin2_map_n_desert_01",
  2184.                     "metin2_map_spiderdungeon",
  2185.                     "metin2_map_deviltower1", )
  2186.  
  2187.         if background.GetCurrentMapName() in mapDict:
  2188.             return FALSE
  2189.  
  2190.         return TRUE
  2191.  
  2192.     def __XMasSnow_Enable(self, mode):
  2193.  
  2194.         self.__XMasSong_Enable(mode)
  2195.  
  2196.         if "1"==mode:
  2197.  
  2198.             if not self.__IsXMasMap():
  2199.                 return
  2200.  
  2201.             print "XMAS_SNOW ON"
  2202.             background.EnableSnow(1)
  2203.  
  2204.         else:
  2205.             print "XMAS_SNOW OFF"
  2206.             background.EnableSnow(0)
  2207.  
  2208.     def __XMasBoom_Enable(self, mode):
  2209.         if "1"==mode:
  2210.  
  2211.             if not self.__IsXMasMap():
  2212.                 return
  2213.  
  2214.             print "XMAS_BOOM ON"
  2215.             self.__DayMode_Update("dark")
  2216.             self.enableXMasBoom = TRUE
  2217.             self.startTimeXMasBoom = app.GetTime()
  2218.         else:
  2219.             print "XMAS_BOOM OFF"
  2220.             self.__DayMode_Update("light")
  2221.             self.enableXMasBoom = FALSE
  2222.  
  2223.     def __XMasTree_Enable(self, grade):
  2224.  
  2225.         print "XMAS_TREE ", grade
  2226.         background.SetXMasTree(int(grade))
  2227.  
  2228.     def __XMasSong_Enable(self, mode):
  2229.         if "1"==mode:
  2230.             print "XMAS_SONG ON"
  2231.  
  2232.             XMAS_BGM = "xmas.mp3"
  2233.  
  2234.             if app.IsExistFile("BGM/" + XMAS_BGM)==1:
  2235.                 if musicInfo.fieldMusic != "":
  2236.                     snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2237.  
  2238.                 musicInfo.fieldMusic=XMAS_BGM
  2239.                 snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2240.  
  2241.         else:
  2242.             print "XMAS_SONG OFF"
  2243.  
  2244.             if musicInfo.fieldMusic != "":
  2245.                 snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2246.  
  2247.             musicInfo.fieldMusic=musicInfo.METIN2THEMA
  2248.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2249.  
  2250.     def __RestartDialog_Close(self):
  2251.         self.interface.CloseRestartDialog()
  2252.  
  2253.     def __Console_Enable(self):
  2254.         constInfo.CONSOLE_ENABLE = TRUE
  2255.         self.consoleEnable = TRUE
  2256.         app.EnableSpecialCameraMode()
  2257.         ui.EnablePaste(TRUE)
  2258.  
  2259.     ## PrivateShop
  2260.     def __PrivateShop_Open(self):
  2261.         self.interface.OpenPrivateShopInputNameDialog()
  2262.  
  2263.     def BINARY_PrivateShop_Appear(self, vid, text):
  2264.         self.interface.AppearPrivateShop(vid, text)
  2265.  
  2266.     def BINARY_PrivateShop_Disappear(self, vid):
  2267.         self.interface.DisappearPrivateShop(vid)
  2268.  
  2269.     ## DayMode
  2270.     def __PRESERVE_DayMode_Update(self, mode):
  2271.         if "light"==mode:
  2272.             background.SetEnvironmentData(0)
  2273.         elif "dark"==mode:
  2274.  
  2275.             if not self.__IsXMasMap():
  2276.                 return
  2277.  
  2278.             background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2279.             background.SetEnvironmentData(1)
  2280.  
  2281.     def __DayMode_Update(self, mode):
  2282.         if "light"==mode:
  2283.             self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
  2284.         elif "dark"==mode:
  2285.  
  2286.             if not self.__IsXMasMap():
  2287.                 return
  2288.  
  2289.             self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
  2290.  
  2291.     def __DayMode_OnCompleteChangeToLight(self):
  2292.         background.SetEnvironmentData(0)
  2293.         self.curtain.FadeIn()
  2294.  
  2295.     def __DayMode_OnCompleteChangeToDark(self):
  2296.         background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2297.         background.SetEnvironmentData(1)
  2298.         self.curtain.FadeIn()
  2299.  
  2300.     ## XMasBoom
  2301.     def __XMasBoom_Update(self):
  2302.  
  2303.         self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
  2304.         if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
  2305.             return
  2306.  
  2307.         boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
  2308.         boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
  2309.  
  2310.         if app.GetTime() - self.startTimeXMasBoom > boomTime:
  2311.  
  2312.             self.indexXMasBoom += 1
  2313.  
  2314.             for i in xrange(boomCount):
  2315.                 self.__XMasBoom_Boom()
  2316.  
  2317.     def __XMasBoom_Boom(self):
  2318.         x, y, z = player.GetMainCharacterPosition()
  2319.         randX = app.GetRandom(-150, 150)
  2320.         randY = app.GetRandom(-150, 150)
  2321.  
  2322.         snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
  2323.  
  2324.     def __PartyRequestQuestion(self, vid):
  2325.         vid = int(vid)
  2326.         partyRequestQuestionDialog = uiCommon.QuestionDialog()
  2327.         partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + localeInfo.PARTY_DO_YOU_ACCEPT)
  2328.         partyRequestQuestionDialog.SetAcceptText(localeInfo.UI_ACCEPT)
  2329.         partyRequestQuestionDialog.SetCancelText(localeInfo.UI_DENY)
  2330.         partyRequestQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.__AnswerPartyRequest(arg))
  2331.         partyRequestQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.__AnswerPartyRequest(arg))
  2332.         partyRequestQuestionDialog.Open()
  2333.         partyRequestQuestionDialog.vid = vid
  2334.         self.partyRequestQuestionDialog = partyRequestQuestionDialog
  2335.  
  2336.     def __AnswerPartyRequest(self, answer):
  2337.         if not self.partyRequestQuestionDialog:
  2338.             return
  2339.  
  2340.         vid = self.partyRequestQuestionDialog.vid
  2341.  
  2342.         if answer:
  2343.             net.SendChatPacket("/party_request_accept " + str(vid))
  2344.         else:
  2345.             net.SendChatPacket("/party_request_deny " + str(vid))
  2346.  
  2347.         self.partyRequestQuestionDialog.Close()
  2348.         self.partyRequestQuestionDialog = None
  2349.  
  2350.     def __PartyRequestDenied(self):
  2351.         self.PopupMessage(localeInfo.PARTY_REQUEST_DENIED)
  2352.  
  2353.     def __EnableTestServerFlag(self):
  2354.         app.EnableTestServerFlag()
  2355.  
  2356.     def __InGameShop_Show(self, url):
  2357.         if constInfo.IN_GAME_SHOP_ENABLE:
  2358.             self.interface.OpenWebWindow(url)
  2359.            
  2360.     def __ArayuzManager(self):
  2361.         if constInfo.arayuzkoray == 0:
  2362.             self.interface.HideAllWindows()
  2363.             chat.AppendChat(chat.CHAT_TYPE_INFO, "Arayuz Kapatildi.")
  2364.             constInfo.arayuzkoray = 1
  2365.         elif constInfo.arayuzkoray == 1:
  2366.             self.interface.wndTaskBar.Show()
  2367.             self.interface.wndChat.Show()
  2368.             self.interface.wndMiniMap.Show()
  2369.             try: self.interface.wndEnergyBar.Show()
  2370.             except: pass
  2371.             chat.AppendChat(chat.CHAT_TYPE_INFO, "Arayuz tekrar aktif.")
  2372.             constInfo.arayuzkoray = 0
  2373.  
  2374.     # WEDDING
  2375.     def __LoginLover(self):
  2376.         if self.interface.wndMessenger:
  2377.             self.interface.wndMessenger.OnLoginLover()
  2378.  
  2379.     def __LogoutLover(self):
  2380.         if self.interface.wndMessenger:
  2381.             self.interface.wndMessenger.OnLogoutLover()
  2382.         if self.affectShower:
  2383.             self.affectShower.HideLoverState()
  2384.  
  2385.     def __LoverNear(self):
  2386.         if self.affectShower:
  2387.             self.affectShower.ShowLoverState()
  2388.  
  2389.     def __LoverFar(self):
  2390.         if self.affectShower:
  2391.             self.affectShower.HideLoverState()
  2392.  
  2393.     def __LoverDivorce(self):
  2394.         if self.interface.wndMessenger:
  2395.             self.interface.wndMessenger.ClearLoverInfo()
  2396.         if self.affectShower:
  2397.             self.affectShower.ClearLoverState()
  2398.  
  2399.     def __PlayMusic(self, flag, filename):
  2400.         flag = int(flag)
  2401.         if flag:
  2402.             snd.FadeOutAllMusic()
  2403.             musicInfo.SaveLastPlayFieldMusic()
  2404.             snd.FadeInMusic("BGM/" + filename)
  2405.         else:
  2406.             snd.FadeOutAllMusic()
  2407.             musicInfo.LoadLastPlayFieldMusic()
  2408.             snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2409.            
  2410.     def __Horse_button(self, qid):
  2411.         constInfo.LOAD_QUEST_HORSE_BUTTON = int(qid)
  2412.  
  2413.     # END_OF_WEDDING
  2414.  
  2415.     def OpenQuestWindow(self, skin, idx):
  2416.         if constInfo.INPUT_IGNORE == 1:
  2417.             return
  2418.         elif constInfo.INPUT == 1:
  2419.             return
  2420.         else:
  2421.             self.interface.OpenQuestWindow(skin, idx)
  2422.    
  2423.     def VectorsSwitchbot(self):
  2424.         if self.switchbot.Vectors_bot_shown == 1:
  2425.             self.switchbot.Hide()  
  2426.         else:
  2427.             self.switchbot.Show()
  2428.                    
  2429.     def _VectorsHzl(self):
  2430.             import uiVectorsHzl
  2431.             self.VectorsHzl = uiVectorsHzl.VectorsKSK()
  2432.             self.VectorsHzl.Show()     
  2433.            
  2434.     def _GuildStorageCMD(self, command):
  2435.         cmd = command.split("/")
  2436.        
  2437.         if cmd[0] == "OPEN":
  2438.             self.interface.GuildStorageWindow.Open(int(cmd[1]))
  2439.         elif cmd[0] == "REFRESH":
  2440.             self.interface.GuildStorageWindow.RefreshSlots()
  2441.         elif cmd[0] == "REFRESH_MONEY":
  2442.             self.interface.GuildStorageWindow.SetMoney(cmd[1])
  2443.         elif cmd[0] == "REFRESH_MEMBERS":
  2444.             self.interface.GuildStorageWindow.Adminpanel["board"].RefreshMembers()
  2445.         elif cmd[0] == "CLEAR_TEMPSLOTS":
  2446.             constInfo.GUILDSTORAGE["tempslots"] = {"TAB0" : {},"TAB1" : {},"TAB2" : {}}
  2447.         elif cmd[0] == "COMPARE_TEMPSLOTS":
  2448.             for i in range(3):
  2449.                 if constInfo.GUILDSTORAGE["tempslots"]["TAB"+str(i)] != constInfo.GUILDSTORAGE["slots"]["TAB"+str(i)]:
  2450.                     constInfo.GUILDSTORAGE["slots"]["TAB"+str(i)] = {}
  2451.                     constInfo.GUILDSTORAGE["slots"]["TAB"+str(i)] = constInfo.GUILDSTORAGE["tempslots"]["TAB"+str(i)]
  2452.                     self.interface.GuildStorageWindow.RefreshSlots()
  2453.         elif cmd[0] == "QID":
  2454.             self.GuildStorageQID(cmd[1])
  2455.         elif cmd[0] == "QUESTCMD":
  2456.             self._GuildStorageQuestCMD()
  2457.         elif cmd[0] == "MEMBER_COMPLETE":
  2458.             constInfo.GUILDSTORAGE["members"] = {}
  2459.             self.interface.GuildStorageWindow.ClearMembers()
  2460.             import event
  2461.             constInfo.GUILDSTORAGE["questCMD"] = "GETMEMBERLIST"
  2462.             event.QuestButtonClick(int(constInfo.GUILDSTORAGE["qid"]))
  2463.                
  2464.     def _GuildStorageAddItemSlot(self, slot, tab ,itemVnum, count, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0,attrvalue0, attrtype1,attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6):
  2465.         self.interface.GuildStorageWindow.AddItemSlot(slot, tab ,itemVnum, count, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0,attrvalue0, attrtype1,attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6)
  2466.    
  2467.     def _GuildStorageAddItem(self, slot ,itemVnum, count, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0,attrvalue0, attrtype1,attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6):
  2468.         slotsWidth = 15
  2469.         slotsHeight = 8
  2470.         slot = int(slot)
  2471.         if slot <= 120:
  2472.             constInfo.GUILDSTORAGE["slots"]["TAB0"][slot] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2473.         elif slot > 120 and slot <= 240:
  2474.             constInfo.GUILDSTORAGE["slots"]["TAB1"][slot-120] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2475.         elif slot > 240 and slot <= 360:
  2476.             constInfo.GUILDSTORAGE["slots"]["TAB2"][slot-240] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2477.    
  2478.     def _GuildStorageTempSlotsAdd(self,slot ,itemVnum, count, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0,attrvalue0, attrtype1,attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6):
  2479.         slot = int(slot)
  2480.         if slot <= 120:
  2481.             constInfo.GUILDSTORAGE["tempslots"]["TAB0"][slot] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2482.         elif slot > 120 and slot <= 240:
  2483.             constInfo.GUILDSTORAGE["tempslots"]["TAB1"][slot-120] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2484.         elif slot > 240 and slot <= 360:
  2485.             constInfo.GUILDSTORAGE["tempslots"]["TAB2"][slot-240] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  2486.        
  2487.     def _GuildStorageAddLog(self,id,name,date,type,do,desc):
  2488.         self.interface.GuildStorageWindow.LogsInsert(id,name,date,type,do,desc)
  2489.         constInfo.GUILDSTORAGE["logs"][int(id)] = [name,date,type,do,desc]
  2490.        
  2491.     def _GuildStorageQuestCMD(self):
  2492.         net.SendQuestInputStringPacket(str(constInfo.GUILDSTORAGE["questCMD"]))
  2493.         constInfo.GUILDSTORAGE["questCMD"] = "NULL#"
  2494.    
  2495.     def GuildStorageQID(self, qid):
  2496.         constInfo.GUILDSTORAGE["qid"] = int(qid)
  2497.        
  2498.     def _GuildStorageAddMemberToList(self,memberId,member,authority0,authority1,authority2,authority3):
  2499.         constInfo.GUILDSTORAGE["members"]["member"+memberId] = [member,int(authority0),int(authority1),int(authority2),int(authority3)]
  2500.  
  2501.     def __Inputget1(self):
  2502.         constInfo.INPUT_IGNORE = 1
  2503.  
  2504.     def __Inputget2(self):
  2505.         constInfo.INPUT_IGNORE = 0     
  2506.  
  2507.     def __BonusPage(self):
  2508.         import PaginaBonusuri
  2509.         global BPisLodaded
  2510.         try:
  2511.             if BPisLodaded == 0:
  2512.                 BPisLodaded = 1
  2513.                 exec 'PaginaBonusuri.BonusBoardDialog().Show()'
  2514.             else:
  2515.                 exec 'PaginaBonusuri.BonusBoardDialog().Hide()'
  2516.                 BPisLodaded = 0
  2517.         except ImportError:
  2518.             import dbg,app
  2519.             dbg.Trace('PaginaBonusuri.py Importing error')
  2520.             app.Abort
  2521.     def __toggleSwitchbot(self):
  2522.         if self.switchbot.bot_shown == 1:
  2523.             self.switchbot.Hide()  
  2524.         else:
  2525.             self.switchbot.Show()
  2526.     # Efsun Botu
  2527.     def __efsunbot(self):
  2528.         if 0==interfaceModule.Botacik:
  2529.             interfaceModule.Botacik = 1
  2530.             pyScrLoader = ui.PythonScriptLoader()
  2531.             pyScrLoader.LoadScriptFile(self, "efsunbot.pyc")
  2532.         else:
  2533.             chat.AppendChat(1, "Efsun Bot Zaten Aktif!")
  2534.            
  2535.     def EgeSwitchbot(self):
  2536.         pyScrLoader = ui.PythonScriptLoader()
  2537.         pyScrLoader.LoadScriptFile(self, "efsunbot.pyc")
  2538.            
  2539.     def __StoneWheel(self, getInfo):
  2540.         CMD = getInfo.split("/")
  2541.         if CMD[0]=="config":
  2542.             string = CMD[1].split("|")
  2543.             constInfo.STONEWHEEL_BY_KILROY[0] = (int(string[0]))
  2544.             constInfo.STONEWHEEL_BY_KILROY[1] = (int(string[1]))
  2545.             self.wndItemChance.SetToVars(string[2].split("#"), 1)
  2546.         elif CMD[0]=="input":
  2547.             net.SendQuestInputStringPacket(str(constInfo.STONEWHEEL_BY_KILROY[2]))
  2548.         elif CMD[0]=="setrand":
  2549.             self.wndItemChance.SetToVars(CMD[1].split("#"), 2)
  2550.         elif CMD[0]=="yangstatus":
  2551.             self.wndItemChance.YangAnswerFromServer(int(CMD[1]))
  2552.  
  2553.     def __StoneWheelOpen(self):
  2554.         self.wndItemChance.Open()
  2555.        
  2556.     def __PythonToLua(self, id):
  2557.         constInfo.PYTHONTOLUA = int(id)
  2558.  
  2559.     def __PythonIslem(self, PythonIslem):
  2560.         if PythonIslem == "PYTHONISLEM":
  2561.             net.SendQuestInputStringPacket(constInfo.PYTHONISLEM)
  2562.         elif PythonIslem == "PLAYER_VID":
  2563.             net.SendQuestInputStringPacket(str(constInfo.PLAYER_VID))
  2564.    
  2565.     def __LuaToPython(self, LuaToPython):
  2566.         if LuaToPython.find("#quest_input#") != -1:
  2567.             constInfo.INPUT = 1
  2568.         elif LuaToPython.find("#quest_inputbitir#") != -1:
  2569.             constInfo.INPUT = 0
  2570.         elif LuaToPython.find("#rakip_hp_sp#") != -1:
  2571.             constInfo.PLAYER_HP = LuaToPython.split("|")[1]
  2572.             constInfo.PLAYER_MAX_HP = LuaToPython.split("|")[2]
  2573.             constInfo.PLAYER_SP = LuaToPython.split("|")[3]
  2574.             constInfo.PLAYER_MAX_SP = LuaToPython.split("|")[4]
Advertisement
Add Comment
Please, Sign In to add comment