Guest User

Untitled

a guest
May 11th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 87.06 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. import time
  37.  
  38. # PRIVATE_SHOP_PRICE_LIST
  39. import uiPrivateShopBuilder
  40. import uiOfflineShopBuilder
  41. import uiOfflineShop
  42. # END_OF_PRIVATE_SHOP_PRICE_LIST
  43.  
  44. import mouseModule
  45. import consoleModule
  46. import localeInfo
  47.  
  48. import playerSettingModule
  49. import interfaceModule
  50. import uiWarBoard
  51. import musicInfo
  52. import debugInfo
  53. import uipetsystem
  54. import stringCommander
  55. import event
  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. CHECK_ACTIVE_PICKUP = 0
  83. BPisLodaded = 0
  84.  
  85. class GameWindow(ui.ScriptWindow):
  86. def __init__(self, stream):
  87. ui.ScriptWindow.__init__(self, "GAME")
  88. self.SetWindowName("game")
  89. net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)
  90. player.SetGameWindow(self)
  91.  
  92. self.quickSlotPageIndex = 0
  93. self.lastPKModeSendedTime = 0
  94. self.pressNumber = None
  95.  
  96. self.guildWarQuestionDialog = None
  97. self.interface = None
  98. self.targetBoard = None
  99. self.console = None
  100. self.mapNameShower = None
  101. self.affectShower = None
  102. self.playerGauge = None
  103. constInfo.wndWarBoard = uiWarBoard.WarBoardWindow()
  104. self.stream=stream
  105. self.interface = interfaceModule.Interface()
  106. self.interface.SetStream(self.stream)
  107. self.interface.MakeInterface()
  108. self.interface.ShowDefaultWindows()
  109. self.stream.isAutoSelect = 0
  110.  
  111. self.curtain = uiPhaseCurtain.PhaseCurtain()
  112. self.curtain.speed = 0.03
  113. self.curtain.Hide()
  114.  
  115. self.targetBoard = uiTarget.TargetBoard()
  116. self.targetBoard.SetWhisperEvent(ui.__mem_func__(self.interface.OpenWhisperDialog))
  117. self.targetBoard.Hide()
  118.  
  119. self.petmain = uipetsystem.PetSystemMain()
  120. self.petmini = uipetsystem.PetSystemMini()
  121.  
  122.  
  123. self.console = consoleModule.ConsoleWindow()
  124. self.console.BindGameClass(self)
  125. self.console.SetConsoleSize(wndMgr.GetScreenWidth(), 200)
  126. self.console.Hide()
  127.  
  128. self.mapNameShower = uiMapNameShower.MapNameShower()
  129. self.affectShower = uiAffectShower.AffectShower()
  130.  
  131. self.playerGauge = uiPlayerGauge.PlayerGauge(self)
  132. self.playerGauge.Hide()
  133.  
  134. #wj 2014.1.2. ESCŰ�� ���� �� �켱������ DropQuestionDialog�� ������ �������. ������ ó���� itemDropQuestionDialog�� ����Ǿ� ���� �ʾ� ERROR�� �߻��Ͽ� init���� ����� ���ÿ� �ʱ�ȭ ��Ŵ.
  135. self.itemDropQuestionDialog = None
  136.  
  137. self.titletimer = 0
  138.  
  139. self.__SetQuickSlotMode()
  140.  
  141. self.__ServerCommand_Build()
  142. self.__ProcessPreservedServerCommand()
  143.  
  144. self.switchbot = Bot()
  145. self.switchbot.Hide()
  146.  
  147. def __del__(self):
  148. player.SetGameWindow(0)
  149. net.ClearPhaseWindow(net.PHASE_WINDOW_GAME, self)
  150. ui.ScriptWindow.__del__(self)
  151.  
  152. def Open(self):
  153. app.SetFrameSkip(1)
  154.  
  155. self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  156.  
  157. self.quickSlotPageIndex = 0
  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. uiOfflineShopBuilder.Clear()
  215.  
  216. # UNKNOWN_UPDATE
  217. exchange.InitTrading()
  218. # END_OF_UNKNOWN_UPDATE
  219.  
  220. if debugInfo.IsDebugMode():
  221. self.ToggleDebugInfo()
  222.  
  223. ## Sound
  224. snd.SetMusicVolume(systemSetting.GetMusicVolume()*net.GetFieldMusicVolume())
  225. snd.SetSoundVolume(systemSetting.GetSoundVolume())
  226.  
  227. netFieldMusicFileName = net.GetFieldMusicFileName()
  228. if netFieldMusicFileName:
  229. snd.FadeInMusic("BGM/" + netFieldMusicFileName)
  230. elif musicInfo.fieldMusic != "":
  231. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  232.  
  233. self.__SetQuickSlotMode()
  234. self.__SelectQuickPage(self.quickSlotPageIndex)
  235.  
  236. self.SetFocus()
  237. self.Show()
  238. app.ShowCursor()
  239.  
  240. net.SendEnterGamePacket()
  241.  
  242. # START_GAME_ERROR_EXIT
  243. try:
  244. self.StartGame()
  245. except:
  246. import exception
  247. exception.Abort("GameWindow.Open")
  248. # END_OF_START_GAME_ERROR_EXIT
  249.  
  250. # NPC�� ť��ý������� ���� �� �ִ� �����۵��� ����� ij��
  251. # ex) cubeInformation[20383] = [ {"rewordVNUM": 72723, "rewordCount": 1, "materialInfo": "101,1&102,2", "price": 999 }, ... ]
  252. self.cubeInformation = {}
  253. self.currentCubeNPC = 0
  254.  
  255. def Close(self):
  256. self.Hide()
  257.  
  258. global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  259. (cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
  260.  
  261. if musicInfo.fieldMusic != "":
  262. snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
  263.  
  264. self.onPressKeyDict = None
  265. self.onClickKeyDict = None
  266.  
  267. chat.Close()
  268. snd.StopAllSound()
  269. grp.InitScreenEffect()
  270. chr.Destroy()
  271. textTail.Clear()
  272. quest.Clear()
  273. background.Destroy()
  274. guild.Destroy()
  275. messenger.Destroy()
  276. skill.ClearSkillData()
  277. wndMgr.Unlock()
  278. mouseModule.mouseController.DeattachObject()
  279.  
  280. if self.guildWarQuestionDialog:
  281. self.guildWarQuestionDialog.Close()
  282.  
  283. self.guildNameBoard = None
  284. self.partyRequestQuestionDialog = None
  285. self.partyInviteQuestionDialog = None
  286. self.guildInviteQuestionDialog = None
  287. self.guildWarQuestionDialog = None
  288. self.messengerAddFriendQuestion = None
  289.  
  290. # UNKNOWN_UPDATE
  291. self.itemDropQuestionDialog = None
  292. # END_OF_UNKNOWN_UPDATE
  293.  
  294. # QUEST_CONFIRM
  295. self.confirmDialog = None
  296. # END_OF_QUEST_CONFIRM
  297.  
  298. self.PrintCoord = None
  299. self.FrameRate = None
  300. self.Pitch = None
  301. self.Splat = None
  302. self.TextureNum = None
  303. self.ObjectNum = None
  304. self.ViewDistance = None
  305. self.PrintMousePos = None
  306.  
  307. self.ClearDictionary()
  308. self.petmain.Close()
  309. self.petmini.Close()
  310.  
  311. self.playerGauge = None
  312. self.mapNameShower = None
  313. self.affectShower = None
  314.  
  315. if self.console:
  316. self.console.BindGameClass(0)
  317. self.console.Close()
  318. self.console=None
  319.  
  320. if self.targetBoard:
  321. self.targetBoard.Destroy()
  322. self.targetBoard = None
  323.  
  324. if self.interface:
  325. self.interface.HideAllWindows()
  326. self.interface.Close()
  327. self.interface=None
  328.  
  329. player.ClearSkillDict()
  330. player.ResetCameraRotation()
  331.  
  332. self.KillFocus()
  333. app.HideCursor()
  334.  
  335. print "---------------------------------------------------------------------------- CLOSE GAME WINDOW"
  336.  
  337. def __BuildKeyDict(self):
  338. onPressKeyDict = {}
  339.  
  340. ##PressKey �� ������ �ִ� ���� ��� ����Ǵ� Ű�̴�.
  341.  
  342. ## ���� ����Ű �����Կ� �̿�ȴ�.(���� ���ڵ鵵 �� ���Կ� ����)
  343. ## F12 �� Ŭ�� ����׿� Ű�̹Ƿ� ���� �ʴ� �� ����.
  344. onPressKeyDict[app.DIK_1] = lambda : self.__PressNumKey(1)
  345. onPressKeyDict[app.DIK_2] = lambda : self.__PressNumKey(2)
  346. onPressKeyDict[app.DIK_3] = lambda : self.__PressNumKey(3)
  347. onPressKeyDict[app.DIK_4] = lambda : self.__PressNumKey(4)
  348. onPressKeyDict[app.DIK_5] = lambda : self.__PressNumKey(5)
  349. onPressKeyDict[app.DIK_6] = lambda : self.__PressNumKey(6)
  350. onPressKeyDict[app.DIK_7] = lambda : self.__PressNumKey(7)
  351. onPressKeyDict[app.DIK_8] = lambda : self.__PressNumKey(8)
  352. onPressKeyDict[app.DIK_9] = lambda : self.__PressNumKey(9)
  353. onPressKeyDict[app.DIK_F1] = lambda : self.__PressQuickSlot(4)
  354. onPressKeyDict[app.DIK_F2] = lambda : self.__PressQuickSlot(5)
  355. onPressKeyDict[app.DIK_F3] = lambda : self.__PressQuickSlot(6)
  356. onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7)
  357. # onPressKeyDict[app.DIK_F7] = lambda : self.__toggleSwitchbot()
  358. onPressKeyDict[app.DIK_F8] = lambda : self.__EnablePickUpItem()
  359. onPressKeyDict[app.DIK_F5] = lambda : self.__HizliEkipman()
  360. onPressKeyDict[app.DIK_F6] = lambda : self.interface.ToggleBonusWindow()
  361.  
  362. onPressKeyDict[app.DIK_LALT] = lambda : self.ShowName()
  363. onPressKeyDict[app.DIK_LCONTROL] = lambda : self.ShowMouseImage()
  364. onPressKeyDict[app.DIK_SYSRQ] = lambda : self.SaveScreen()
  365. onPressKeyDict[app.DIK_SPACE] = lambda : self.StartAttack()
  366.  
  367. #ij���� �̵�Ű
  368. onPressKeyDict[app.DIK_UP] = lambda : self.MoveUp()
  369. onPressKeyDict[app.DIK_DOWN] = lambda : self.MoveDown()
  370. onPressKeyDict[app.DIK_LEFT] = lambda : self.MoveLeft()
  371. onPressKeyDict[app.DIK_RIGHT] = lambda : self.MoveRight()
  372. onPressKeyDict[app.DIK_W] = lambda : self.MoveUp()
  373. onPressKeyDict[app.DIK_S] = lambda : self.MoveDown()
  374. onPressKeyDict[app.DIK_A] = lambda : self.MoveLeft()
  375. onPressKeyDict[app.DIK_D] = lambda : self.MoveRight()
  376.  
  377. onPressKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
  378. onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
  379. #onPressKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  380. onPressKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
  381. onPressKeyDict[app.DIK_G] = self.__PressGKey
  382. onPressKeyDict[app.DIK_Q] = self.__PressQKey
  383. onPressKeyDict[app.DIK_P] = self.__PressPKey
  384.  
  385. onPressKeyDict[app.DIK_NUMPAD9] = lambda: app.MovieResetCamera()
  386. onPressKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
  387. onPressKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)
  388. onPressKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)
  389. onPressKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
  390. onPressKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
  391. onPressKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
  392. onPressKeyDict[app.DIK_GRAVE] = lambda : self.PickUpItem()
  393. onPressKeyDict[app.DIK_Z] = lambda : self.PickUpItem()
  394. onPressKeyDict[app.DIK_C] = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
  395. onPressKeyDict[app.DIK_V] = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
  396. #onPressKeyDict[app.DIK_B] = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
  397. onPressKeyDict[app.DIK_N] = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
  398. onPressKeyDict[app.DIK_I] = lambda : self.interface.ToggleInventoryWindow()
  399. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  400. onPressKeyDict[app.DIK_O] = lambda : self.interface.ToggleDragonSoulWindowWithNoInfo()
  401. onPressKeyDict[app.DIK_M] = lambda : self.interface.PressMKey()
  402. #onPressKeyDict[app.DIK_H] = lambda : self.interface.OpenHelpWindow()
  403. onPressKeyDict[app.DIK_ADD] = lambda : self.interface.MiniMapScaleUp()
  404. onPressKeyDict[app.DIK_SUBTRACT] = lambda : self.interface.MiniMapScaleDown()
  405. onPressKeyDict[app.DIK_L] = lambda : self.interface.ToggleChatLogWindow()
  406. onPressKeyDict[app.DIK_COMMA] = lambda : self.ShowConsole() # "`" key
  407. onPressKeyDict[app.DIK_LSHIFT] = lambda : self.__SetQuickPageMode()
  408.  
  409. onPressKeyDict[app.DIK_J] = lambda : self.__PressJKey()
  410. onPressKeyDict[app.DIK_H] = lambda : self.__PressHKey()
  411. onPressKeyDict[app.DIK_B] = lambda : self.__PressBKey()
  412. onPressKeyDict[app.DIK_F] = lambda : self.__PressFKey()
  413.  
  414. self.onPressKeyDict = onPressKeyDict
  415.  
  416. onClickKeyDict = {}
  417. onClickKeyDict[app.DIK_UP] = lambda : self.StopUp()
  418. onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown()
  419. onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft()
  420. onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight()
  421. onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack()
  422.  
  423. onClickKeyDict[app.DIK_W] = lambda : self.StopUp()
  424. onClickKeyDict[app.DIK_S] = lambda : self.StopDown()
  425. onClickKeyDict[app.DIK_A] = lambda : self.StopLeft()
  426. onClickKeyDict[app.DIK_D] = lambda : self.StopRight()
  427. onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP)
  428. onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP)
  429. onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  430. onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  431. onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP)
  432. onClickKeyDict[app.DIK_G] = lambda: self.__ReleaseGKey()
  433. onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  434. onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  435. onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  436. onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  437. onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  438. onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  439. onClickKeyDict[app.DIK_LALT] = lambda: self.HideName()
  440. onClickKeyDict[app.DIK_LCONTROL] = lambda: self.HideMouseImage()
  441. onClickKeyDict[app.DIK_LSHIFT] = lambda: self.__SetQuickSlotMode()
  442. onClickKeyDict[app.DIK_P] = lambda: self.OpenPetMainGui()
  443.  
  444. #if constInfo.PVPMODE_ACCELKEY_ENABLE:
  445. # onClickKeyDict[app.DIK_B] = lambda: self.ChangePKMode()
  446.  
  447. self.onClickKeyDict=onClickKeyDict
  448.  
  449. def __PressNumKey(self,num):
  450. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  451.  
  452. if num >= 1 and num <= 9:
  453. if(chrmgr.IsPossibleEmoticon(-1)):
  454. chrmgr.SetEmoticon(-1,int(num)-1)
  455. net.SendEmoticon(int(num)-1)
  456. else:
  457. if num >= 1 and num <= 4:
  458. self.pressNumber(num-1)
  459.  
  460. def __ClickBKey(self):
  461. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  462. return
  463. else:
  464. if constInfo.PVPMODE_ACCELKEY_ENABLE:
  465. self.ChangePKMode()
  466.  
  467.  
  468. def __PressJKey(self):
  469. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  470. if player.IsMountingHorse():
  471. net.SendChatPacket("/unmount")
  472. else:
  473. #net.SendChatPacket("/user_horse_ride")
  474. if not uiPrivateShopBuilder.IsBuildingPrivateShop() or not uiOfflineShopBuilder.IsBuildingOfflineShop():
  475. for i in xrange(player.INVENTORY_PAGE_SIZE):
  476. if player.GetItemIndex(i) in (71114, 71116, 71118, 71120):
  477. net.SendItemUsePacket(i)
  478. break
  479. def __PressHKey(self):
  480. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  481. net.SendChatPacket("/user_horse_ride")
  482. else:
  483. self.interface.OpenHelpWindow()
  484.  
  485. def __PressBKey(self):
  486. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  487. net.SendChatPacket("/user_horse_back")
  488. else:
  489. state = "EMOTICON"
  490. self.interface.ToggleCharacterWindow(state)
  491.  
  492. def __PressFKey(self):
  493. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  494. net.SendChatPacket("/user_horse_feed")
  495. else:
  496. app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  497.  
  498. def __PressGKey(self):
  499. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  500. net.SendChatPacket("/ride")
  501. else:
  502. if self.ShowNameFlag:
  503. self.interface.ToggleGuildWindow()
  504. else:
  505. app.PitchCamera(app.CAMERA_TO_POSITIVE)
  506.  
  507. def __ReleaseGKey(self):
  508. app.PitchCamera(app.CAMERA_STOP)
  509.  
  510. def __PressQKey(self):
  511. if (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
  512. if (interfaceModule.IsQBHide == 0):
  513. interfaceModule.IsQBHide = 1
  514. self.interface.HideAllQuestButton()
  515. else:
  516. interfaceModule.IsQBHide = 0
  517. self.interface.ShowAllQuestButton()
  518. else:
  519. app.RotateCamera(app.CAMERA_TO_NEGATIVE)
  520.  
  521. def __PressPKey(self):
  522. if (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
  523. if (interfaceModule.IsWhisperHide == 0):
  524. interfaceModule.IsWhisperHide = 1
  525. self.interface.HideAllWhisperButton()
  526. else:
  527. interfaceModule.IsWhisperHide = 0
  528. self.interface.ShowAllWhisperButton()
  529.  
  530. def __SetQuickSlotMode(self):
  531. self.pressNumber=ui.__mem_func__(self.__PressQuickSlot)
  532.  
  533. def __SetQuickPageMode(self):
  534. self.pressNumber=ui.__mem_func__(self.__SelectQuickPage)
  535.  
  536. def __PressQuickSlot(self, localSlotIndex):
  537. if localeInfo.IsARABIC():
  538. if 0 <= localSlotIndex and localSlotIndex < 4:
  539. player.RequestUseLocalQuickSlot(3-localSlotIndex)
  540. else:
  541. player.RequestUseLocalQuickSlot(11-localSlotIndex)
  542. else:
  543. player.RequestUseLocalQuickSlot(localSlotIndex)
  544.  
  545. def __SelectQuickPage(self, pageIndex):
  546. self.quickSlotPageIndex = pageIndex
  547. player.SetQuickPage(pageIndex)
  548.  
  549. def ToggleDebugInfo(self):
  550. self.isShowDebugInfo = not self.isShowDebugInfo
  551.  
  552. if self.isShowDebugInfo:
  553. self.PrintCoord.Show()
  554. self.FrameRate.Show()
  555. self.Pitch.Show()
  556. self.Splat.Show()
  557. self.TextureNum.Show()
  558. self.ObjectNum.Show()
  559. self.ViewDistance.Show()
  560. self.PrintMousePos.Show()
  561. else:
  562. self.PrintCoord.Hide()
  563. self.FrameRate.Hide()
  564. self.Pitch.Hide()
  565. self.Splat.Hide()
  566. self.TextureNum.Hide()
  567. self.ObjectNum.Hide()
  568. self.ViewDistance.Hide()
  569. self.PrintMousePos.Hide()
  570.  
  571. def __BuildDebugInfo(self):
  572. ## Character Position Coordinate
  573. self.PrintCoord = ui.TextLine()
  574. self.PrintCoord.SetFontName(localeInfo.UI_DEF_FONT)
  575. self.PrintCoord.SetPosition(wndMgr.GetScreenWidth() - 270, 0)
  576.  
  577. ## Frame Rate
  578. self.FrameRate = ui.TextLine()
  579. self.FrameRate.SetFontName(localeInfo.UI_DEF_FONT)
  580. self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
  581.  
  582. ## Camera Pitch
  583. self.Pitch = ui.TextLine()
  584. self.Pitch.SetFontName(localeInfo.UI_DEF_FONT)
  585. self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
  586.  
  587. ## Splat
  588. self.Splat = ui.TextLine()
  589. self.Splat.SetFontName(localeInfo.UI_DEF_FONT)
  590. self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
  591.  
  592. ##
  593. self.PrintMousePos = ui.TextLine()
  594. self.PrintMousePos.SetFontName(localeInfo.UI_DEF_FONT)
  595. self.PrintMousePos.SetPosition(wndMgr.GetScreenWidth() - 270, 80)
  596.  
  597. # TextureNum
  598. self.TextureNum = ui.TextLine()
  599. self.TextureNum.SetFontName(localeInfo.UI_DEF_FONT)
  600. self.TextureNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
  601.  
  602. # ������Ʈ �׸��� ����
  603. self.ObjectNum = ui.TextLine()
  604. self.ObjectNum.SetFontName(localeInfo.UI_DEF_FONT)
  605. self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 120)
  606.  
  607. # �þ߰Ÿ�
  608. self.ViewDistance = ui.TextLine()
  609. self.ViewDistance.SetFontName(localeInfo.UI_DEF_FONT)
  610. self.ViewDistance.SetPosition(0, 0)
  611.  
  612. def __NotifyError(self, msg):
  613. chat.AppendChat(chat.CHAT_TYPE_INFO, msg)
  614.  
  615. def ChangePKMode(self):
  616.  
  617. if not app.IsPressed(app.DIK_LCONTROL):
  618. return
  619.  
  620. if player.GetStatus(player.LEVEL)<constInfo.PVPMODE_PROTECTED_LEVEL:
  621. self.__NotifyError(localeInfo.OPTION_PVPMODE_PROTECT % (constInfo.PVPMODE_PROTECTED_LEVEL))
  622. return
  623.  
  624. curTime = app.GetTime()
  625. if curTime - self.lastPKModeSendedTime < constInfo.PVPMODE_ACCELKEY_DELAY:
  626. return
  627.  
  628. self.lastPKModeSendedTime = curTime
  629.  
  630. curPKMode = player.GetPKMode()
  631. nextPKMode = curPKMode + 1
  632. if nextPKMode == player.PK_MODE_PROTECT:
  633. if 0 == player.GetGuildID():
  634. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
  635. nextPKMode = 0
  636. else:
  637. nextPKMode = player.PK_MODE_GUILD
  638.  
  639. elif nextPKMode == player.PK_MODE_MAX_NUM:
  640. nextPKMode = 0
  641.  
  642. net.SendChatPacket("/PKMode " + str(nextPKMode))
  643. print "/PKMode " + str(nextPKMode)
  644.  
  645. def OnChangePKMode(self):
  646.  
  647. self.interface.OnChangePKMode()
  648.  
  649. try:
  650. self.__NotifyError(localeInfo.OPTION_PVPMODE_MESSAGE_DICT[player.GetPKMode()])
  651. except KeyError:
  652. print "UNKNOWN PVPMode[%d]" % (player.GetPKMode())
  653.  
  654. if constInfo.PVPMODE_TEST_ENABLE:
  655. curPKMode = player.GetPKMode()
  656. alignment, grade = chr.testGetPKData()
  657. self.pkModeNameDict = { 0 : "PEACE", 1 : "REVENGE", 2 : "FREE", 3 : "PROTECT", }
  658. self.testPKMode.SetText("Current PK Mode : " + self.pkModeNameDict.get(curPKMode, "UNKNOWN"))
  659. self.testAlignment.SetText("Current Alignment : " + str(alignment) + " (" + localeInfo.TITLE_NAME_LIST[grade] + ")")
  660.  
  661. ###############################################################################################
  662. ###############################################################################################
  663. ## Game Callback Functions
  664.  
  665. # Start
  666. def StartGame(self):
  667. self.RefreshInventory()
  668. self.RefreshEquipment()
  669. self.RefreshCharacter()
  670. self.RefreshSkill()
  671.  
  672. # Refresh
  673. def CheckGameButton(self):
  674. if self.interface:
  675. self.interface.CheckGameButton()
  676.  
  677. def RefreshAlignment(self):
  678. self.interface.RefreshAlignment()
  679.  
  680. def RefreshStatus(self):
  681. self.CheckGameButton()
  682.  
  683. if self.interface:
  684. self.interface.RefreshStatus()
  685.  
  686. if self.playerGauge:
  687. self.playerGauge.RefreshGauge()
  688.  
  689. def RefreshStamina(self):
  690. self.interface.RefreshStamina()
  691.  
  692. def RefreshSkill(self):
  693. self.CheckGameButton()
  694. if self.interface:
  695. self.interface.RefreshSkill()
  696.  
  697. def RefreshQuest(self):
  698. self.interface.RefreshQuest()
  699.  
  700. def RefreshMessenger(self):
  701. self.interface.RefreshMessenger()
  702.  
  703. def RefreshGuildInfoPage(self):
  704. self.interface.RefreshGuildInfoPage()
  705.  
  706. def RefreshGuildBoardPage(self):
  707. self.interface.RefreshGuildBoardPage()
  708.  
  709. def RefreshGuildMemberPage(self):
  710. self.interface.RefreshGuildMemberPage()
  711.  
  712. def RefreshGuildMemberPageGradeComboBox(self):
  713. self.interface.RefreshGuildMemberPageGradeComboBox()
  714.  
  715. def RefreshGuildSkillPage(self):
  716. self.interface.RefreshGuildSkillPage()
  717.  
  718. def RefreshGuildGradePage(self):
  719. self.interface.RefreshGuildGradePage()
  720.  
  721. def RefreshMobile(self):
  722. if self.interface:
  723. self.interface.RefreshMobile()
  724.  
  725. def OnMobileAuthority(self):
  726. self.interface.OnMobileAuthority()
  727.  
  728. def OnBlockMode(self, mode):
  729. self.interface.OnBlockMode(mode)
  730.  
  731. def OpenQuestWindow(self, skin, idx):
  732. self.interface.OpenQuestWindow(skin, idx)
  733.  
  734. def HideAllQuestWindow(self):
  735. self.interface.HideAllQuestWindow()
  736.  
  737. def AskGuildName(self):
  738.  
  739. guildNameBoard = uiCommon.InputDialog()
  740. guildNameBoard.SetTitle(localeInfo.GUILD_NAME)
  741. guildNameBoard.SetAcceptEvent(ui.__mem_func__(self.ConfirmGuildName))
  742. guildNameBoard.SetCancelEvent(ui.__mem_func__(self.CancelGuildName))
  743. guildNameBoard.Open()
  744.  
  745. self.guildNameBoard = guildNameBoard
  746.  
  747. def ConfirmGuildName(self):
  748. guildName = self.guildNameBoard.GetText()
  749. if not guildName:
  750. return
  751.  
  752. if net.IsInsultIn(guildName):
  753. self.PopupMessage(localeInfo.GUILD_CREATE_ERROR_INSULT_NAME)
  754. return
  755.  
  756. net.SendAnswerMakeGuildPacket(guildName)
  757. self.guildNameBoard.Close()
  758. self.guildNameBoard = None
  759. return TRUE
  760.  
  761. def CancelGuildName(self):
  762. self.guildNameBoard.Close()
  763. self.guildNameBoard = None
  764. return TRUE
  765.  
  766. ## Refine
  767. def PopupMessage(self, msg):
  768. self.stream.popupWindow.Close()
  769. self.stream.popupWindow.Open(msg, 0, localeInfo.UI_OK)
  770.  
  771. def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type=0):
  772. self.interface.OpenRefineDialog(targetItemPos, nextGradeItemVnum, cost, prob, type)
  773.  
  774. def AppendMaterialToRefineDialog(self, vnum, count):
  775. self.interface.AppendMaterialToRefineDialog(vnum, count)
  776.  
  777. def RunUseSkillEvent(self, slotIndex, coolTime):
  778. self.interface.OnUseSkill(slotIndex, coolTime)
  779.  
  780. def ClearAffects(self):
  781. self.affectShower.ClearAffects()
  782.  
  783. def SetAffect(self, affect):
  784. self.affectShower.SetAffect(affect)
  785.  
  786. def ResetAffect(self, affect):
  787. self.affectShower.ResetAffect(affect)
  788.  
  789. # UNKNOWN_UPDATE
  790. def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  791. self.affectShower.BINARY_NEW_AddAffect(type, pointIdx, value, duration)
  792. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  793. self.interface.DragonSoulActivate(type - chr.NEW_AFFECT_DRAGON_SOUL_DECK1)
  794. elif chr.NEW_AFFECT_DRAGON_SOUL_QUALIFIED == type:
  795. self.BINARY_DragonSoulGiveQuilification()
  796.  
  797. def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  798. self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  799. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  800. self.interface.DragonSoulDeactivate()
  801.  
  802.  
  803.  
  804. # END_OF_UNKNOWN_UPDATE
  805.  
  806. def ActivateSkillSlot(self, slotIndex):
  807. if self.interface:
  808. self.interface.OnActivateSkill(slotIndex)
  809.  
  810. def DeactivateSkillSlot(self, slotIndex):
  811. if self.interface:
  812. self.interface.OnDeactivateSkill(slotIndex)
  813.  
  814. def RefreshEquipment(self):
  815. if self.interface:
  816. self.interface.RefreshInventory()
  817.  
  818. def RefreshInventory(self):
  819. if self.interface:
  820. self.interface.RefreshInventory()
  821.  
  822. def RefreshCharacter(self):
  823. if self.interface:
  824. self.interface.RefreshCharacter()
  825.  
  826. def OnGameOver(self):
  827. self.CloseTargetBoard()
  828. self.OpenRestartDialog()
  829.  
  830. def OpenRestartDialog(self):
  831. self.interface.OpenRestartDialog()
  832.  
  833. def ChangeCurrentSkill(self, skillSlotNumber):
  834. self.interface.OnChangeCurrentSkill(skillSlotNumber)
  835.  
  836. if app.WJ_SHOW_STROKE_INFO:
  837. def RegisterStroke(self, targetVID, value):
  838. self.targetBoard.RegisterStroke(targetVID, value)
  839.  
  840. ## TargetBoard
  841. def SetPCTargetBoard(self, vid, name):
  842. self.targetBoard.Open(vid, name)
  843.  
  844. if app.IsPressed(app.DIK_LCONTROL):
  845.  
  846. if not player.IsSameEmpire(vid):
  847. return
  848.  
  849. if player.IsMainCharacterIndex(vid):
  850. return
  851. elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(vid):
  852. return
  853.  
  854. self.interface.OpenWhisperDialog(name)
  855.  
  856.  
  857. def RefreshTargetBoardByVID(self, vid):
  858. self.targetBoard.RefreshByVID(vid)
  859.  
  860. def RefreshTargetBoardByName(self, name):
  861. self.targetBoard.RefreshByName(name)
  862.  
  863. def __RefreshTargetBoard(self):
  864. self.targetBoard.Refresh()
  865.  
  866. if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  867. def SetHPTargetBoard(self, vid, hpPercentage, iMinHP, iMaxHP):
  868. if vid != self.targetBoard.GetTargetVID():
  869. self.targetBoard.ResetTargetBoard()
  870. self.targetBoard.SetEnemyVID(vid)
  871.  
  872. self.targetBoard.SetHP(hpPercentage, iMinHP, iMaxHP)
  873. self.targetBoard.Show()
  874. else:
  875. def SetHPTargetBoard(self, vid, hpPercentage):
  876. if vid != self.targetBoard.GetTargetVID():
  877. self.targetBoard.ResetTargetBoard()
  878. self.targetBoard.SetEnemyVID(vid)
  879.  
  880. self.targetBoard.SetHP(hpPercentage)
  881. self.targetBoard.Show()
  882.  
  883. def CloseTargetBoardIfDifferent(self, vid):
  884. if vid != self.targetBoard.GetTargetVID():
  885. self.targetBoard.Close()
  886.  
  887. def CloseTargetBoard(self):
  888. self.targetBoard.Close()
  889.  
  890. ## View Equipment
  891. def OpenEquipmentDialog(self, vid):
  892. self.interface.OpenEquipmentDialog(vid)
  893.  
  894. def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
  895. self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
  896.  
  897. def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
  898. self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
  899.  
  900. def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
  901. self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
  902.  
  903. # SHOW_LOCAL_MAP_NAME
  904. def ShowMapName(self, mapName, x, y):
  905.  
  906. if self.mapNameShower:
  907. self.mapNameShower.ShowMapName(mapName, x, y)
  908.  
  909. if self.interface:
  910. self.interface.SetMapName(mapName)
  911. # END_OF_SHOW_LOCAL_MAP_NAME
  912.  
  913. def BINARY_OpenAtlasWindow(self):
  914. self.interface.BINARY_OpenAtlasWindow()
  915.  
  916. ## Chat
  917. def OnRecvWhisper(self, mode, name, line):
  918. if mode == chat.WHISPER_TYPE_GM:
  919. self.interface.RegisterGameMasterName(name)
  920. chat.AppendWhisper(mode, name, line)
  921. self.interface.RecvWhisper(name)
  922.  
  923. def OnRecvWhisperSystemMessage(self, mode, name, line):
  924. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
  925. self.interface.RecvWhisper(name)
  926.  
  927. def OnRecvWhisperError(self, mode, name, line):
  928. if localeInfo.WHISPER_ERROR.has_key(mode):
  929. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name))
  930. else:
  931. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
  932. self.interface.RecvWhisper(name)
  933.  
  934. def RecvWhisper(self, name):
  935. self.interface.RecvWhisper(name)
  936.  
  937. def OnPickMoney(self, money):
  938. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_PICK_MONEY % (money))
  939.  
  940. def OnPickCheque(self, cheque):
  941. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHEQUE_SYSTEM_PICK_WON % (cheque))
  942.  
  943. def OnShopError(self, type):
  944. try:
  945. self.PopupMessage(localeInfo.SHOP_ERROR_DICT[type])
  946. except KeyError:
  947. self.PopupMessage(localeInfo.SHOP_ERROR_UNKNOWN % (type))
  948.  
  949. def OnSafeBoxError(self):
  950. self.PopupMessage(localeInfo.SAFEBOX_ERROR)
  951.  
  952. def OnFishingSuccess(self, isFish, fishName):
  953. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_SUCCESS(isFish, fishName), 2000)
  954.  
  955. # ADD_FISHING_MESSAGE
  956. def OnFishingNotifyUnknown(self):
  957. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_UNKNOWN)
  958.  
  959. def OnFishingWrongPlace(self):
  960. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_WRONG_PLACE)
  961. # END_OF_ADD_FISHING_MESSAGE
  962.  
  963. def OnFishingNotify(self, isFish, fishName):
  964. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_NOTIFY(isFish, fishName))
  965.  
  966. def OnFishingFailure(self):
  967. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_FAILURE, 2000)
  968.  
  969. def OnCannotPickItem(self):
  970. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_PICK_ITEM)
  971.  
  972. # MINING
  973. def OnCannotMining(self):
  974. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_MINING)
  975. # END_OF_MINING
  976.  
  977. def OnCannotUseSkill(self, vid, type):
  978. if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
  979. textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type])
  980.  
  981. if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
  982. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type])
  983.  
  984. def OnCannotShotError(self, vid, type):
  985. textTail.RegisterInfoTail(vid, localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type)))
  986.  
  987. ## PointReset
  988. def StartPointReset(self):
  989. self.interface.OpenPointResetDialog()
  990.  
  991. ## Shop
  992. def StartShop(self, vid):
  993. self.interface.OpenShopDialog(vid)
  994.  
  995. def EndShop(self):
  996. self.interface.CloseShopDialog()
  997.  
  998. def RefreshShop(self):
  999. self.interface.RefreshShopDialog()
  1000.  
  1001. def SetShopSellingPrice(self, Price):
  1002. pass
  1003.  
  1004. ## OfflineShop
  1005. def StartOfflineShop(self, vid):
  1006. self.interface.OpenOfflineShopDialog(vid)
  1007.  
  1008. def EndOfflineShop(self):
  1009. self.interface.CloseOfflineShopDialog()
  1010.  
  1011. def RefreshOfflineShop(self):
  1012. self.interface.RefreshOfflineShopDialog()
  1013.  
  1014. # def StartDice(self):
  1015. # self.interface.StartDice()
  1016.  
  1017. # def EndDice(self):
  1018. # self.interface.EndDice()
  1019.  
  1020. # def RefreshDice(self):
  1021. # self.interface.RefreshDice()
  1022.  
  1023. # def __DiceHasDone(self, myNumber, targetNumber):
  1024. # self.interface.AddDiceNumber(myNumber, targetNumber)
  1025.  
  1026. ## Exchange
  1027. def StartExchange(self):
  1028. self.interface.StartExchange()
  1029.  
  1030. def EndExchange(self):
  1031. self.interface.EndExchange()
  1032.  
  1033. def RefreshExchange(self):
  1034. self.interface.RefreshExchange()
  1035.  
  1036. ## Party
  1037. def RecvPartyInviteQuestion(self, leaderVID, leaderName):
  1038. partyInviteQuestionDialog = uiCommon.QuestionDialogWithTimeLimit()
  1039. partyInviteQuestionDialog.SetText1(leaderName + localeInfo.PARTY_DO_YOU_JOIN)
  1040. partyInviteQuestionDialog.SetTimeOverMsg(localeInfo.PARTY_ANSWER_TIMEOVER)
  1041. partyInviteQuestionDialog.SetTimeOverEvent(self.AnswerPartyInvite, False)
  1042. partyInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerPartyInvite(arg))
  1043. partyInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerPartyInvite(arg))
  1044. partyInviteQuestionDialog.Open(10)
  1045. partyInviteQuestionDialog.partyLeaderVID = leaderVID
  1046. self.partyInviteQuestionDialog = partyInviteQuestionDialog
  1047.  
  1048. def AnswerPartyInvite(self, answer):
  1049.  
  1050. if not self.partyInviteQuestionDialog:
  1051. return
  1052.  
  1053. partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
  1054.  
  1055. distance = player.GetCharacterDistance(partyLeaderVID)
  1056. if distance < 0.0 or distance > 5000:
  1057. answer = FALSE
  1058.  
  1059. net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
  1060.  
  1061. self.partyInviteQuestionDialog.Close()
  1062. self.partyInviteQuestionDialog = None
  1063.  
  1064. def AddPartyMember(self, pid, name):
  1065. self.interface.AddPartyMember(pid, name)
  1066.  
  1067. def UpdatePartyMemberInfo(self, pid):
  1068. self.interface.UpdatePartyMemberInfo(pid)
  1069.  
  1070. def RemovePartyMember(self, pid):
  1071. self.interface.RemovePartyMember(pid)
  1072. self.__RefreshTargetBoard()
  1073.  
  1074. def LinkPartyMember(self, pid, vid):
  1075. self.interface.LinkPartyMember(pid, vid)
  1076.  
  1077. def UnlinkPartyMember(self, pid):
  1078. self.interface.UnlinkPartyMember(pid)
  1079.  
  1080. def UnlinkAllPartyMember(self):
  1081. self.interface.UnlinkAllPartyMember()
  1082.  
  1083. def ExitParty(self):
  1084. self.interface.ExitParty()
  1085. self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID())
  1086.  
  1087. def ChangePartyParameter(self, distributionMode):
  1088. self.interface.ChangePartyParameter(distributionMode)
  1089.  
  1090. ## Messenger
  1091. def OnMessengerAddFriendQuestion(self, name):
  1092. messengerAddFriendQuestion = uiCommon.QuestionDialog2()
  1093. messengerAddFriendQuestion.SetText1(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
  1094. messengerAddFriendQuestion.SetText2(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2)
  1095. messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend))
  1096. messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend))
  1097. messengerAddFriendQuestion.Open()
  1098. messengerAddFriendQuestion.name = name
  1099. self.messengerAddFriendQuestion = messengerAddFriendQuestion
  1100.  
  1101. def OnAcceptAddFriend(self):
  1102. name = self.messengerAddFriendQuestion.name
  1103. net.SendChatPacket("/messenger_auth y " + name)
  1104. self.OnCloseAddFriendQuestionDialog()
  1105. return TRUE
  1106.  
  1107. def OnDenyAddFriend(self):
  1108. name = self.messengerAddFriendQuestion.name
  1109. net.SendChatPacket("/messenger_auth n " + name)
  1110. self.OnCloseAddFriendQuestionDialog()
  1111. return TRUE
  1112.  
  1113. def OnCloseAddFriendQuestionDialog(self):
  1114. self.messengerAddFriendQuestion.Close()
  1115. self.messengerAddFriendQuestion = None
  1116. return TRUE
  1117.  
  1118. ## SafeBox
  1119. def OpenSafeboxWindow(self, size):
  1120. self.interface.OpenSafeboxWindow(size)
  1121.  
  1122. def RefreshSafebox(self):
  1123. self.interface.RefreshSafebox()
  1124.  
  1125. def RefreshSafeboxMoney(self):
  1126. self.interface.RefreshSafeboxMoney()
  1127.  
  1128. # ITEM_MALL
  1129. def OpenMallWindow(self, size):
  1130. self.interface.OpenMallWindow(size)
  1131.  
  1132. def RefreshMall(self):
  1133. self.interface.RefreshMall()
  1134. # END_OF_ITEM_MALL
  1135.  
  1136. ## Guild
  1137. def RecvGuildInviteQuestion(self, guildID, guildName):
  1138. guildInviteQuestionDialog = uiCommon.QuestionDialog()
  1139. guildInviteQuestionDialog.SetText(guildName + localeInfo.GUILD_DO_YOU_JOIN)
  1140. guildInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerGuildInvite(arg))
  1141. guildInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerGuildInvite(arg))
  1142. guildInviteQuestionDialog.Open()
  1143. guildInviteQuestionDialog.guildID = guildID
  1144. self.guildInviteQuestionDialog = guildInviteQuestionDialog
  1145.  
  1146. def AnswerGuildInvite(self, answer):
  1147.  
  1148. if not self.guildInviteQuestionDialog:
  1149. return
  1150.  
  1151. guildLeaderVID = self.guildInviteQuestionDialog.guildID
  1152. net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
  1153.  
  1154. self.guildInviteQuestionDialog.Close()
  1155. self.guildInviteQuestionDialog = None
  1156.  
  1157.  
  1158. def DeleteGuild(self):
  1159. self.interface.DeleteGuild()
  1160.  
  1161. ## Clock
  1162. def ShowClock(self, second):
  1163. self.interface.ShowClock(second)
  1164.  
  1165. def HideClock(self):
  1166. self.interface.HideClock()
  1167.  
  1168. ## Emotion
  1169. def BINARY_ActEmotion(self, emotionIndex):
  1170. if self.interface.wndCharacter:
  1171. self.interface.wndCharacter.ActEmotion(emotionIndex)
  1172.  
  1173. ###############################################################################################
  1174. ###############################################################################################
  1175. ## Keyboard Functions
  1176.  
  1177. def CheckFocus(self):
  1178. if FALSE == self.IsFocus():
  1179. if TRUE == self.interface.IsOpenChat():
  1180. self.interface.ToggleChat()
  1181.  
  1182. self.SetFocus()
  1183.  
  1184. def SaveScreen(self):
  1185. print "save screen"
  1186.  
  1187. # SCREENSHOT_CWDSAVE
  1188. if SCREENSHOT_CWDSAVE:
  1189. if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
  1190. os.mkdir(os.getcwd()+os.sep+"screenshot")
  1191.  
  1192. (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep)
  1193. elif SCREENSHOT_DIR:
  1194. (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
  1195. else:
  1196. (succeeded, name) = grp.SaveScreenShot()
  1197. # END_OF_SCREENSHOT_CWDSAVE
  1198.  
  1199. if succeeded:
  1200. pass
  1201. """
  1202. chat.AppendChat(chat.CHAT_TYPE_INFO, name + localeInfo.SCREENSHOT_SAVE1)
  1203. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE2)
  1204. """
  1205. else:
  1206. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE_FAILURE)
  1207.  
  1208. def ShowConsole(self):
  1209. if debugInfo.IsDebugMode() or TRUE == self.consoleEnable:
  1210. player.EndKeyWalkingImmediately()
  1211. self.console.OpenWindow()
  1212.  
  1213. def ShowName(self):
  1214. self.ShowNameFlag = TRUE
  1215. self.playerGauge.EnableShowAlways()
  1216. player.SetQuickPage(self.quickSlotPageIndex+1)
  1217.  
  1218. # ADD_ALWAYS_SHOW_NAME
  1219. def __IsShowName(self):
  1220.  
  1221. if systemSetting.IsAlwaysShowName():
  1222. return TRUE
  1223.  
  1224. if self.ShowNameFlag:
  1225. return TRUE
  1226.  
  1227. return FALSE
  1228. # END_OF_ADD_ALWAYS_SHOW_NAME
  1229.  
  1230. def HideName(self):
  1231. self.ShowNameFlag = FALSE
  1232. self.playerGauge.DisableShowAlways()
  1233. player.SetQuickPage(self.quickSlotPageIndex)
  1234.  
  1235. def ShowMouseImage(self):
  1236. self.interface.ShowMouseImage()
  1237.  
  1238. def HideMouseImage(self):
  1239. self.interface.HideMouseImage()
  1240.  
  1241. def StartAttack(self):
  1242. player.SetAttackKeyState(TRUE)
  1243.  
  1244. def EndAttack(self):
  1245. player.SetAttackKeyState(FALSE)
  1246.  
  1247. def MoveUp(self):
  1248. player.SetSingleDIKKeyState(app.DIK_UP, TRUE)
  1249.  
  1250. def MoveDown(self):
  1251. player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)
  1252.  
  1253. def MoveLeft(self):
  1254. player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)
  1255.  
  1256. def MoveRight(self):
  1257. player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)
  1258.  
  1259. def StopUp(self):
  1260. player.SetSingleDIKKeyState(app.DIK_UP, FALSE)
  1261.  
  1262. def StopDown(self):
  1263. player.SetSingleDIKKeyState(app.DIK_DOWN, FALSE)
  1264.  
  1265. def StopLeft(self):
  1266. player.SetSingleDIKKeyState(app.DIK_LEFT, FALSE)
  1267.  
  1268. def StopRight(self):
  1269. player.SetSingleDIKKeyState(app.DIK_RIGHT, FALSE)
  1270.  
  1271. def PickUpItem(self):
  1272. player.PickCloseItem()
  1273.  
  1274. ###############################################################################################
  1275. ###############################################################################################
  1276. ## Event Handler
  1277.  
  1278. def OnKeyDown(self, key):
  1279. if self.interface.wndWeb and self.interface.wndWeb.IsShow():
  1280. return
  1281.  
  1282. if key == app.DIK_ESC:
  1283. self.RequestDropItem(False)
  1284. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1285.  
  1286. if key == app.DIK_TAB and constInfo.wndWarBoard:
  1287. if not constInfo.wndWarBoard.Open():
  1288. self.teleport.Open()
  1289. return True
  1290.  
  1291. try:
  1292. self.onPressKeyDict[key]()
  1293. except KeyError:
  1294. pass
  1295. except:
  1296. raise
  1297.  
  1298. return True
  1299.  
  1300. def OnKeyUp(self, key):
  1301. try:
  1302. self.onClickKeyDict[key]()
  1303. except KeyError:
  1304. pass
  1305. except:
  1306. raise
  1307.  
  1308. return TRUE
  1309.  
  1310. def OnMouseLeftButtonDown(self):
  1311. if self.interface.BUILD_OnMouseLeftButtonDown():
  1312. return
  1313.  
  1314. if mouseModule.mouseController.isAttached():
  1315. self.CheckFocus()
  1316. else:
  1317. hyperlink = ui.GetHyperlink()
  1318. if hyperlink:
  1319. return
  1320. else:
  1321. self.CheckFocus()
  1322. player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  1323.  
  1324. return TRUE
  1325.  
  1326. def OnMouseLeftButtonUp(self):
  1327.  
  1328. if self.interface.BUILD_OnMouseLeftButtonUp():
  1329. return
  1330.  
  1331. if mouseModule.mouseController.isAttached():
  1332.  
  1333. attachedType = mouseModule.mouseController.GetAttachedType()
  1334. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1335. attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1336. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1337.  
  1338. ## QuickSlot
  1339. if player.SLOT_TYPE_QUICK_SLOT == attachedType:
  1340. player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)
  1341.  
  1342. ## Inventory
  1343. elif player.SLOT_TYPE_INVENTORY == attachedType:
  1344.  
  1345. if player.ITEM_MONEY == attachedItemIndex:
  1346. self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1347. elif player.ITEM_CHEQUE == attachedItemIndex:
  1348. self.__PutCheque(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1349. else:
  1350. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1351.  
  1352. ## DragonSoul
  1353. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1354. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1355.  
  1356. mouseModule.mouseController.DeattachObject()
  1357.  
  1358. else:
  1359. hyperlink = ui.GetHyperlink()
  1360. if hyperlink:
  1361. if app.IsPressed(app.DIK_LALT):
  1362. link = chat.GetLinkFromHyperlink(hyperlink)
  1363. ime.PasteString(link)
  1364. else:
  1365. self.interface.MakeHyperlinkTooltip(hyperlink)
  1366. return
  1367. else:
  1368. player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  1369.  
  1370. #player.EndMouseWalking()
  1371. return TRUE
  1372.  
  1373. def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
  1374. if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1375. attachedInvenType = player.SlotTypeToInvenType(attachedType)
  1376. if TRUE == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1377. if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType:
  1378. self.stream.popupWindow.Close()
  1379. self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1380. else:
  1381. if chr.IsNPC(dstChrID):
  1382. net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1383. else:
  1384. if app.ENABLE_MELEY_LAIR_DUNGEON:
  1385. if chr.IsStone(dstChrID):
  1386. net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1387. else:
  1388. net.SendExchangeStartPacket(dstChrID)
  1389. net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1390. else:
  1391. net.SendExchangeStartPacket(dstChrID)
  1392. net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1393. else:
  1394. self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1395.  
  1396. def __PutMoney(self, attachedType, attachedMoney, dstChrID):
  1397. if TRUE == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1398. net.SendExchangeStartPacket(dstChrID)
  1399. net.SendExchangeElkAddPacket(attachedMoney)
  1400. else:
  1401. self.__DropMoney(attachedType, attachedMoney)
  1402.  
  1403. def __DropMoney(self, attachedType, attachedMoney):
  1404. # PRIVATESHOP_DISABLE_ITEM_DROP - ���λ��� ���� �ִ� ���� ������ ���� ����
  1405. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1406. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1407. return
  1408. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1409.  
  1410. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1411. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1412. return
  1413.  
  1414. if (uiOfflineShop.IsEditingOfflineShop()):
  1415. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1416. return
  1417.  
  1418. if attachedMoney>=1000:
  1419. self.stream.popupWindow.Close()
  1420. self.stream.popupWindow.Open(localeInfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeInfo.UI_OK)
  1421. return
  1422.  
  1423. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1424. itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_MONEY % (attachedMoney))
  1425. itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1426. itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1427. itemDropQuestionDialog.Open()
  1428. itemDropQuestionDialog.dropType = attachedType
  1429. itemDropQuestionDialog.dropCount = attachedMoney
  1430. itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
  1431. self.itemDropQuestionDialog = itemDropQuestionDialog
  1432.  
  1433. def __PutCheque(self, attachedType, attachedCheque, dstChrID):
  1434. if True == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1435. net.SendExchangeStartPacket(dstChrID)
  1436. net.SendExchangePsgAddPacket(attachedCheque)
  1437. else:
  1438. self.__DropCheque(attachedType, attachedCheque)
  1439.  
  1440. def __DropCheque(self, attachedType, attachedCheque):
  1441. if attachedCheque>=100:
  1442. self.stream.popupWindow.Close()
  1443. self.stream.popupWindow.Open(localeInfo.DROP_CHEQUE_FAILURE_100_OVER, 0, localeInfo.UI_OK)
  1444. return
  1445. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1446. itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_CHEQUE % (attachedCheque))
  1447. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1448. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1449. itemDropQuestionDialog.Open()
  1450. itemDropQuestionDialog.dropType = attachedType
  1451. itemDropQuestionDialog.dropCount = attachedCheque
  1452. itemDropQuestionDialog.dropNumber = player.ITEM_CHEQUE
  1453. self.itemDropQuestionDialog = itemDropQuestionDialog
  1454.  
  1455. def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
  1456. # PRIVATESHOP_DISABLE_ITEM_DROP - ���λ��� ���� �ִ� ���� ������ ���� ����
  1457. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1458. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1459. return
  1460. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1461.  
  1462. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1463. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1464. return
  1465.  
  1466. if (uiOfflineShop.IsEditingOfflineShop()):
  1467. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1468. return
  1469.  
  1470. if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos):
  1471. self.stream.popupWindow.Close()
  1472. self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1473.  
  1474. else:
  1475. if player.SLOT_TYPE_INVENTORY == attachedType:
  1476. dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
  1477.  
  1478. item.SelectItem(dropItemIndex)
  1479. dropItemName = item.GetItemName()
  1480.  
  1481. ## Question Text
  1482. questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1483.  
  1484. ## Dialog
  1485. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1486. itemDropQuestionDialog.SetText(questionText)
  1487. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1488. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1489. itemDropQuestionDialog.Open()
  1490. itemDropQuestionDialog.dropType = attachedType
  1491. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1492. itemDropQuestionDialog.dropCount = attachedItemCount
  1493. self.itemDropQuestionDialog = itemDropQuestionDialog
  1494.  
  1495. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1496. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1497. dropItemIndex = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, attachedItemSlotPos)
  1498.  
  1499. item.SelectItem(dropItemIndex)
  1500. dropItemName = item.GetItemName()
  1501.  
  1502. ## Question Text
  1503. questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1504.  
  1505. ## Dialog
  1506. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1507. itemDropQuestionDialog.SetText(questionText)
  1508. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1509. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1510. itemDropQuestionDialog.Open()
  1511. itemDropQuestionDialog.dropType = attachedType
  1512. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1513. itemDropQuestionDialog.dropCount = attachedItemCount
  1514. self.itemDropQuestionDialog = itemDropQuestionDialog
  1515.  
  1516. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1517.  
  1518. def RequestDropItem(self, answer):
  1519. if not self.itemDropQuestionDialog:
  1520. return
  1521.  
  1522. if answer:
  1523. dropType = self.itemDropQuestionDialog.dropType
  1524. dropCount = self.itemDropQuestionDialog.dropCount
  1525. dropNumber = self.itemDropQuestionDialog.dropNumber
  1526.  
  1527. if player.SLOT_TYPE_INVENTORY == dropType:
  1528. if dropNumber == player.ITEM_MONEY:
  1529. net.SendGoldDropPacketNew(dropCount)
  1530. snd.PlaySound("sound/ui/money.wav")
  1531. elif dropNumber == player.ITEM_CHEQUE:
  1532. net.SendChequeDropPacketNew(dropCount)
  1533. snd.PlaySound("sound/ui/money.wav")
  1534. else:
  1535. # PRIVATESHOP_DISABLE_ITEM_DROP
  1536. self.__SendDropItemPacket(dropNumber, dropCount)
  1537. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1538. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == dropType:
  1539. # PRIVATESHOP_DISABLE_ITEM_DROP
  1540. self.__SendDropItemPacket(dropNumber, dropCount, player.DRAGON_SOUL_INVENTORY)
  1541. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1542.  
  1543. self.itemDropQuestionDialog.Close()
  1544. self.itemDropQuestionDialog = None
  1545.  
  1546. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1547.  
  1548. def RequestDestroyItem(self, answer):
  1549. if not self.itemDropQuestionDialog:
  1550. return
  1551. if answer:
  1552. dropType = self.itemDropQuestionDialog.dropType
  1553. dropNumber = self.itemDropQuestionDialog.dropNumber
  1554. if player.SLOT_TYPE_INVENTORY == dropType:
  1555. if dropNumber == player.ITEM_MONEY:
  1556. return
  1557. else:
  1558. self.__SendDestroyItemPacket(dropNumber)
  1559.  
  1560. self.itemDropQuestionDialog.Close()
  1561. self.itemDropQuestionDialog = None
  1562. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1563.  
  1564. def RequestSellItem(self, answer):
  1565. if not self.itemDropQuestionDialog:
  1566. return
  1567. if answer:
  1568. dropType = self.itemDropQuestionDialog.dropType
  1569. dropNumber = self.itemDropQuestionDialog.dropNumber
  1570. if player.SLOT_TYPE_INVENTORY == dropType:
  1571. if dropNumber == player.ITEM_MONEY:
  1572. return
  1573. else:
  1574. self.__SendSellItemPacket(dropNumber)
  1575.  
  1576. self.itemDropQuestionDialog.Close()
  1577. self.itemDropQuestionDialog = None
  1578. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1579.  
  1580. # PRIVATESHOP_DISABLE_ITEM_DROP
  1581. def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
  1582. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1583. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1584. return
  1585.  
  1586. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1587. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1588. return
  1589.  
  1590. if (uiOfflineShop.IsEditingOfflineShop()):
  1591. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1592. return
  1593.  
  1594. net.SendItemDropPacketNew(itemInvenType, itemVNum, itemCount)
  1595. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1596.  
  1597. def __SendDestroyItemPacket(self, itemVNum, itemInvenType = player.INVENTORY):
  1598. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1599. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1600. return
  1601.  
  1602. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1603. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1604. return
  1605.  
  1606. if (uiOfflineShop.IsEditingOfflineShop()):
  1607. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1608. return
  1609.  
  1610. net.SendItemDestroyPacket(itemVNum)
  1611.  
  1612. def __SendSellItemPacket(self, itemVNum, itemInvenTyoe = player.INVENTORY):
  1613. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1614. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1615. return
  1616.  
  1617. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1618. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1619. return
  1620.  
  1621. if (uiOfflineShop.IsEditingOfflineShop()):
  1622. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1623. return
  1624.  
  1625. net.SendItemSellPacket(itemVNum)
  1626.  
  1627. def OnMouseRightButtonDown(self):
  1628.  
  1629. self.CheckFocus()
  1630.  
  1631. if TRUE == mouseModule.mouseController.isAttached():
  1632. mouseModule.mouseController.DeattachObject()
  1633.  
  1634. else:
  1635. player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
  1636.  
  1637. return TRUE
  1638.  
  1639. def OnMouseRightButtonUp(self):
  1640. if TRUE == mouseModule.mouseController.isAttached():
  1641. return TRUE
  1642.  
  1643. player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
  1644. return TRUE
  1645.  
  1646. def OnMouseMiddleButtonDown(self):
  1647. player.SetMouseMiddleButtonState(player.MBS_PRESS)
  1648.  
  1649. def OnMouseMiddleButtonUp(self):
  1650. player.SetMouseMiddleButtonState(player.MBS_CLICK)
  1651.  
  1652. def OnUpdate(self):
  1653. app.UpdateGame()
  1654.  
  1655. if self.mapNameShower.IsShow():
  1656. self.mapNameShower.Update()
  1657.  
  1658. if self.isShowDebugInfo:
  1659. self.UpdateDebugInfo()
  1660.  
  1661. if self.enableXMasBoom:
  1662. self.__XMasBoom_Update()
  1663.  
  1664. if 1 == constInfo.ENABLE_PICKUP:
  1665. self.PickUpItem()
  1666.  
  1667. self.titletimer += 1
  1668. if self.titletimer == 600:
  1669. titles = app.GetRandom(1,3)
  1670. if titles == 1:
  1671. app.SetTitle("Metin2")
  1672. elif titles == 2:
  1673. app.SetTitle("Metin2")
  1674. elif titles == 3:
  1675. app.SetTitle("Metin2")
  1676. self.titletimer = 0
  1677.  
  1678. if int(int(self.interface.LastContactTimeStamp) + self.interface.WaitTime) < int(app.GetTime()) and self.interface.State == "Kapali":
  1679. self.interface.State = "Acik"
  1680.  
  1681. self.interface.BUILD_OnUpdate()
  1682.  
  1683. def UpdateDebugInfo(self):
  1684. #
  1685. # ij���� ��ǥ �� FPS ���
  1686. (x, y, z) = player.GetMainCharacterPosition()
  1687. nUpdateTime = app.GetUpdateTime()
  1688. nUpdateFPS = app.GetUpdateFPS()
  1689. nRenderFPS = app.GetRenderFPS()
  1690. nFaceCount = app.GetFaceCount()
  1691. fFaceSpeed = app.GetFaceSpeed()
  1692. nST=background.GetRenderShadowTime()
  1693. (fAveRT, nCurRT) = app.GetRenderTime()
  1694. (iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
  1695. (iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
  1696. if iPatch == 0:
  1697. iPatch = 1
  1698.  
  1699. #(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
  1700.  
  1701. #self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
  1702. #xMouse, yMouse = wndMgr.GetMousePosition()
  1703. #self.PrintMousePos.SetText("MousePosition: %d %d" % (xMouse, yMouse))
  1704.  
  1705. #self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
  1706.  
  1707. #if fAveRT>1.0:
  1708. #self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
  1709.  
  1710. #self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
  1711. #self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
  1712. #self.TextureNum.SetText("TN : %s" % (sTextureNum))
  1713. #self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
  1714. #self.ViewDistance.SetText("Num : %d, FS : %f, FE : %f, FC : %f" % (iNum, fFogStart, fFogEnd, fFarCilp))
  1715.  
  1716. def OnRender(self):
  1717. app.RenderGame()
  1718.  
  1719. if self.console.Console.collision:
  1720. background.RenderCollision()
  1721. chr.RenderCollision()
  1722.  
  1723. (x, y) = app.GetCursorPosition()
  1724.  
  1725. ########################
  1726. # Picking
  1727. ########################
  1728. textTail.UpdateAllTextTail()
  1729.  
  1730. if TRUE == wndMgr.IsPickedWindow(self.hWnd):
  1731.  
  1732. self.PickingCharacterIndex = chr.Pick()
  1733.  
  1734. if -1 != self.PickingCharacterIndex:
  1735. textTail.ShowCharacterTextTail(self.PickingCharacterIndex)
  1736. if 0 != self.targetBoard.GetTargetVID():
  1737. textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())
  1738.  
  1739. # ADD_ALWAYS_SHOW_NAME
  1740. if not self.__IsShowName():
  1741. self.PickingItemIndex = item.Pick()
  1742. if -1 != self.PickingItemIndex:
  1743. textTail.ShowItemTextTail(self.PickingItemIndex)
  1744. # END_OF_ADD_ALWAYS_SHOW_NAME
  1745.  
  1746. ## Show all name in the range
  1747.  
  1748. # ADD_ALWAYS_SHOW_NAME
  1749. if self.__IsShowName():
  1750. textTail.ShowAllTextTail()
  1751. self.PickingItemIndex = textTail.Pick(x, y)
  1752. if app.ENABLE_SHOPNAMES_RANGE:
  1753. if systemSetting.IsShowSalesText():
  1754. uiPrivateShopBuilder.UpdateADBoard()
  1755. uiOfflineShopBuilder.UpdateADBoard()
  1756. # END_OF_ADD_ALWAYS_SHOW_NAME
  1757.  
  1758. textTail.UpdateShowingTextTail()
  1759. textTail.ArrangeTextTail()
  1760. if -1 != self.PickingItemIndex:
  1761. textTail.SelectItemName(self.PickingItemIndex)
  1762.  
  1763. grp.PopState()
  1764. grp.SetInterfaceRenderState()
  1765.  
  1766. textTail.Render()
  1767. textTail.HideAllTextTail()
  1768.  
  1769. def OnPressEscapeKey(self):
  1770. if constInfo.wndWarBoard.IsShow():
  1771. constInfo.wndWarBoard.Close()
  1772. return
  1773. if app.TARGET == app.GetCursor():
  1774. app.SetCursor(app.NORMAL)
  1775.  
  1776. elif TRUE == mouseModule.mouseController.isAttached():
  1777. mouseModule.mouseController.DeattachObject()
  1778.  
  1779. else:
  1780. self.interface.OpenSystemDialog()
  1781.  
  1782. return TRUE
  1783.  
  1784. def OnIMEReturn(self):
  1785. if app.IsPressed(app.DIK_LSHIFT):
  1786. self.interface.OpenWhisperDialogWithoutTarget()
  1787. else:
  1788. self.interface.ToggleChat()
  1789. return TRUE
  1790.  
  1791. def OnPressExitKey(self):
  1792. self.interface.ToggleSystemDialog()
  1793. return TRUE
  1794.  
  1795. ## BINARY CALLBACK
  1796. ######################################################################################
  1797.  
  1798. # EXCHANGE
  1799. if app.WJ_ENABLE_TRADABLE_ICON:
  1800. def BINARY_AddItemToExchange(self, inven_type, inven_pos, display_pos):
  1801. if inven_type == player.INVENTORY:
  1802. self.interface.CantTradableItemExchange(display_pos, inven_pos)
  1803. # END_OF_EXCHANGE
  1804.  
  1805. # WEDDING
  1806. def BINARY_LoverInfo(self, name, lovePoint):
  1807. if self.interface.wndMessenger:
  1808. self.interface.wndMessenger.OnAddLover(name, lovePoint)
  1809. if self.affectShower:
  1810. self.affectShower.SetLoverInfo(name, lovePoint)
  1811.  
  1812. def BINARY_UpdateLovePoint(self, lovePoint):
  1813. if self.interface.wndMessenger:
  1814. self.interface.wndMessenger.OnUpdateLovePoint(lovePoint)
  1815. if self.affectShower:
  1816. self.affectShower.OnUpdateLovePoint(lovePoint)
  1817. # END_OF_WEDDING
  1818.  
  1819. # QUEST_CONFIRM
  1820. def BINARY_OnQuestConfirm(self, msg, timeout, pid):
  1821. confirmDialog = uiCommon.QuestionDialogWithTimeLimit()
  1822. confirmDialog.SetText1(msg)
  1823. confirmDialog.Open(timeout)
  1824. confirmDialog.SetAcceptEvent(lambda answer=True, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1825. confirmDialog.SetCancelEvent(lambda answer=False, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1826. self.confirmDialog = confirmDialog
  1827. # END_OF_QUEST_CONFIRM
  1828.  
  1829. # GIFT command
  1830. def Gift_Show(self):
  1831. self.interface.ShowGift()
  1832.  
  1833. # CUBE
  1834. def BINARY_Cube_Open(self, npcVNUM):
  1835. self.currentCubeNPC = npcVNUM
  1836.  
  1837. self.interface.OpenCubeWindow()
  1838.  
  1839.  
  1840. if npcVNUM not in self.cubeInformation:
  1841. net.SendChatPacket("/cube r_info")
  1842. else:
  1843. cubeInfoList = self.cubeInformation[npcVNUM]
  1844.  
  1845. i = 0
  1846. for cubeInfo in cubeInfoList:
  1847. self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"])
  1848.  
  1849. j = 0
  1850. for materialList in cubeInfo["materialList"]:
  1851. for materialInfo in materialList:
  1852. itemVnum, itemCount = materialInfo
  1853. self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount)
  1854. j = j + 1
  1855.  
  1856. i = i + 1
  1857.  
  1858. self.interface.wndCube.Refresh()
  1859.  
  1860. def BINARY_Cube_Close(self):
  1861. self.interface.CloseCubeWindow()
  1862.  
  1863. # ���ۿ� �ʿ��� ���, ����Ǵ� �ϼ�ǰ�� VNUM�� ���� ���� update
  1864. def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count):
  1865. self.interface.UpdateCubeInfo(gold, itemVnum, count)
  1866.  
  1867. def BINARY_Cube_Succeed(self, itemVnum, count):
  1868. print "ť�� ���� ����"
  1869. self.interface.SucceedCubeWork(itemVnum, count)
  1870. pass
  1871.  
  1872. def BINARY_Cube_Failed(self):
  1873. print "ť�� ���� ����"
  1874. self.interface.FailedCubeWork()
  1875. pass
  1876.  
  1877. def BINARY_Cube_ResultList(self, npcVNUM, listText):
  1878. # ResultList Text Format : 72723,1/72725,1/72730.1/50001,5 �̷������� "/" ���ڷ� ���е� ����Ʈ�� ��
  1879. #print listText
  1880.  
  1881. if npcVNUM == 0:
  1882. npcVNUM = self.currentCubeNPC
  1883.  
  1884. self.cubeInformation[npcVNUM] = []
  1885.  
  1886. try:
  1887. for eachInfoText in listText.split("/"):
  1888. eachInfo = eachInfoText.split(",")
  1889. itemVnum = int(eachInfo[0])
  1890. itemCount = int(eachInfo[1])
  1891.  
  1892. self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount})
  1893. self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount)
  1894.  
  1895. resultCount = len(self.cubeInformation[npcVNUM])
  1896. requestCount = 7
  1897. modCount = resultCount % requestCount
  1898. splitCount = resultCount / requestCount
  1899. for i in xrange(splitCount):
  1900. #print("/cube r_info %d %d" % (i * requestCount, requestCount))
  1901. net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
  1902.  
  1903. if 0 < modCount:
  1904. #print("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1905. net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1906.  
  1907. except RuntimeError, msg:
  1908. dbg.TraceError(msg)
  1909. return 0
  1910.  
  1911. pass
  1912.  
  1913. def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText):
  1914. # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000
  1915. try:
  1916. #print listText
  1917.  
  1918. if 3 > len(listText):
  1919. dbg.TraceError("Wrong Cube Material Infomation")
  1920. return 0
  1921.  
  1922.  
  1923.  
  1924. eachResultList = listText.split("@")
  1925.  
  1926. cubeInfo = self.cubeInformation[self.currentCubeNPC]
  1927.  
  1928. itemIndex = 0
  1929. for eachResultText in eachResultList:
  1930. cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []]
  1931. materialList = cubeInfo[startIndex + itemIndex]["materialList"]
  1932.  
  1933. gold = 0
  1934. splitResult = eachResultText.split("/")
  1935. if 1 < len(splitResult):
  1936. gold = int(splitResult[1])
  1937.  
  1938. #print "splitResult : ", splitResult
  1939. eachMaterialList = splitResult[0].split("&")
  1940.  
  1941. i = 0
  1942. for eachMaterialText in eachMaterialList:
  1943. complicatedList = eachMaterialText.split("|")
  1944.  
  1945. if 0 < len(complicatedList):
  1946. for complicatedText in complicatedList:
  1947. (itemVnum, itemCount) = complicatedText.split(",")
  1948. itemVnum = int(itemVnum)
  1949. itemCount = int(itemCount)
  1950. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1951.  
  1952. materialList[i].append((itemVnum, itemCount))
  1953.  
  1954. else:
  1955. itemVnum, itemCount = eachMaterialText.split(",")
  1956. itemVnum = int(itemVnum)
  1957. itemCount = int(itemCount)
  1958. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1959.  
  1960. materialList[i].append((itemVnum, itemCount))
  1961.  
  1962. i = i + 1
  1963.  
  1964.  
  1965.  
  1966. itemIndex = itemIndex + 1
  1967.  
  1968. self.interface.wndCube.Refresh()
  1969.  
  1970.  
  1971. except RuntimeError, msg:
  1972. dbg.TraceError(msg)
  1973. return 0
  1974.  
  1975. pass
  1976.  
  1977. # END_OF_CUBE
  1978.  
  1979. def BINARY_AttrTransfer_Open(self):
  1980. self.interface.OpenAttrTransferWindow()
  1981.  
  1982. def BINARY_AttrTransfer_Close(self):
  1983. self.interface.CloseAttrTransferWindow()
  1984.  
  1985. def BINARY_AttrTransfer_Success(self):
  1986. self.interface.AttrTransferSuccess()
  1987.  
  1988. # ��ȥ��
  1989. def BINARY_Highlight_Item(self, inven_type, inven_pos):
  1990. if self.interface:
  1991. self.interface.Highlight_Item(inven_type, inven_pos)
  1992.  
  1993. def BINARY_Cards_UpdateInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points):
  1994. self.interface.UpdateCardsInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points)
  1995.  
  1996. def BINARY_Cards_FieldUpdateInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
  1997. self.interface.UpdateCardsFieldInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)
  1998.  
  1999. def BINARY_Cards_PutReward(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
  2000. self.interface.CardsPutReward(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)
  2001.  
  2002. def BINARY_Cards_ShowIcon(self):
  2003. self.interface.CardsShowIcon()
  2004.  
  2005. def BINARY_Cards_Open(self, safemode):
  2006. self.interface.OpenCardsWindow(safemode)
  2007.  
  2008. def BINARY_DragonSoulGiveQuilification(self):
  2009. self.interface.DragonSoulGiveQuilification()
  2010.  
  2011. def BINARY_DragonSoulRefineWindow_Open(self):
  2012. self.interface.OpenDragonSoulRefineWindow()
  2013.  
  2014. def BINARY_DragonSoulRefineWindow_RefineFail(self, reason, inven_type, inven_pos):
  2015. self.interface.FailDragonSoulRefine(reason, inven_type, inven_pos)
  2016.  
  2017. def BINARY_DragonSoulRefineWindow_RefineSucceed(self, inven_type, inven_pos):
  2018. self.interface.SucceedDragonSoulRefine(inven_type, inven_pos)
  2019.  
  2020. # END of DRAGON SOUL REFINE WINDOW
  2021.  
  2022. def BINARY_SetBigMessage(self, message):
  2023. self.interface.bigBoard.SetTip(message)
  2024.  
  2025. def BINARY_SetTipMessage(self, message):
  2026. self.interface.tipBoard.SetTip(message)
  2027.  
  2028. def BINARY_AppendNotifyMessage(self, type):
  2029. if not type in localeInfo.NOTIFY_MESSAGE:
  2030. return
  2031. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.NOTIFY_MESSAGE[type])
  2032.  
  2033. def BINARY_Guild_EnterGuildArea(self, areaID):
  2034. self.interface.BULID_EnterGuildArea(areaID)
  2035.  
  2036. def BINARY_Guild_ExitGuildArea(self, areaID):
  2037. self.interface.BULID_ExitGuildArea(areaID)
  2038.  
  2039. def BINARY_GuildWar_OnSendDeclare(self, guildID):
  2040. pass
  2041.  
  2042. def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
  2043. mainCharacterName = player.GetMainCharacterName()
  2044. masterName = guild.GetGuildMasterName()
  2045. if mainCharacterName == masterName:
  2046. self.__GuildWar_OpenAskDialog(guildID, warType)
  2047.  
  2048. def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
  2049. self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
  2050.  
  2051. def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
  2052. self.interface.OnStartGuildWar(guildSelf, guildOpp)
  2053.  
  2054. def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
  2055. self.interface.OnEndGuildWar(guildSelf, guildOpp)
  2056.  
  2057. def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
  2058. self.interface.BINARY_SetObserverMode(isEnable)
  2059.  
  2060. def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
  2061. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  2062.  
  2063. def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
  2064. guildID1 = int(guildID1)
  2065. guildID2 = int(guildID2)
  2066. memberCount1 = int(memberCount1)
  2067. memberCount2 = int(memberCount2)
  2068. observerCount = int(observerCount)
  2069.  
  2070. self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
  2071. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  2072.  
  2073. def __GuildWar_OpenAskDialog(self, guildID, warType):
  2074.  
  2075. guildName = guild.GetGuildName(guildID)
  2076.  
  2077. # REMOVED_GUILD_BUG_FIX
  2078. if "Noname" == guildName:
  2079. return
  2080. # END_OF_REMOVED_GUILD_BUG_FIX
  2081.  
  2082. import uiGuild
  2083. questionDialog = uiGuild.AcceptGuildWarDialog()
  2084. questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept)
  2085. questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline)
  2086. questionDialog.Open(guildName, warType)
  2087.  
  2088. self.guildWarQuestionDialog = questionDialog
  2089.  
  2090. def __GuildWar_CloseAskDialog(self):
  2091. self.guildWarQuestionDialog.Close()
  2092. self.guildWarQuestionDialog = None
  2093.  
  2094. def __GuildWar_OnAccept(self):
  2095.  
  2096. guildName = self.guildWarQuestionDialog.GetGuildName()
  2097.  
  2098. net.SendChatPacket("/war " + guildName)
  2099. self.__GuildWar_CloseAskDialog()
  2100.  
  2101. return 1
  2102.  
  2103. def __GuildWar_OnDecline(self):
  2104.  
  2105. guildName = self.guildWarQuestionDialog.GetGuildName()
  2106.  
  2107. net.SendChatPacket("/nowar " + guildName)
  2108. self.__GuildWar_CloseAskDialog()
  2109.  
  2110. return 1
  2111. ## BINARY CALLBACK
  2112. ######################################################################################
  2113.  
  2114. def __ServerCommand_Build(self):
  2115. serverCommandList={
  2116. "ConsoleEnable" : self.__Console_Enable,
  2117. "warboard" : self.__WarBoard,
  2118. "CanOpenWarBoard" : self.CanOpenWarBoard,
  2119. "CantOpenWarBoard" : self.CantOpenWarBoard,
  2120. "DayMode" : self.__DayMode_Update,
  2121. "PRESERVE_DayMode" : self.__PRESERVE_DayMode_Update,
  2122. "CloseRestartWindow" : self.__RestartDialog_Close,
  2123. "OpenPrivateShop" : self.__PrivateShop_Open,
  2124. "OpenOfflineShop" : self.__OfflineShop_Open,
  2125. "PartyHealReady" : self.PartyHealReady,
  2126. "ShowMeSafeboxPassword" : self.AskSafeboxPassword,
  2127. "CloseSafebox" : self.CommandCloseSafebox,
  2128. # "DiceDone" : self.__DiceHasDone,
  2129.  
  2130. # ITEM_MALL
  2131. "CloseMall" : self.CommandCloseMall,
  2132. "ShowMeMallPassword" : self.AskMallPassword,
  2133. "item_mall" : self.__ItemMall_Open,
  2134. # END_OF_ITEM_MALL
  2135.  
  2136. "RefineSuceeded" : self.RefineSuceededMessage,
  2137. "RefineFailed" : self.RefineFailedMessage,
  2138. "xmas_snow" : self.__XMasSnow_Enable,
  2139. "xmas_boom" : self.__XMasBoom_Enable,
  2140. "xmas_song" : self.__XMasSong_Enable,
  2141. "xmas_tree" : self.__XMasTree_Enable,
  2142. "newyear_boom" : self.__XMasBoom_Enable,
  2143. "PartyRequest" : self.__PartyRequestQuestion,
  2144. "PartyRequestDenied" : self.__PartyRequestDenied,
  2145. "horse_state" : self.__Horse_UpdateState,
  2146. "hide_horse_state" : self.__Horse_HideState,
  2147. "WarUC" : self.__GuildWar_UpdateMemberCount,
  2148. "test_server" : self.__EnableTestServerFlag,
  2149. "mall" : self.__InGameShop_Show,
  2150.  
  2151. "PetEvolution" : self.SetPetEvolution,
  2152. "PetName" : self.SetPetName,
  2153. "PetLevel" : self.SetPetLevel,
  2154. "PetDuration" : self.SetPetDuration,
  2155. ##Pet Yas Bugu Fixi##
  2156. "PetDurationYas" : self.SetPetDurationYas,
  2157. ##Pet Yas Bugu Fixi##
  2158. "PetBonus" : self.SetPetBonus,
  2159. "PetSkill" : self.SetPetskill,
  2160. "PetIcon" : self.SetPetIcon,
  2161. "PetExp" : self.SetPetExp,
  2162. "PetUnsummon" : self.PetUnsummon,
  2163. "OpenPetIncubator" : self.OpenPetIncubator,
  2164.  
  2165. # WEDDING
  2166. "lover_login" : self.__LoginLover,
  2167. "lover_logout" : self.__LogoutLover,
  2168. "lover_near" : self.__LoverNear,
  2169. "lover_far" : self.__LoverFar,
  2170. "lover_divorce" : self.__LoverDivorce,
  2171. "PlayMusic" : self.__PlayMusic,
  2172. # END_OF_WEDDING
  2173.  
  2174. #Gaya
  2175. "Gem" : self.BINARY_Update_Coins,
  2176. #Fine Gaya
  2177. "AttrTransferMessage" : self.AttrTransferMessage,
  2178.  
  2179. "dragonlair_ranking_open" : self.OpenDragonLairRanking,
  2180. "dragonlair_rank" : self.AddDragonLairRanking,
  2181.  
  2182. # PRIVATE_SHOP_PRICE_LIST
  2183. "MyShopPriceList" : self.__PrivateShop_PriceList,
  2184. # END_OF_PRIVATE_SHOP_PRICE_LIST
  2185.  
  2186. "getinputbegin" : self.__Inputget1,
  2187. "getinputend" : self.__Inputget2,
  2188. }
  2189. self.serverCommander=stringCommander.Analyzer()
  2190. if app.ENABLE_MELEY_LAIR_DUNGEON:
  2191. self.serverCommander.SAFE_RegisterCallBack("meley_open", self.OpenMeleyRanking)
  2192. self.serverCommander.SAFE_RegisterCallBack("meley_rank", self.AddRankMeleyRanking)
  2193. for serverCommandItem in serverCommandList.items():
  2194. self.serverCommander.SAFE_RegisterCallBack(
  2195. serverCommandItem[0], serverCommandItem[1]
  2196. )
  2197.  
  2198. def BINARY_ServerCommand_Run(self, line):
  2199. #dbg.TraceError(line)
  2200. try:
  2201. #print " BINARY_ServerCommand_Run", line
  2202. return self.serverCommander.Run(line)
  2203. except RuntimeError, msg:
  2204. dbg.TraceError(msg)
  2205. return 0
  2206.  
  2207. def __ProcessPreservedServerCommand(self):
  2208. def __WarBoard(self, input):
  2209. constInfo.wndWarBoard.Handle(input)
  2210.  
  2211. def CanOpenWarBoard(self):
  2212. constInfo.CanOpen = 1
  2213.  
  2214. def CantOpenWarBoard(self):
  2215. constInfo.CanOpen = 0
  2216. try:
  2217. command = net.GetPreservedServerCommand()
  2218. while command:
  2219. print " __ProcessPreservedServerCommand", command
  2220. self.serverCommander.Run(command)
  2221. command = net.GetPreservedServerCommand()
  2222. except RuntimeError, msg:
  2223. dbg.TraceError(msg)
  2224. return 0
  2225.  
  2226. def __Inputget1(self):
  2227. constInfo.INPUT_IGNORE = 1
  2228.  
  2229. def __Inputget2(self):
  2230. constInfo.INPUT_IGNORE = 0
  2231.  
  2232. def PartyHealReady(self):
  2233. self.interface.PartyHealReady()
  2234.  
  2235. def AskSafeboxPassword(self):
  2236. self.interface.AskSafeboxPassword()
  2237.  
  2238. # ITEM_MALL
  2239. def AskMallPassword(self):
  2240. self.interface.AskMallPassword()
  2241.  
  2242. def __ItemMall_Open(self):
  2243. self.interface.OpenItemMall();
  2244.  
  2245. def CommandCloseMall(self):
  2246. self.interface.CommandCloseMall()
  2247. # END_OF_ITEM_MALL
  2248.  
  2249. def AttrTransferMessage(self):
  2250. snd.PlaySound("sound/ui/make_soket.wav")
  2251. self.PopupMessage(localeInfo.COMB_ALERT)
  2252.  
  2253. def RefineSuceededMessage(self):
  2254. snd.PlaySound("sound/ui/make_soket.wav")
  2255. self.PopupMessage(localeInfo.REFINE_SUCCESS)
  2256.  
  2257. def RefineFailedMessage(self):
  2258. snd.PlaySound("sound/ui/jaeryun_fail.wav")
  2259. self.PopupMessage(localeInfo.REFINE_FAILURE)
  2260.  
  2261. def CommandCloseSafebox(self):
  2262. self.interface.CommandCloseSafebox()
  2263.  
  2264. # PRIVATE_SHOP_PRICE_LIST
  2265. if app.ENABLE_CHEQUE_SYSTEM:
  2266. def __PrivateShop_PriceList(self, itemVNum, itemPrice, itemPriceCheque):
  2267. uiPrivateShopBuilder.SetPrivateShopItemPrice(itemVNum, itemPrice, itemPriceCheque)
  2268. # chat.AppendChat(chat.CHAT_TYPE_INFO, 'Teste: '+str(itemVNum)+" "+str(getItemVNum(itemPrice))+" "+str(itemPriceCheque))
  2269. else:
  2270. def __PrivateShop_PriceList(self, itemVNum, itemPrice):
  2271. uiPrivateShopBuilder.SetPrivateShopItemPrice(itemVNum, itemPrice)
  2272. # END_OF_PRIVATE_SHOP_PRICE_LIST
  2273.  
  2274. def SetPetEvolution(self, evo):
  2275. petname = ["Cucciolo", "Selvaggio", "Coraggioso", "Eroico"]
  2276. self.petmain.SetEvolveName(petname[int(evo)])
  2277.  
  2278. def SetPetName(self, name):
  2279. if len(name) > 1 and name != "":
  2280. self.petmini.Show()
  2281. self.petmain.SetName(name)
  2282.  
  2283. def SetPetLevel(self, level):
  2284. self.petmain.SetLevel(level)
  2285.  
  2286. def SetPetDuration(self, dur, durt):
  2287. if int(durt) > 0:
  2288. self.petmini.SetDuration(dur, durt)
  2289. self.petmain.SetDuration(dur, durt)
  2290.  
  2291. ##Pet Ya? Bugu Fixi##
  2292. def SetPetDurationYas(self, dur_yas):
  2293. if int(dur_yas) > 0:
  2294. self.petmain.SetDurationYas(dur_yas)
  2295. ##Pet Ya? Bugu Fixi##
  2296.  
  2297. def SetPetBonus(self, hp, dif, sp):
  2298. self.petmain.SetHp(hp)
  2299. self.petmain.SetDef(dif)
  2300. self.petmain.SetSp(sp)
  2301.  
  2302. def SetPetskill(self, slot, idx, lv):
  2303. if int(lv) > 0:
  2304. self.petmini.SetSkill(slot, idx, lv)
  2305. self.petmain.SetSkill(slot, idx, lv)
  2306. self.affectShower.BINARY_NEW_AddAffect(5400+int(idx),int(constInfo.LASTAFFECT_POINT)+1,int(constInfo.LASTAFFECT_VALUE)+1, 0)
  2307. if int(slot)==0:
  2308. constInfo.SKILL_PET1=5400+int(idx)
  2309. if int(slot)==1:
  2310. constInfo.SKILL_PET2=5400+int(idx)
  2311. if int(slot)==2:
  2312. constInfo.SKILL_PET3=5400+int(idx)
  2313.  
  2314. def SetPetIcon(self, vnum):
  2315. if int(vnum) > 0:
  2316. self.petmini.SetImageSlot(vnum)
  2317. self.petmain.SetImageSlot(vnum)
  2318.  
  2319. def SetPetExp(self, exp, expi, exptot):
  2320. if int(exptot) > 0:
  2321. self.petmini.SetExperience(exp, expi, exptot)
  2322. self.petmain.SetExperience(exp, expi, exptot)
  2323.  
  2324. def PetUnsummon(self):
  2325. self.petmini.SetDefaultInfo()
  2326. self.petmini.Close()
  2327. self.petmain.SetDefaultInfo()
  2328. self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET1),0)
  2329. self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET2),0)
  2330. self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET3),0)
  2331. constInfo.SKILL_PET1 = 0
  2332. constInfo.SKILL_PET2 = 0
  2333. constInfo.SKILL_PET3 = 0
  2334.  
  2335. def OpenPetMainGui(self):
  2336. if self.petmain.IsShow():
  2337. self.petmain.Close()
  2338. else:
  2339. self.petmain.Show()
  2340. self.petmain.SetTop()
  2341.  
  2342. def OpenPetIncubator(self, pet_new = 0):
  2343. import uipetincubatrice
  2344. self.petinc = uipetincubatrice.PetSystemIncubator(pet_new)
  2345. self.petinc.Show()
  2346. self.petinc.SetTop()
  2347.  
  2348. def OpenPetMini(self):
  2349. self.petmini.Show()
  2350. self.petmini.SetTop()
  2351.  
  2352. def OpenPetFeed(self):
  2353.  
  2354. self.feedwind = uipetfeed.PetFeedWindow()
  2355. self.feedwind.Show()
  2356. self.feedwind.SetTop()
  2357.  
  2358. def Gift_Show(self):
  2359. if constInfo.PET_MAIN == 0:
  2360. self.petmain.Show()
  2361. constInfo.PET_MAIN =1
  2362. self.petmain.SetTop()
  2363. else:
  2364. self.petmain.Hide()
  2365. constInfo.PET_MAIN =0
  2366.  
  2367. def __Horse_HideState(self):
  2368. self.affectShower.SetHorseState(0, 0, 0)
  2369.  
  2370. def __Horse_UpdateState(self, level, health, battery):
  2371. self.affectShower.SetHorseState(int(level), int(health), int(battery))
  2372.  
  2373. def __IsXMasMap(self):
  2374. mapDict = ( "metin2_map_n_flame_01",
  2375. "metin2_map_n_desert_01",
  2376. "metin2_map_spiderdungeon",
  2377. "metin2_map_deviltower1", )
  2378.  
  2379. if background.GetCurrentMapName() in mapDict:
  2380. return FALSE
  2381.  
  2382. return TRUE
  2383.  
  2384. def __XMasSnow_Enable(self, mode):
  2385.  
  2386. self.__XMasSong_Enable(mode)
  2387.  
  2388. if "1"==mode:
  2389.  
  2390. if not self.__IsXMasMap():
  2391. return
  2392.  
  2393. print "XMAS_SNOW ON"
  2394. background.EnableSnow(1)
  2395.  
  2396. else:
  2397. print "XMAS_SNOW OFF"
  2398. background.EnableSnow(0)
  2399.  
  2400. def __XMasBoom_Enable(self, mode):
  2401. if "1"==mode:
  2402.  
  2403. if not self.__IsXMasMap():
  2404. return
  2405.  
  2406. print "XMAS_BOOM ON"
  2407. self.__DayMode_Update("dark")
  2408. self.enableXMasBoom = TRUE
  2409. self.startTimeXMasBoom = app.GetTime()
  2410. else:
  2411. print "XMAS_BOOM OFF"
  2412. self.__DayMode_Update("light")
  2413. self.enableXMasBoom = FALSE
  2414.  
  2415. def __XMasTree_Enable(self, grade):
  2416.  
  2417. print "XMAS_TREE ", grade
  2418. background.SetXMasTree(int(grade))
  2419.  
  2420. def __XMasSong_Enable(self, mode):
  2421. if "1"==mode:
  2422. print "XMAS_SONG ON"
  2423.  
  2424. XMAS_BGM = "xmas.mp3"
  2425.  
  2426. if app.IsExistFile("BGM/" + XMAS_BGM)==1:
  2427. if musicInfo.fieldMusic != "":
  2428. snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2429.  
  2430. musicInfo.fieldMusic=XMAS_BGM
  2431. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2432.  
  2433. else:
  2434. print "XMAS_SONG OFF"
  2435.  
  2436. if musicInfo.fieldMusic != "":
  2437. snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2438.  
  2439. musicInfo.fieldMusic=musicInfo.METIN2THEMA
  2440. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2441.  
  2442. def __RestartDialog_Close(self):
  2443. self.interface.CloseRestartDialog()
  2444.  
  2445. def __Console_Enable(self):
  2446. constInfo.CONSOLE_ENABLE = TRUE
  2447. self.consoleEnable = TRUE
  2448. app.EnableSpecialCameraMode()
  2449. ui.EnablePaste(TRUE)
  2450.  
  2451. ## PrivateShop
  2452. def __PrivateShop_Open(self):
  2453. self.interface.OpenPrivateShopInputNameDialog()
  2454.  
  2455. def BINARY_PrivateShop_Appear(self, vid, text):
  2456. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_PLAYER):
  2457. self.interface.AppearPrivateShop(vid, text)
  2458.  
  2459. def BINARY_PrivateShop_Disappear(self, vid):
  2460. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_PLAYER):
  2461. self.interface.DisappearPrivateShop(vid)
  2462.  
  2463. # OfflineShop
  2464. def __OfflineShop_Open(self):
  2465. self.interface.OpenOfflineShopInputNameDialog()
  2466.  
  2467. def BINARY_OfflineShop_Appear(self, vid, text):
  2468. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_NPC):
  2469. self.interface.AppearOfflineShop(vid, text)
  2470.  
  2471. def BINARY_OfflineShop_Disappear(self, vid):
  2472. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_NPC):
  2473. self.interface.DisappearOfflineShop(vid)
  2474.  
  2475. ## DayMode
  2476. def __PRESERVE_DayMode_Update(self, mode):
  2477. if "light"==mode:
  2478. background.SetEnvironmentData(0)
  2479. elif "dark"==mode:
  2480.  
  2481. if not self.__IsXMasMap():
  2482. return
  2483.  
  2484. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2485. background.SetEnvironmentData(1)
  2486.  
  2487. def __DayMode_Update(self, mode):
  2488. if "light"==mode:
  2489. self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
  2490. elif "dark"==mode:
  2491.  
  2492. if not self.__IsXMasMap():
  2493. return
  2494.  
  2495. self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
  2496.  
  2497. def __DayMode_OnCompleteChangeToLight(self):
  2498. background.SetEnvironmentData(0)
  2499. self.curtain.FadeIn()
  2500.  
  2501. def __DayMode_OnCompleteChangeToDark(self):
  2502. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2503. background.SetEnvironmentData(1)
  2504. self.curtain.FadeIn()
  2505.  
  2506. ## XMasBoom
  2507. def __XMasBoom_Update(self):
  2508.  
  2509. self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
  2510. if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
  2511. return
  2512.  
  2513. boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
  2514. boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
  2515.  
  2516. if app.GetTime() - self.startTimeXMasBoom > boomTime:
  2517.  
  2518. self.indexXMasBoom += 1
  2519.  
  2520. for i in xrange(boomCount):
  2521. self.__XMasBoom_Boom()
  2522.  
  2523. def __XMasBoom_Boom(self):
  2524. x, y, z = player.GetMainCharacterPosition()
  2525. randX = app.GetRandom(-150, 150)
  2526. randY = app.GetRandom(-150, 150)
  2527.  
  2528. snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
  2529.  
  2530. def __PartyRequestQuestion(self, vid):
  2531. vid = int(vid)
  2532. partyRequestQuestionDialog = uiCommon.QuestionDialog()
  2533. partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + localeInfo.PARTY_DO_YOU_ACCEPT)
  2534. partyRequestQuestionDialog.SetAcceptText(localeInfo.UI_ACCEPT)
  2535. partyRequestQuestionDialog.SetCancelText(localeInfo.UI_DENY)
  2536. partyRequestQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.__AnswerPartyRequest(arg))
  2537. partyRequestQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.__AnswerPartyRequest(arg))
  2538. partyRequestQuestionDialog.Open()
  2539. partyRequestQuestionDialog.vid = vid
  2540. self.partyRequestQuestionDialog = partyRequestQuestionDialog
  2541.  
  2542. def __AnswerPartyRequest(self, answer):
  2543. if not self.partyRequestQuestionDialog:
  2544. return
  2545.  
  2546. vid = self.partyRequestQuestionDialog.vid
  2547.  
  2548. if answer:
  2549. net.SendChatPacket("/party_request_accept " + str(vid))
  2550. else:
  2551. net.SendChatPacket("/party_request_deny " + str(vid))
  2552.  
  2553. self.partyRequestQuestionDialog.Close()
  2554. self.partyRequestQuestionDialog = None
  2555.  
  2556. def __PartyRequestDenied(self):
  2557. self.PopupMessage(localeInfo.PARTY_REQUEST_DENIED)
  2558.  
  2559. def __EnableTestServerFlag(self):
  2560. app.EnableTestServerFlag()
  2561.  
  2562. def __InGameShop_Show(self, url):
  2563. if constInfo.IN_GAME_SHOP_ENABLE:
  2564. self.interface.OpenWebWindow(url)
  2565.  
  2566. # WEDDING
  2567. def __LoginLover(self):
  2568. if self.interface.wndMessenger:
  2569. self.interface.wndMessenger.OnLoginLover()
  2570.  
  2571. def __LogoutLover(self):
  2572. if self.interface.wndMessenger:
  2573. self.interface.wndMessenger.OnLogoutLover()
  2574. if self.affectShower:
  2575. self.affectShower.HideLoverState()
  2576.  
  2577. def __LoverNear(self):
  2578. if self.affectShower:
  2579. self.affectShower.ShowLoverState()
  2580.  
  2581. def __LoverFar(self):
  2582. if self.affectShower:
  2583. self.affectShower.HideLoverState()
  2584.  
  2585. def __LoverDivorce(self):
  2586. if self.interface.wndMessenger:
  2587. self.interface.wndMessenger.ClearLoverInfo()
  2588. if self.affectShower:
  2589. self.affectShower.ClearLoverState()
  2590.  
  2591. def __PlayMusic(self, flag, filename):
  2592. flag = int(flag)
  2593. if flag:
  2594. snd.FadeOutAllMusic()
  2595. musicInfo.SaveLastPlayFieldMusic()
  2596. snd.FadeInMusic("BGM/" + filename)
  2597. else:
  2598. snd.FadeOutAllMusic()
  2599. musicInfo.LoadLastPlayFieldMusic()
  2600. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2601.  
  2602. def OpenDragonLairRanking(self):
  2603. if self.interface:
  2604. self.interface.OpenDragonLairRanking()
  2605.  
  2606. def AddDragonLairRanking(self, data):
  2607. if self.interface:
  2608. line = int(data.split("#")[1])
  2609. name = str(data.split("#")[2])
  2610. empire = int(data.split("#")[3])
  2611. killcount = int(data.split("#")[4])
  2612. self.interface.AddDragonLairRanking(line, name, empire, killcount)
  2613.  
  2614. if app.ENABLE_MELEY_LAIR_DUNGEON:
  2615. def OpenMeleyRanking(self):
  2616. if self.interface:
  2617. self.interface.OpenMeleyRanking()
  2618.  
  2619. def AddRankMeleyRanking(self, data):
  2620. if self.interface:
  2621. line = int(data.split("#")[1])
  2622. name = str(data.split("#")[2])
  2623. members = int(data.split("#")[3])
  2624. seconds = int(data.split("#")[4])
  2625. minutes = seconds // 60
  2626. seconds %= 60
  2627. if seconds > 0:
  2628. time = localeInfo.TIME_MIN_SEC % (minutes, seconds)
  2629. else:
  2630. time = localeInfo.TIME_MIN % (minutes)
  2631.  
  2632. self.interface.RankMeleyRanking(line, name, members, time)
  2633.  
  2634. if app.ENABLE_SASH_SYSTEM:
  2635. def ActSash(self, iAct, bWindow):
  2636. if self.interface:
  2637. self.interface.ActSash(iAct, bWindow)
  2638.  
  2639. def AlertSash(self, bWindow):
  2640. snd.PlaySound("sound/ui/make_soket.wav")
  2641. if bWindow:
  2642. self.PopupMessage(localeInfo.SASH_DEL_SERVEITEM)
  2643. else:
  2644. self.PopupMessage(localeInfo.SASH_DEL_ABSORDITEM)
  2645.  
  2646. if app.ENABLE_CHANGELOOK_SYSTEM:
  2647. def ActChangeLook(self, iAct):
  2648. if self.interface:
  2649. self.interface.ActChangeLook(iAct)
  2650.  
  2651. def AlertChangeLook(self):
  2652. self.PopupMessage(localeInfo.CHANGE_LOOK_DEL_ITEM)
  2653. # END_OF_WEDDING
  2654.  
  2655. if app.ENABLE_SEND_TARGET_INFO:
  2656. def BINARY_AddTargetMonsterDropInfo(self, raceNum, itemVnum, itemCount):
  2657. if not raceNum in constInfo.MONSTER_INFO_DATA:
  2658. constInfo.MONSTER_INFO_DATA.update({raceNum : {}})
  2659. constInfo.MONSTER_INFO_DATA[raceNum].update({"items" : []})
  2660. curList = constInfo.MONSTER_INFO_DATA[raceNum]["items"]
  2661.  
  2662. isUpgradeable = False
  2663. isMetin = False
  2664. item.SelectItem(itemVnum)
  2665. if item.GetItemType() == item.ITEM_TYPE_WEAPON or item.GetItemType() == item.ITEM_TYPE_ARMOR:
  2666. isUpgradeable = True
  2667. elif item.GetItemType() == item.ITEM_TYPE_METIN:
  2668. isMetin = True
  2669.  
  2670. for curItem in curList:
  2671. if isUpgradeable:
  2672. if curItem.has_key("vnum_list") and curItem["vnum_list"][0] / 10 * 10 == itemVnum / 10 * 10:
  2673. if not (itemVnum in curItem["vnum_list"]):
  2674. curItem["vnum_list"].append(itemVnum)
  2675. return
  2676. elif isMetin:
  2677. if curItem.has_key("vnum_list"):
  2678. baseVnum = curItem["vnum_list"][0]
  2679. if curItem.has_key("vnum_list") and (baseVnum - baseVnum%1000) == (itemVnum - itemVnum%1000):
  2680. if not (itemVnum in curItem["vnum_list"]):
  2681. curItem["vnum_list"].append(itemVnum)
  2682. return
  2683. else:
  2684. if curItem.has_key("vnum") and curItem["vnum"] == itemVnum and curItem["count"] == itemCount:
  2685. return
  2686.  
  2687. if isUpgradeable or isMetin:
  2688. curList.append({"vnum_list":[itemVnum], "count":itemCount})
  2689. else:
  2690. curList.append({"vnum":itemVnum, "count":itemCount})
  2691.  
  2692. def BINARY_RefreshTargetMonsterDropInfo(self, raceNum):
  2693. self.targetBoard.RefreshMonsterInfoBoard()
  2694.  
  2695. def BINARY_Update_Coins(self, coins):
  2696. constInfo.ep =(int(coins))
  2697.  
  2698. #Inizio cambia equip
  2699. def __HizliEkipman(self):
  2700. import uifastequip
  2701. if 0==interfaceModule.hizliekipman:
  2702. interfaceModule.hizliekipman = 1
  2703. self.uuifastequipDlg = uifastequip.changeequip()
  2704. self.uuifastequipDlg.Show()
  2705. else:
  2706. interfaceModule.hizliekipman = 0
  2707. self.uuifastequipDlg = uifastequip.changeequip()
  2708. self.uuifastequipDlg.Hide()
  2709. #Fine cambia equip
  2710.  
  2711. def __toggleSwitchbot(self):
  2712. if self.switchbot.bot_shown == 1:
  2713. self.switchbot.Hide()
  2714. else:
  2715. self.switchbot.Show()
  2716.  
  2717. def __EnablePickUpItem(self):
  2718. global CHECK_ACTIVE_PICKUP
  2719. if CHECK_ACTIVE_PICKUP == 0:
  2720. CHECK_ACTIVE_PICKUP = 1
  2721. constInfo.ENABLE_PICKUP = 1
  2722. chat.AppendChat(chat.CHAT_TYPE_NOTICE, "|cFF00ff33[BetWeenMt2]Auto-Pickup attivato.|h|cFFFFFFFF|h")
  2723. else:
  2724. CHECK_ACTIVE_PICKUP = 0
  2725. constInfo.ENABLE_PICKUP = 0
  2726. chat.AppendChat(chat.CHAT_TYPE_NOTICE, "|cFFDC143C[BetWeenMt2]Auto-Pickup Disattivato.|h|cFFFFFFFF|h")
Advertisement
Add Comment
Please, Sign In to add comment