Advertisement
Guest User

Untitled

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