Guest User

Untitled

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