Guest User

game.py

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