Guest User

Untitled

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