Guest User

Untitled

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