Guest User

Untitled

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