Advertisement
Guest User

Untitled

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