Advertisement
Guest User

Untitled

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