Guest User

Untitled

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