Guest User

Untitled

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