Advertisement
Guest User

Untitled

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