Guest User

game.py

a guest
Dec 1st, 2023
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 108.88 KB | None | 0 0
  1. if __USE_DYNAMIC_MODULE__:
  2. import pyapi
  3.  
  4. app = __import__(pyapi.GetModuleName("app"))
  5. chr = __import__(pyapi.GetModuleName("chr"))
  6. chrmgr = __import__(pyapi.GetModuleName("chrmgr"))
  7. player = __import__(pyapi.GetModuleName("player"))
  8. net = __import__(pyapi.GetModuleName("net"))
  9. import marek38
  10. import os
  11. import dbg
  12. import grp
  13. import item
  14. import background
  15. import snd
  16. import chat
  17. import textTail
  18. import snd
  19. import effect
  20. import wndMgr
  21. import fly
  22. import systemSetting
  23. import quest
  24. import guild
  25. import skill
  26. import messenger
  27. import constinfo
  28. import exchange
  29. import ime
  30.  
  31. import ui
  32. import uicommon
  33. #import uiphasecurtain
  34. #import uimapnameshower
  35. import uiaffectshower
  36. import uiplayergauge
  37. import uicharacter
  38. import uitarget
  39.  
  40.  
  41. # PRIVATE_SHOP_PRICE_LIST
  42. import uiprivateshopbuilder
  43. # END_OF_PRIVATE_SHOP_PRICE_LIST
  44.  
  45. import mousemodule
  46. import consolemodule
  47. import playersettingmodule
  48. import interfacemodule
  49.  
  50. import musicinfo
  51. import debuginfo
  52. import stringcommander
  53. from switchbot import Bot
  54. from _weakref import proxy
  55. import localeinfo
  56.  
  57. if app.ENABLE_PVP_ADVANCED:
  58. import constinfo as pvp
  59. import uicommon as message
  60. import uiduel
  61.  
  62. # TEXTTAIL_LIVINGTIME_CONTROL
  63. #if localeinfo.IsJAPAN():
  64. # app.SetTextTailLivingTime(8.0)
  65. # END_OF_TEXTTAIL_LIVINGTIME_CONTROL
  66.  
  67. # SCREENSHOT_CWDSAVE
  68. if app.__ENABLE_NEW_OFFLINESHOP__:
  69. import uiofflineshop
  70. import offlineshop
  71.  
  72. if app.NEW_PET_SYSTEM:
  73. import uipetsystem
  74.  
  75. if app.ENABLE_CHRISTMAS_WHEEL_OF_DESTINY:
  76. import uiwheel
  77.  
  78. SCREENSHOT_CWDSAVE = False
  79. SCREENSHOT_DIR = None
  80.  
  81. if localeinfo.IsEUROPE():
  82. SCREENSHOT_CWDSAVE = True
  83.  
  84. if localeinfo.IsCIBN10():
  85. SCREENSHOT_CWDSAVE = False
  86. SCREENSHOT_DIR = "YT2W"
  87.  
  88. cameraDistance = 1550.0
  89. cameraPitch = 27.0
  90. cameraRotation = 0.0
  91. cameraHeight = 100.0
  92. testAlignment = 0
  93.  
  94. class GameWindow(ui.ScriptWindow):
  95. def __init__(self, stream):
  96. ui.ScriptWindow.__init__(self, "GAME")
  97. self.SetWindowName("game")
  98. net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)
  99. player.SetGameWindow(self)
  100. self.quickSlotPageIndex = 0
  101. self.lastPKModeSendedTime = 0
  102. self.pressNumber = None
  103. self.switchbot = Bot()
  104. self.switchbot.Hide()
  105. import dailygift
  106. self.wnddailygift = dailygift.DailyGift()
  107. self.guildWarQuestionDialog = None
  108. self.interface = None
  109. self.targetBoard = None
  110. self.console = None
  111. self.mapNameShower = None
  112. self.affectShower = None
  113. self.playerGauge = None
  114. if app.ENABLE_CHRISTMAS_WHEEL_OF_DESTINY:
  115. self.wheeldestiny = None
  116.  
  117. if app.__ENABLE_NEW_OFFLINESHOP__:
  118. offlineshop.HideShopNames()
  119. self.Offlineshop = uiofflineshop.NewOfflineShopBoard()
  120. self.Offlineshop.Hide()
  121.  
  122. self.stream=stream
  123. self.interface = interfacemodule.Interface()
  124. self.interface.BindGameClass(self)
  125. self.interface.MakeInterface()
  126. self.interface.ShowDefaultWindows()
  127.  
  128. #self.curtain = uiphasecurtain.PhaseCurtain()
  129. #self.curtain.speed = 0.03
  130. #self.curtain.Hide()
  131.  
  132. self.targetBoard = uitarget.TargetBoard()
  133. self.targetBoard.SetWhisperEvent(ui.__mem_func__(self.interface.OpenWhisperDialog))
  134. self.targetBoard.Hide()
  135. if app.NEW_PET_SYSTEM:
  136. self.petmain = uipetsystem.PetSystemMain()
  137. self.petmini = uipetsystem.PetSystemMini()
  138. self.petmini.BindGameClass(self)
  139.  
  140. self.console = consolemodule.ConsoleWindow()
  141. self.console.BindGameClass(self)
  142. self.console.SetConsoleSize(wndMgr.GetScreenWidth(), 200)
  143. self.console.Hide()
  144.  
  145. #self.mapNameShower = uimapnameshower.MapNameShower()
  146. self.affectShower = uiaffectshower.AffectShower()
  147.  
  148. if app.ENABLE_PVP_ADVANCED:
  149. self.wndDuelGui = uiduel.Initializate()
  150. self.wndDuelLive = uiduel.WindowLiveInformations()
  151.  
  152. self.playerGauge = uiplayergauge.PlayerGauge(self)
  153. self.playerGauge.Hide()
  154. #wj 2014.1.2. ESC키를 누를 시 우선적으로 DropQuestionDialog를 끄도록 만들었다. 하지만 처음에 itemDropQuestionDialog가 선언되어 있지 않아 ERROR가 발생하여 init에서 선언과 동시에 초기화 시킴.
  155. if app.ENABLE_CHRISTMAS_WHEEL_OF_DESTINY:
  156. self.wheeldestiny = uiwheel.WheelOfDestiny()
  157.  
  158. self.itemDropQuestionDialog = None
  159. self.__SetQuickSlotMode()
  160.  
  161. self.__ServerCommand_Build()
  162. self.__ProcessPreservedServerCommand()
  163. if app.INGAME_WIKI:
  164. import ingamewiki
  165. self.wndWiki = ingamewiki.InGameWiki()
  166.  
  167. if app.ENABLE_BIOLOGIST_UI:
  168. self.biologistAlert = uicommon.PopupDialog()
  169. self.biologistAlert.SetText(localeinfo.BIOLOGIST_WAIT_FINISH)
  170.  
  171. def __del__(self):
  172. player.SetGameWindow(0)
  173. net.ClearPhaseWindow(net.PHASE_WINDOW_GAME, self)
  174. ui.ScriptWindow.__del__(self)
  175.  
  176. def Open(self):
  177. app.SetFrameSkip(1)
  178.  
  179. self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  180.  
  181. self.quickSlotPageIndex = 0
  182. self.PickingCharacterIndex = -1
  183. self.PickingItemIndex = -1
  184. self.consoleEnable = False
  185. self.isShowDebugInfo = False
  186. self.ShowNameFlag = False
  187.  
  188. self.enableXMasBoom = False
  189. self.startTimeXMasBoom = 0.0
  190. self.indexXMasBoom = 0
  191.  
  192. global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  193. if app.ENABLE_SAVECAMERA_PREFERENCES:
  194. import systemSetting
  195. app.SetCamera(systemSetting.GetCameraHeight(), cameraPitch, cameraRotation, cameraHeight)
  196. else:
  197. app.SetCamera(cameraDistance, cameraPitch, cameraRotation, cameraHeight)
  198.  
  199. if app.ENABLE_SAVECAMERA_PREFERENCES:
  200. constinfo.SET_CAMERA_MAX_DISTANCE_INDEX(systemSetting.GetCameraType())
  201.  
  202. constinfo.SET_DEFAULT_CAMERA_MAX_DISTANCE()
  203. constinfo.SET_DEFAULT_CHRNAME_COLOR()
  204. constinfo.SET_DEFAULT_FOG_LEVEL()
  205. constinfo.SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE()
  206. constinfo.SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS()
  207. constinfo.SET_DEFAULT_USE_SKILL_EFFECT_ENABLE()
  208.  
  209. # TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  210. constinfo.SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE()
  211. # END_OF_TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  212.  
  213. import event
  214. event.SetLeftTimeString(localeinfo.UI_LEFT_TIME)
  215.  
  216. textTail.EnablePKTitle(constinfo.PVPMODE_ENABLE)
  217.  
  218. if constinfo.PVPMODE_TEST_ENABLE:
  219. self.testPKMode = ui.TextLine()
  220. self.testPKMode.SetFontName(localeinfo.UI_DEF_FONT)
  221. self.testPKMode.SetPosition(0, 15)
  222. self.testPKMode.SetWindowHorizontalAlignCenter()
  223. self.testPKMode.SetHorizontalAlignCenter()
  224. self.testPKMode.SetFeather()
  225. self.testPKMode.SetOutline()
  226. self.testPKMode.Show()
  227.  
  228. self.testAlignment = ui.TextLine()
  229. self.testAlignment.SetFontName(localeinfo.UI_DEF_FONT)
  230. self.testAlignment.SetPosition(0, 35)
  231. self.testAlignment.SetWindowHorizontalAlignCenter()
  232. self.testAlignment.SetHorizontalAlignCenter()
  233. self.testAlignment.SetFeather()
  234. self.testAlignment.SetOutline()
  235. self.testAlignment.Show()
  236.  
  237. self.__BuildKeyDict()
  238. self.__BuildDebugInfo()
  239.  
  240. # PRIVATE_SHOP_PRICE_LIST
  241. uiprivateshopbuilder.Clear()
  242. # END_OF_PRIVATE_SHOP_PRICE_LIST
  243.  
  244. # UNKNOWN_UPDATE
  245. exchange.InitTrading()
  246. # END_OF_UNKNOWN_UPDATE
  247.  
  248.  
  249. ## Sound
  250. snd.SetMusicVolume(systemSetting.GetMusicVolume()*net.GetFieldMusicVolume())
  251. snd.SetSoundVolume(systemSetting.GetSoundVolume())
  252.  
  253. netFieldMusicFileName = net.GetFieldMusicFileName()
  254. if netFieldMusicFileName:
  255. snd.FadeInMusic("BGM/" + netFieldMusicFileName)
  256. elif musicinfo.fieldMusic != "":
  257. snd.FadeInMusic("BGM/" + musicinfo.fieldMusic)
  258.  
  259. self.__SetQuickSlotMode()
  260. self.__SelectQuickPage(self.quickSlotPageIndex)
  261.  
  262. self.SetFocus()
  263. self.Show()
  264. app.ShowCursor()
  265. net.SendEnterGamePacket()
  266.  
  267. # START_GAME_ERROR_EXIT
  268. try:
  269. self.StartGame()
  270. except:
  271. import exception
  272. exception.Abort("GameWindow.Open")
  273. # END_OF_START_GAME_ERROR_EXIT
  274.  
  275. # NPC가 큐브시스템으로 만들 수 있는 아이템들의 목록을 캐싱
  276. # ex) cubeInformation[20383] = [ {"rewordVNUM": 72723, "rewordCount": 1, "materialInfo": "101,1&102,2", "price": 999 }, ... ]
  277. self.cubeInformation = {}
  278. self.currentCubeNPC = 0
  279.  
  280. def Close(self):
  281. self.Hide()
  282. global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  283. (cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
  284.  
  285. if musicinfo.fieldMusic != "":
  286. snd.FadeOutMusic("BGM/"+ musicinfo.fieldMusic)
  287.  
  288. self.onPressKeyDict = None
  289. self.onClickKeyDict = None
  290.  
  291. chat.Close()
  292. snd.StopAllSound()
  293. grp.InitScreenEffect()
  294. chr.Destroy()
  295. textTail.Clear()
  296. quest.Clear()
  297. background.Destroy()
  298. guild.Destroy()
  299. messenger.Destroy()
  300. skill.ClearSkillData()
  301. wndMgr.Unlock()
  302. mousemodule.mouseController.DeattachObject()
  303.  
  304. if self.guildWarQuestionDialog:
  305. self.guildWarQuestionDialog.Close()
  306.  
  307. self.guildNameBoard = None
  308. self.partyRequestQuestionDialog = None
  309. self.partyInviteQuestionDialog = None
  310. self.guildInviteQuestionDialog = None
  311. self.guildWarQuestionDialog = None
  312. self.messengerAddFriendQuestion = None
  313. if app.INGAME_WIKI:
  314. if self.wndWiki:
  315. self.wndWiki.Hide()
  316. self.wndWiki = None
  317.  
  318. if app.__ENABLE_NEW_OFFLINESHOP__:
  319. if self.Offlineshop:
  320. self.Offlineshop.Destroy()
  321. self.Offlineshop = None
  322.  
  323. # UNKNOWN_UPDATE
  324. self.itemDropQuestionDialog = None
  325. # END_OF_UNKNOWN_UPDATE
  326.  
  327. # QUEST_CONFIRM
  328. self.confirmDialog = None
  329. # END_OF_QUEST_CONFIRM
  330.  
  331. self.PrintCoord = None
  332. self.FrameRate = None
  333. self.Pitch = None
  334. self.Splat = None
  335. self.TextureNum = None
  336. self.ObjectNum = None
  337. self.ViewDistance = None
  338. self.PrintMousePos = None
  339.  
  340. self.ClearDictionary()
  341. if app.NEW_PET_SYSTEM:
  342. self.petmain.Close()
  343. self.petmini.Close()
  344.  
  345. self.playerGauge = None
  346. #self.mapNameShower = None
  347. self.affectShower = None
  348.  
  349. if self.console:
  350. self.console.BindGameClass(0)
  351. self.console.Close()
  352. self.console=None
  353.  
  354. if app.ENABLE_PVP_ADVANCED:
  355. if self.wndDuelLive:
  356. self.wndDuelLive.Close()
  357.  
  358. if self.targetBoard:
  359. self.targetBoard.Destroy()
  360. self.targetBoard = None
  361.  
  362. if self.interface:
  363. self.interface.HideAllWindows()
  364. self.interface.Close()
  365. self.interface=None
  366. player.ClearSkillDict()
  367. player.ResetCameraRotation()
  368. if app.INGAME_WIKI:
  369. if self.wndWiki:
  370. del self.wndWiki
  371. self.self.wndWiki = None
  372.  
  373. if app.ENABLE_BIOLOGIST_UI:
  374. if self.biologistAlert:
  375. self.biologistAlert.Destroy()
  376. self.biologistAlert = None
  377.  
  378. self.KillFocus()
  379. app.HideCursor()
  380.  
  381. print "---------------------------------------------------------------------------- CLOSE GAME WINDOW"
  382.  
  383. if app.ENABLE_RANKING:
  384. def OpenRanking(self):
  385. if self.interface:
  386. self.interface.OpenRanking()
  387.  
  388. def RankingClearData(self):
  389. if self.interface:
  390. self.interface.RankingClearData()
  391.  
  392. def RankingAddRank(self, position, level, points, name, realPosition):
  393. if self.interface:
  394. self.interface.RankingAddRank(position, level, points, name, realPosition)
  395.  
  396. def RankingRefresh(self):
  397. if self.interface:
  398. self.interface.RankingRefresh()
  399.  
  400. if app.ENABLE_RUNE_SYSTEM:
  401. def RuneStatus(self, flag):
  402. if self.interface:
  403. self.interface.RuneStatus(int(flag))
  404.  
  405. def RuneAffect(self, flag):
  406. if self.interface:
  407. self.interface.RuneAffect(int(flag))
  408.  
  409. def __BuildKeyDict(self):
  410. onPressKeyDict = {}
  411. onPressKeyDict[app.DIK_1] = lambda : self.__PressNumKey(1)
  412. onPressKeyDict[app.DIK_2] = lambda : self.__PressNumKey(2)
  413. onPressKeyDict[app.DIK_3] = lambda : self.__PressNumKey(3)
  414. onPressKeyDict[app.DIK_4] = lambda : self.__PressNumKey(4)
  415. onPressKeyDict[app.DIK_5] = lambda : self.__PressNumKey(5)
  416. onPressKeyDict[app.DIK_6] = lambda : self.__PressNumKey(6)
  417. onPressKeyDict[app.DIK_7] = lambda : self.__PressNumKey(7)
  418. onPressKeyDict[app.DIK_8] = lambda : self.__PressNumKey(8)
  419. onPressKeyDict[app.DIK_9] = lambda : self.__PressNumKey(9)
  420. onPressKeyDict[app.DIK_F1] = lambda : self.__PressQuickSlot(4)
  421. onPressKeyDict[app.DIK_F2] = lambda : self.__PressQuickSlot(5)
  422. onPressKeyDict[app.DIK_F3] = lambda : self.__PressQuickSlot(6)
  423. onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7)
  424. onPressKeyDict[app.DIK_F12] = lambda : self.OpenRanking()
  425. #if app.ADVANCED_GUILD_INFO:
  426. #onPressKeyDict[app.DIK_F6] = lambda : self.GuildWar_OpenRank()
  427. if app.ENABLE_DUNGEON_INFO_SYSTEM:
  428. onPressKeyDict[app.DIK_F7] = lambda : self.OpenDungeoninfo()
  429. if app.ENABLE_BATTLE_PASS:
  430. onPressKeyDict[app.DIK_F8] = lambda : self.OpenBattlePassWindow()
  431. #if app.ENABLE_WHISPER_ADMIN_SYSTEM:
  432. #onPressKeyDict[app.DIK_F9] = lambda : self.OpenWhisperSystem()
  433. #onPressKeyDict[app.DIK_F5] = lambda : self.OpenTeleporter()
  434. if app.ENABLE_PVP_ADVANCED:
  435. onPressKeyDict[app.DIK_F10] = lambda : self.ClickPvpEquipment()
  436. onPressKeyDict[app.DIK_F11] = lambda : self.OpenSavepoint()
  437. if app.ENABLE_EXTRA_INVENTORY:
  438. onPressKeyDict[app.DIK_K] = lambda : self.OpenExtrainventory()
  439.  
  440. onPressKeyDict[app.DIK_LALT] = lambda : self.ShowName()
  441. onPressKeyDict[app.DIK_LCONTROL] = lambda : self.ShowMouseImage()
  442. onPressKeyDict[app.DIK_SYSRQ] = lambda : self.SaveScreen()
  443. onPressKeyDict[app.DIK_SPACE] = lambda : self.StartAttack()
  444.  
  445. #캐릭터 이동키
  446. onPressKeyDict[app.DIK_UP] = lambda : self.MoveUp()
  447. onPressKeyDict[app.DIK_DOWN] = lambda : self.MoveDown()
  448. onPressKeyDict[app.DIK_LEFT] = lambda : self.MoveLeft()
  449. onPressKeyDict[app.DIK_RIGHT] = lambda : self.MoveRight()
  450. onPressKeyDict[app.DIK_W] = lambda : self.MoveUp()
  451. onPressKeyDict[app.DIK_S] = lambda : self.MoveDown()
  452. onPressKeyDict[app.DIK_A] = lambda : self.MoveLeft()
  453. onPressKeyDict[app.DIK_D] = lambda : self.MoveRight()
  454.  
  455. onPressKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
  456. onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
  457. #onPressKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  458. onPressKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
  459. onPressKeyDict[app.DIK_G] = self.__PressGKey
  460. onPressKeyDict[app.DIK_Q] = self.__PressQKey
  461.  
  462. onPressKeyDict[app.DIK_NUMPAD9] = lambda: app.MovieResetCamera()
  463. onPressKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
  464. onPressKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)
  465. onPressKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)
  466. onPressKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
  467. onPressKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
  468. onPressKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
  469. onPressKeyDict[app.DIK_GRAVE] = lambda : self.PickUpItem()
  470. onPressKeyDict[app.DIK_Z] = lambda : self.PickUpItem()
  471. onPressKeyDict[app.DIK_C] = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
  472. onPressKeyDict[app.DIK_V] = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
  473. #onPressKeyDict[app.DIK_B] = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
  474. onPressKeyDict[app.DIK_N] = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
  475. onPressKeyDict[app.DIK_I] = lambda : self.interface.ToggleInventoryWindow()
  476. #onPressKeyDict[app.DIK_O] = lambda : self.interface.ToggleDragonSoulWindowWithNoInfo()
  477. onPressKeyDict[app.DIK_M] = lambda : self.interface.PressMKey()
  478. onPressKeyDict[app.DIK_ADD] = lambda : self.interface.MiniMapScaleUp()
  479. onPressKeyDict[app.DIK_SUBTRACT] = lambda : self.interface.MiniMapScaleDown()
  480. onPressKeyDict[app.DIK_L] = lambda : self.interface.ToggleChatLogWindow()
  481. #onPressKeyDict[app.DIK_COMMA] = lambda : self.ShowConsole() # "`" key
  482. onPressKeyDict[app.DIK_LSHIFT] = lambda : self.__SetQuickPageMode()
  483.  
  484. #onPressKeyDict[app.DIK_J] = lambda : self.__PressJKey()
  485. onPressKeyDict[app.DIK_H] = lambda : self.__PressHKey()
  486. onPressKeyDict[app.DIK_B] = lambda : self.__PressBKey()
  487. onPressKeyDict[app.DIK_F] = lambda : self.__PressFKey()
  488. #if app.__ENABLE_NEW_OFFLINESHOP__:
  489. #onPressKeyDict[app.DIK_Y] = lambda : self.__PressYKey()
  490. #if app.NEW_PET_SYSTEM:
  491. #onPressKeyDict[app.DIK_P] = lambda: self.OpenPetMainGui()
  492.  
  493. # CUBE_TEST
  494. [app.DIK_F5] = lambda : self.__toggleSwitchbot()
  495. # CUBE_TEST_END
  496. self.onPressKeyDict = onPressKeyDict
  497.  
  498. onClickKeyDict = {}
  499. onClickKeyDict[app.DIK_UP] = lambda : self.StopUp()
  500. onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown()
  501. onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft()
  502. onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight()
  503. onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack()
  504.  
  505. onClickKeyDict[app.DIK_W] = lambda : self.StopUp()
  506. onClickKeyDict[app.DIK_S] = lambda : self.StopDown()
  507. onClickKeyDict[app.DIK_A] = lambda : self.StopLeft()
  508. onClickKeyDict[app.DIK_D] = lambda : self.StopRight()
  509. onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP)
  510. onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP)
  511. onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  512. onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  513. onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP)
  514. onClickKeyDict[app.DIK_G] = lambda: self.__ReleaseGKey()
  515. onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  516. onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  517. onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  518. onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  519. onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  520. onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  521. onClickKeyDict[app.DIK_LALT] = lambda: self.HideName()
  522. onClickKeyDict[app.DIK_LCONTROL] = lambda: self.HideMouseImage()
  523. onClickKeyDict[app.DIK_LSHIFT] = lambda: self.__SetQuickSlotMode()
  524. onPressKeyDict[app.DIK_F5]= lambda : self.__toggleSwitchbot()
  525. #if constinfo.PVPMODE_ACCELKEY_ENABLE:
  526. # onClickKeyDict[app.DIK_B] = lambda: self.ChangePKMode()
  527.  
  528. self.onClickKeyDict=onClickKeyDict
  529.  
  530. if app.__ENABLE_NEW_OFFLINESHOP__:
  531. def __PressYKey(self):
  532. if self.Offlineshop:
  533. if not self.Offlineshop.IsShow():
  534. self.Offlineshop.Open()
  535. else:
  536. self.Offlineshop.Close()
  537.  
  538. if app.ENABLE_NEW_FISHING_SYSTEM:
  539. def OnFishingStart(self, have, need):
  540. if self.interface:
  541. self.interface.OnFishingStart(have, need)
  542.  
  543. def OnFishingStop(self):
  544. if self.interface:
  545. self.interface.OnFishingStop()
  546.  
  547. def OnFishingCatch(self, have):
  548. if self.interface:
  549. self.interface.OnFishingCatch(have)
  550.  
  551. def OnFishingCatchFailed(self):
  552. if self.interface:
  553. self.interface.OnFishingCatchFailed()
  554.  
  555. def __PressNumKey(self,num):
  556. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  557.  
  558. if num >= 1 and num <= 9:
  559. if(chrmgr.IsPossibleEmoticon(-1)):
  560. chrmgr.SetEmoticon(-1,int(num)-1)
  561. net.SendEmoticon(int(num)-1)
  562. else:
  563. if num >= 1 and num <= 4:
  564. self.pressNumber(num-1)
  565.  
  566. def __ClickBKey(self):
  567. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  568. return
  569. else:
  570. if constinfo.PVPMODE_ACCELKEY_ENABLE:
  571. self.ChangePKMode()
  572.  
  573.  
  574. def __PressJKey(self):
  575. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  576. if player.IsMountingHorse():
  577. net.SendChatPacket("/unmount")
  578. else:
  579. #net.SendChatPacket("/user_horse_ride")
  580. if not uiprivateshopbuilder.IsBuildingPrivateShop():
  581. for i in xrange(player.INVENTORY_PAGE_SIZE*player.INVENTORY_PAGE_COUNT):
  582. if player.GetItemIndex(i) in (71114, 71116, 71118, 71120):
  583. net.SendItemUsePacket(i)
  584. break
  585. else:
  586. if self.interface:
  587. self.interface.Rune()
  588.  
  589. def __PressHKey(self):
  590. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  591. net.SendChatPacket("/ride")
  592. else:
  593. if self.interface:
  594. self.interface.ToggleWikiNew()
  595.  
  596. def __PressBKey(self):
  597. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  598. net.SendChatPacket("/user_horse_back")
  599. else:
  600. state = "EMOTICON"
  601. self.interface.ToggleCharacterWindow(state)
  602.  
  603. def __PressFKey(self):
  604. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  605. net.SendChatPacket("/user_horse_feed")
  606. else:
  607. app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  608.  
  609. def __PressGKey(self):
  610. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  611. net.SendChatPacket("/ride")
  612. else:
  613. if self.ShowNameFlag:
  614. self.interface.ToggleGuildWindow()
  615. else:
  616. app.PitchCamera(app.CAMERA_TO_POSITIVE)
  617.  
  618. def __ReleaseGKey(self):
  619. app.PitchCamera(app.CAMERA_STOP)
  620.  
  621. def __PressQKey(self):
  622. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  623. if 0==interfacemodule.IsQBHide:
  624. interfacemodule.IsQBHide = 1
  625. self.interface.HideAllQuestButton()
  626. else:
  627. interfacemodule.IsQBHide = 0
  628. self.interface.ShowAllQuestButton()
  629. else:
  630. app.RotateCamera(app.CAMERA_TO_NEGATIVE)
  631.  
  632. def __SetQuickSlotMode(self):
  633. self.pressNumber=ui.__mem_func__(self.__PressQuickSlot)
  634.  
  635. def __SetQuickPageMode(self):
  636. self.pressNumber=ui.__mem_func__(self.__SelectQuickPage)
  637.  
  638. def __PressQuickSlot(self, localSlotIndex):
  639. if localeinfo.IsARABIC():
  640. if 0 <= localSlotIndex and localSlotIndex < 4:
  641. player.RequestUseLocalQuickSlot(3-localSlotIndex)
  642. else:
  643. player.RequestUseLocalQuickSlot(11-localSlotIndex)
  644. else:
  645. player.RequestUseLocalQuickSlot(localSlotIndex)
  646.  
  647. def __SelectQuickPage(self, pageIndex):
  648. self.quickSlotPageIndex = pageIndex
  649. player.SetQuickPage(pageIndex)
  650.  
  651. def ToggleDebugInfo(self):
  652. self.isShowDebugInfo = not self.isShowDebugInfo
  653.  
  654. if self.isShowDebugInfo:
  655. self.PrintCoord.Show()
  656. self.FrameRate.Show()
  657. self.Pitch.Show()
  658. self.Splat.Show()
  659. self.TextureNum.Show()
  660. self.ObjectNum.Show()
  661. self.ViewDistance.Show()
  662. self.PrintMousePos.Show()
  663. else:
  664. self.PrintCoord.Hide()
  665. self.FrameRate.Hide()
  666. self.Pitch.Hide()
  667. self.Splat.Hide()
  668. self.TextureNum.Hide()
  669. self.ObjectNum.Hide()
  670. self.ViewDistance.Hide()
  671. self.PrintMousePos.Hide()
  672.  
  673. def __BuildDebugInfo(self):
  674. ## Character Position Coordinate
  675. self.PrintCoord = ui.TextLine()
  676. self.PrintCoord.SetFontName(localeinfo.UI_DEF_FONT)
  677. self.PrintCoord.SetPosition(wndMgr.GetScreenWidth() - 270, 0)
  678.  
  679. ## Frame Rate
  680. self.FrameRate = ui.TextLine()
  681. self.FrameRate.SetFontName(localeinfo.UI_DEF_FONT)
  682. self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
  683.  
  684. ## Camera Pitch
  685. self.Pitch = ui.TextLine()
  686. self.Pitch.SetFontName(localeinfo.UI_DEF_FONT)
  687. self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
  688.  
  689. ## Splat
  690. self.Splat = ui.TextLine()
  691. self.Splat.SetFontName(localeinfo.UI_DEF_FONT)
  692. self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
  693.  
  694. ##
  695. self.PrintMousePos = ui.TextLine()
  696. self.PrintMousePos.SetFontName(localeinfo.UI_DEF_FONT)
  697. self.PrintMousePos.SetPosition(wndMgr.GetScreenWidth() - 270, 80)
  698.  
  699. # TextureNum
  700. self.TextureNum = ui.TextLine()
  701. self.TextureNum.SetFontName(localeinfo.UI_DEF_FONT)
  702. self.TextureNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
  703.  
  704. # 오브젝트 그리는 개수
  705. self.ObjectNum = ui.TextLine()
  706. self.ObjectNum.SetFontName(localeinfo.UI_DEF_FONT)
  707. self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 120)
  708.  
  709. # 시야거리
  710. self.ViewDistance = ui.TextLine()
  711. self.ViewDistance.SetFontName(localeinfo.UI_DEF_FONT)
  712. self.ViewDistance.SetPosition(0, 0)
  713.  
  714. def __NotifyError(self, msg):
  715. chat.AppendChat(chat.CHAT_TYPE_INFO, msg)
  716.  
  717. def ChangePKMode(self):
  718.  
  719. if not app.IsPressed(app.DIK_LCONTROL):
  720. return
  721.  
  722. if player.GetStatus(player.LEVEL)<constinfo.PVPMODE_PROTECTED_LEVEL:
  723. self.__NotifyError(localeinfo.OPTION_PVPMODE_PROTECT % (constinfo.PVPMODE_PROTECTED_LEVEL))
  724. return
  725.  
  726. curTime = app.GetTime()
  727. if curTime - self.lastPKModeSendedTime < constinfo.PVPMODE_ACCELKEY_DELAY:
  728. return
  729.  
  730. self.lastPKModeSendedTime = curTime
  731.  
  732. curPKMode = player.GetPKMode()
  733. nextPKMode = curPKMode + 1
  734. if nextPKMode == player.PK_MODE_PROTECT:
  735. if 0 == player.GetGuildID():
  736. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
  737. nextPKMode = 0
  738. else:
  739. nextPKMode = player.PK_MODE_GUILD
  740.  
  741. elif nextPKMode == player.PK_MODE_MAX_NUM:
  742. nextPKMode = 0
  743.  
  744. net.SendChatPacket("/PKMode " + str(nextPKMode))
  745. print "/PKMode " + str(nextPKMode)
  746.  
  747. def OnChangePKMode(self):
  748. try:
  749. self.interface.OnChangePKMode()
  750. except:
  751. pass
  752.  
  753. try:
  754. self.__NotifyError(localeinfo.OPTION_PVPMODE_MESSAGE_DICT[player.GetPKMode()])
  755. except KeyError:
  756. print "UNKNOWN PVPMode[%d]" % (player.GetPKMode())
  757.  
  758. if constinfo.PVPMODE_TEST_ENABLE:
  759. curPKMode = player.GetPKMode()
  760. alignment, grade = chr.testGetPKData()
  761. self.pkModeNameDict = { 0 : "PEACE", 1 : "REVENGE", 2 : "FREE", 3 : "PROTECT", }
  762. self.testPKMode.SetText("Current PK Mode : " + self.pkModeNameDict.get(curPKMode, "UNKNOWN"))
  763. self.testAlignment.SetText("Current Alignment : " + str(alignment) + " (" + localeinfo.TITLE_NAME_LIST[grade] + ")")
  764.  
  765. ###############################################################################################
  766. ###############################################################################################
  767. ## Game Callback Functions
  768.  
  769. # Start
  770. def StartGame(self):
  771. self.RefreshInventory()
  772. self.RefreshEquipment()
  773. self.RefreshCharacter()
  774. self.RefreshSkill()
  775.  
  776. # Refresh
  777. def CheckGameButton(self):
  778. if self.interface:
  779. self.interface.CheckGameButton()
  780.  
  781. def RefreshAlignment(self):
  782. self.interface.RefreshAlignment()
  783.  
  784. def RefreshStatus(self):
  785. self.CheckGameButton()
  786.  
  787. if self.interface:
  788. self.interface.RefreshStatus()
  789.  
  790. if self.playerGauge:
  791. self.playerGauge.RefreshGauge()
  792.  
  793. def RefreshStamina(self):
  794. self.interface.RefreshStamina()
  795.  
  796. def RefreshSkill(self):
  797. self.CheckGameButton()
  798. if self.interface:
  799. self.interface.RefreshSkill()
  800.  
  801. def RefreshQuest(self):
  802. self.interface.RefreshQuest()
  803.  
  804. def RefreshMessenger(self):
  805. self.interface.RefreshMessenger()
  806.  
  807. def RefreshGuildInfoPage(self):
  808. self.interface.RefreshGuildInfoPage()
  809.  
  810. def RefreshGuildBoardPage(self):
  811. self.interface.RefreshGuildBoardPage()
  812.  
  813. def RefreshGuildMemberPage(self):
  814. self.interface.RefreshGuildMemberPage()
  815.  
  816. def RefreshGuildMemberPageGradeComboBox(self):
  817. self.interface.RefreshGuildMemberPageGradeComboBox()
  818.  
  819. def RefreshGuildSkillPage(self):
  820. self.interface.RefreshGuildSkillPage()
  821.  
  822. def RefreshGuildGradePage(self):
  823. self.interface.RefreshGuildGradePage()
  824.  
  825. def RefreshMobile(self):
  826. if self.interface:
  827. self.interface.RefreshMobile()
  828.  
  829. def OnMobileAuthority(self):
  830. self.interface.OnMobileAuthority()
  831.  
  832. def OnBlockMode(self, mode):
  833. self.interface.OnBlockMode(mode)
  834.  
  835. def OpenQuestWindow(self, skin, idx):
  836. self.interface.OpenQuestWindow(skin, idx)
  837.  
  838. def AskGuildName(self):
  839.  
  840. guildNameBoard = uicommon.InputDialog()
  841. guildNameBoard.SetTitle(localeinfo.GUILD_NAME)
  842. guildNameBoard.SetAcceptEvent(ui.__mem_func__(self.ConfirmGuildName))
  843. guildNameBoard.SetCancelEvent(ui.__mem_func__(self.CancelGuildName))
  844. guildNameBoard.Open()
  845.  
  846. self.guildNameBoard = guildNameBoard
  847.  
  848. def ConfirmGuildName(self):
  849. guildName = self.guildNameBoard.GetText()
  850. if not guildName:
  851. return
  852.  
  853. if net.IsInsultIn(guildName):
  854. self.PopupMessage(localeinfo.GUILD_CREATE_ERROR_INSULT_NAME)
  855. return
  856.  
  857. net.SendAnswerMakeGuildPacket(guildName)
  858. self.guildNameBoard.Close()
  859. self.guildNameBoard = None
  860. return True
  861.  
  862. def CancelGuildName(self):
  863. self.guildNameBoard.Close()
  864. self.guildNameBoard = None
  865. return True
  866.  
  867. ## Refine
  868. def PopupMessage(self, msg):
  869. self.stream.popupWindow.Close()
  870. self.stream.popupWindow.Open(msg, 0, localeinfo.UI_OK)
  871.  
  872. def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type=0):
  873. self.interface.OpenRefineDialog(targetItemPos, nextGradeItemVnum, cost, prob, type)
  874.  
  875. def AppendMaterialToRefineDialog(self, vnum, count):
  876. self.interface.AppendMaterialToRefineDialog(vnum, count)
  877.  
  878. def RunUseSkillEvent(self, slotIndex, coolTime):
  879. self.interface.OnUseSkill(slotIndex, coolTime)
  880.  
  881. def ClearAffects(self):
  882. self.affectShower.ClearAffects()
  883.  
  884. def SetAffect(self, affect):
  885. self.affectShower.SetAffect(affect)
  886.  
  887. def ResetAffect(self, affect):
  888. self.affectShower.ResetAffect(affect)
  889.  
  890. # UNKNOWN_UPDATE
  891. def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  892. try:
  893. self.affectShower.BINARY_NEW_AddAffect(type, pointIdx, value, duration)
  894. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  895. self.interface.DragonSoulActivate(type - chr.NEW_AFFECT_DRAGON_SOUL_DECK1)
  896. elif type == chr.NEW_AFFECT_BATTLE_PASS:
  897. self.interface.wndBattlePass.SetBattlePassInfo(value, duration)
  898. self.interface.wndBattlePass.SetInactiveBG(False)
  899. self.interface.wndBattlePass.SetStatus(False)
  900. elif app.ENABLE_DS_SET and type == chr.NEW_AFFECT_DS_SET and self.interface:
  901. self.interface.SetDSSet(value)
  902. except:
  903. pass
  904. #else:
  905. # self.interface.wndBattlePass.SetBattlePassInfo(1, 1)
  906. # self.interface.wndBattlePass.SetInactiveBG(True)
  907.  
  908. # def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  909. # self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  910. # if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  911. # self.interface.DragonSoulDeactivate()
  912.  
  913.  
  914. # END_OF_UNKNOWN_UPDATE
  915.  
  916.  
  917. def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  918. self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  919. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  920. self.interface.DragonSoulDeactivate()
  921. elif type == chr.NEW_AFFECT_BATTLE_PASS:
  922. if self.interface:
  923. if self.interface.wndBattlePass:
  924. self.interface.wndBattlePass.SetInactiveBG(True)
  925. self.interface.wndBattlePass.SetStatus(True)
  926. elif app.ENABLE_DS_SET and type == chr.NEW_AFFECT_DS_SET and self.interface:
  927. self.interface.SetDSSet(0)
  928. # END_OF_UNKNOWN_UPDATE
  929.  
  930. def ActivateSkillSlot(self, slotIndex):
  931. if self.interface:
  932. self.interface.OnActivateSkill(slotIndex)
  933.  
  934. def DeactivateSkillSlot(self, slotIndex):
  935. if self.interface:
  936. self.interface.OnDeactivateSkill(slotIndex)
  937.  
  938. def RefreshEquipment(self):
  939. if self.interface:
  940. self.interface.RefreshInventory()
  941.  
  942. def RefreshInventory(self):
  943. if self.interface:
  944. self.interface.RefreshInventory()
  945.  
  946. def RefreshCharacter(self):
  947. if self.interface:
  948. self.interface.RefreshCharacter()
  949.  
  950. def OnGameOver(self):
  951. self.CloseTargetBoard()
  952. self.OpenRestartDialog()
  953.  
  954. def OpenRestartDialog(self):
  955. self.interface.OpenRestartDialog()
  956.  
  957. def ChangeCurrentSkill(self, skillSlotNumber):
  958. self.interface.OnChangeCurrentSkill(skillSlotNumber)
  959.  
  960. ## TargetBoard
  961. def SetPCTargetBoard(self, vid, name):
  962. self.targetBoard.Open(vid, name)
  963.  
  964. if app.IsPressed(app.DIK_LCONTROL):
  965.  
  966. if not player.IsSameEmpire(vid):
  967. return
  968.  
  969. if player.IsMainCharacterIndex(vid):
  970. return
  971. elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(vid):
  972. return
  973.  
  974. self.interface.OpenWhisperDialog(name)
  975.  
  976.  
  977. def RefreshTargetBoardByVID(self, vid):
  978. self.targetBoard.RefreshByVID(vid)
  979.  
  980. def RefreshTargetBoardByName(self, name):
  981. self.targetBoard.RefreshByName(name)
  982.  
  983. def __RefreshTargetBoard(self):
  984. self.targetBoard.Refresh()
  985.  
  986.  
  987. if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  988. if app.ENABLE_VIEW_ELEMENT:
  989. def SetHPTargetBoard(self, vid, hpPercentage, iMinHP, iMaxHP, bElement):
  990. if vid != self.targetBoard.GetTargetVID():
  991. self.targetBoard.ResetTargetBoard()
  992. self.targetBoard.SetEnemyVID(vid)
  993.  
  994. self.targetBoard.SetHP(hpPercentage, iMinHP, iMaxHP)
  995. self.targetBoard.SetElementImage(bElement)
  996. self.targetBoard.Show()
  997. else:
  998. def SetHPTargetBoard(self, vid, hpPercentage, iMinHP, iMaxHP):
  999. if vid != self.targetBoard.GetTargetVID():
  1000. self.targetBoard.ResetTargetBoard()
  1001. self.targetBoard.SetEnemyVID(vid)
  1002.  
  1003. self.targetBoard.SetHP(hpPercentage, iMinHP, iMaxHP)
  1004. self.targetBoard.Show()
  1005. else:
  1006. if app.ENABLE_VIEW_ELEMENT:
  1007. def SetHPTargetBoard(self, vid, hpPercentage, bElement):
  1008. if vid != self.targetBoard.GetTargetVID():
  1009. self.targetBoard.ResetTargetBoard()
  1010. self.targetBoard.SetEnemyVID(vid)
  1011.  
  1012. self.targetBoard.SetHP(hpPercentage)
  1013. self.targetBoard.SetElementImage(bElement)
  1014. self.targetBoard.Show()
  1015. else:
  1016. def SetHPTargetBoard(self, vid, hpPercentage):
  1017. if vid != self.targetBoard.GetTargetVID():
  1018. self.targetBoard.ResetTargetBoard()
  1019. self.targetBoard.SetEnemyVID(vid)
  1020.  
  1021. self.targetBoard.SetHP(hpPercentage)
  1022. self.targetBoard.Show()
  1023.  
  1024. def CloseTargetBoardIfDifferent(self, vid):
  1025. if vid != self.targetBoard.GetTargetVID():
  1026. self.targetBoard.Close()
  1027.  
  1028. def CloseTargetBoard(self):
  1029. self.targetBoard.Close()
  1030.  
  1031. ## View Equipment
  1032. def OpenEquipmentDialog(self, vid):
  1033. if app.ENABLE_PVP_ADVANCED:
  1034. pvp.DUEL_IS_SHOW_EQUIP = 0
  1035. pvp.DUEL_SAVE_VID = (int(vid))
  1036.  
  1037. self.interface.OpenEquipmentDialog(vid)
  1038.  
  1039.  
  1040. def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
  1041. self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
  1042.  
  1043. def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
  1044. self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
  1045.  
  1046. def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
  1047. self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
  1048.  
  1049. def BINARY_OpenAtlasWindow(self):
  1050. self.interface.BINARY_OpenAtlasWindow()
  1051.  
  1052. ## Chat
  1053. def OnRecvWhisper(self, mode, name, line):
  1054. if mode == chat.WHISPER_TYPE_GM:
  1055. self.interface.RegisterGameMasterName(name)
  1056.  
  1057. chat.AppendWhisper(mode, name, line)
  1058. self.interface.RecvWhisper(name)
  1059.  
  1060. def OnRecvWhisperSystemMessage(self, mode, name, line):
  1061. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
  1062. self.interface.RecvWhisper(name)
  1063.  
  1064. def OnRecvWhisperError(self, mode, name, line):
  1065. if localeinfo.WHISPER_ERROR.has_key(mode):
  1066. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeinfo.WHISPER_ERROR[mode](name))
  1067. else:
  1068. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
  1069. self.interface.RecvWhisper(name)
  1070.  
  1071. def RecvWhisper(self, name):
  1072. self.interface.RecvWhisper(name)
  1073.  
  1074. def OnShopError(self, type):
  1075. try:
  1076. self.PopupMessage(localeinfo.SHOP_ERROR_DICT[type])
  1077. except KeyError:
  1078. self.PopupMessage(localeinfo.SHOP_ERROR_UNKNOWN % (type))
  1079.  
  1080. def OnSafeBoxError(self):
  1081. self.PopupMessage(localeinfo.SAFEBOX_ERROR)
  1082.  
  1083. def OnFishingSuccess(self, isFish, fishName):
  1084. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeinfo.FISHING_SUCCESS(isFish, fishName), 2000)
  1085.  
  1086. # ADD_FISHING_MESSAGE
  1087. def OnFishingNotifyUnknown(self):
  1088. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.FISHING_UNKNOWN)
  1089.  
  1090. def OnFishingWrongPlace(self):
  1091. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.FISHING_WRONG_PLACE)
  1092. # END_OF_ADD_FISHING_MESSAGE
  1093.  
  1094. def OnFishingNotify(self, isFish, fishName):
  1095. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.FISHING_NOTIFY(isFish, fishName))
  1096.  
  1097. def OnFishingFailure(self):
  1098. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeinfo.FISHING_FAILURE, 2000)
  1099.  
  1100. def OnCannotPickItem(self):
  1101. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.GAME_CANNOT_PICK_ITEM)
  1102.  
  1103. # MINING
  1104. def OnCannotMining(self):
  1105. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.GAME_CANNOT_MINING)
  1106. # END_OF_MINING
  1107.  
  1108. def OnCannotUseSkill(self, vid, type):
  1109. if localeinfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
  1110. textTail.RegisterInfoTail(vid, localeinfo.USE_SKILL_ERROR_TAIL_DICT[type])
  1111.  
  1112. if localeinfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
  1113. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.USE_SKILL_ERROR_CHAT_DICT[type])
  1114.  
  1115. def OnCannotShotError(self, vid, type):
  1116. textTail.RegisterInfoTail(vid, localeinfo.SHOT_ERROR_TAIL_DICT.get(type, localeinfo.SHOT_ERROR_UNKNOWN % (type)))
  1117.  
  1118. ## PointReset
  1119. def StartPointReset(self):
  1120. self.interface.OpenPointResetDialog()
  1121.  
  1122. ## Shop
  1123. def StartShop(self, vid):
  1124. self.interface.OpenShopDialog(vid)
  1125.  
  1126. if app.__ENABLE_EXTEND_INVEN_SYSTEM__:
  1127. self.RefreshInventory()
  1128.  
  1129. def EndShop(self):
  1130. self.interface.CloseShopDialog()
  1131.  
  1132. if app.__ENABLE_EXTEND_INVEN_SYSTEM__:
  1133. self.RefreshInventory()
  1134.  
  1135. def RefreshShop(self):
  1136. self.interface.RefreshShopDialog()
  1137.  
  1138. def SetShopSellingPrice(self, Price):
  1139. pass
  1140.  
  1141. ## Exchange
  1142. def StartExchange(self):
  1143. self.interface.StartExchange()
  1144.  
  1145. def EndExchange(self):
  1146. self.interface.EndExchange()
  1147.  
  1148. def RefreshExchange(self):
  1149. self.interface.RefreshExchange()
  1150.  
  1151. ## Party
  1152. def RecvPartyInviteQuestion(self, leaderVID, leaderName):
  1153. partyInviteQuestionDialog = uicommon.QuestionDialog()
  1154. partyInviteQuestionDialog.SetText(leaderName + localeinfo.PARTY_DO_YOU_JOIN)
  1155. partyInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerPartyInvite(arg))
  1156. partyInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerPartyInvite(arg))
  1157. partyInviteQuestionDialog.Open()
  1158. partyInviteQuestionDialog.partyLeaderVID = leaderVID
  1159. self.partyInviteQuestionDialog = partyInviteQuestionDialog
  1160.  
  1161. def AnswerPartyInvite(self, answer):
  1162.  
  1163. if not self.partyInviteQuestionDialog:
  1164. return
  1165.  
  1166. partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
  1167.  
  1168. distance = player.GetCharacterDistance(partyLeaderVID)
  1169. if distance < 0.0 or distance > 5000:
  1170. answer = False
  1171.  
  1172. net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
  1173.  
  1174. self.partyInviteQuestionDialog.Close()
  1175. self.partyInviteQuestionDialog = None
  1176.  
  1177. def AddPartyMember(self, pid, name):
  1178. self.interface.AddPartyMember(pid, name)
  1179.  
  1180. def UpdatePartyMemberInfo(self, pid):
  1181. self.interface.UpdatePartyMemberInfo(pid)
  1182.  
  1183. def RemovePartyMember(self, pid):
  1184. self.interface.RemovePartyMember(pid)
  1185. self.__RefreshTargetBoard()
  1186.  
  1187. def LinkPartyMember(self, pid, vid):
  1188. self.interface.LinkPartyMember(pid, vid)
  1189.  
  1190. def UnlinkPartyMember(self, pid):
  1191. self.interface.UnlinkPartyMember(pid)
  1192.  
  1193. def UnlinkAllPartyMember(self):
  1194. self.interface.UnlinkAllPartyMember()
  1195.  
  1196. def ExitParty(self):
  1197. self.interface.ExitParty()
  1198. self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID())
  1199.  
  1200. def ChangePartyParameter(self, distributionMode):
  1201. self.interface.ChangePartyParameter(distributionMode)
  1202.  
  1203. ## Messenger
  1204. def OnMessengerAddFriendQuestion(self, name):
  1205. messengerAddFriendQuestion = uicommon.QuestionDialog2()
  1206. messengerAddFriendQuestion.SetText1(localeinfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
  1207. messengerAddFriendQuestion.SetText2(localeinfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2)
  1208. messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend))
  1209. messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend))
  1210. messengerAddFriendQuestion.Open()
  1211. messengerAddFriendQuestion.name = name
  1212. self.messengerAddFriendQuestion = messengerAddFriendQuestion
  1213.  
  1214. def OnAcceptAddFriend(self):
  1215. name = self.messengerAddFriendQuestion.name
  1216. net.SendChatPacket("/messenger_auth y " + name)
  1217. self.OnCloseAddFriendQuestionDialog()
  1218. return True
  1219.  
  1220. def OnDenyAddFriend(self):
  1221. name = self.messengerAddFriendQuestion.name
  1222. net.SendChatPacket("/messenger_auth n " + name)
  1223. self.OnCloseAddFriendQuestionDialog()
  1224. return True
  1225.  
  1226. def OnCloseAddFriendQuestionDialog(self):
  1227. self.messengerAddFriendQuestion.Close()
  1228. self.messengerAddFriendQuestion = None
  1229. return True
  1230.  
  1231. ## SafeBox
  1232. def OpenSafeboxWindow(self, size):
  1233. self.interface.OpenSafeboxWindow(size)
  1234.  
  1235. def RefreshSafebox(self):
  1236. self.interface.RefreshSafebox()
  1237.  
  1238. def RefreshSafeboxMoney(self):
  1239. self.interface.RefreshSafeboxMoney()
  1240.  
  1241. # ITEM_MALL
  1242. def OpenMallWindow(self, size):
  1243. self.interface.OpenMallWindow(size)
  1244.  
  1245. def RefreshMall(self):
  1246. self.interface.RefreshMall()
  1247. # END_OF_ITEM_MALL
  1248.  
  1249. ## Guild
  1250. def RecvGuildInviteQuestion(self, guildID, guildName):
  1251. guildInviteQuestionDialog = uicommon.QuestionDialog()
  1252. guildInviteQuestionDialog.SetText(guildName + localeinfo.GUILD_DO_YOU_JOIN)
  1253. guildInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerGuildInvite(arg))
  1254. guildInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerGuildInvite(arg))
  1255. guildInviteQuestionDialog.Open()
  1256. guildInviteQuestionDialog.guildID = guildID
  1257. self.guildInviteQuestionDialog = guildInviteQuestionDialog
  1258.  
  1259. def AnswerGuildInvite(self, answer):
  1260.  
  1261. if not self.guildInviteQuestionDialog:
  1262. return
  1263.  
  1264. guildLeaderVID = self.guildInviteQuestionDialog.guildID
  1265. net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
  1266.  
  1267. self.guildInviteQuestionDialog.Close()
  1268. self.guildInviteQuestionDialog = None
  1269.  
  1270.  
  1271. def DeleteGuild(self):
  1272. self.interface.DeleteGuild()
  1273.  
  1274. ## Clock
  1275. def ShowClock(self, second):
  1276. self.interface.ShowClock(second)
  1277.  
  1278. def HideClock(self):
  1279. self.interface.HideClock()
  1280.  
  1281. ## emotion
  1282. def BINARY_ActEmotion(self, emotionIndex):
  1283. if self.interface.wndCharacter:
  1284. self.interface.wndCharacter.ActEmotion(emotionIndex)
  1285.  
  1286. ###############################################################################################
  1287. ###############################################################################################
  1288. ## Keyboard Functions
  1289.  
  1290. def CheckFocus(self):
  1291. if False == self.IsFocus():
  1292. if True == self.interface.IsOpenChat():
  1293. self.interface.ToggleChat()
  1294.  
  1295. self.SetFocus()
  1296.  
  1297. def SaveScreen(self):
  1298. if SCREENSHOT_CWDSAVE:
  1299. if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
  1300. os.mkdir(os.getcwd()+os.sep+"screenshot")
  1301.  
  1302. (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep)
  1303. elif SCREENSHOT_DIR:
  1304. (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
  1305. else:
  1306. (succeeded, name) = grp.SaveScreenShot()
  1307.  
  1308. if not succeeded:
  1309. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.SCREENSHOT_SAVE_FAILURE)
  1310.  
  1311. def ShowConsole(self):
  1312. if debuginfo.IsDebugMode() or True == self.consoleEnable:
  1313. player.EndKeyWalkingImmediately()
  1314. self.console.OpenWindow()
  1315.  
  1316. def ShowName(self):
  1317. self.ShowNameFlag = True
  1318. if app.__ENABLE_NEW_OFFLINESHOP__:
  1319. offlineshop.ShowShopNames()
  1320.  
  1321. self.playerGauge.EnableShowAlways()
  1322. player.SetQuickPage(self.quickSlotPageIndex+1)
  1323.  
  1324. # ADD_ALWAYS_SHOW_NAME
  1325. def __IsShowName(self):
  1326.  
  1327. if systemSetting.IsAlwaysShowName():
  1328. return True
  1329.  
  1330. if self.ShowNameFlag:
  1331. return True
  1332.  
  1333. return False
  1334. # END_OF_ADD_ALWAYS_SHOW_NAME
  1335.  
  1336. def HideName(self):
  1337. self.ShowNameFlag = False
  1338. self.playerGauge.DisableShowAlways()
  1339. player.SetQuickPage(self.quickSlotPageIndex)
  1340. if app.__ENABLE_NEW_OFFLINESHOP__:
  1341. offlineshop.HideShopNames()
  1342.  
  1343.  
  1344. def ShowMouseImage(self):
  1345. self.interface.ShowMouseImage()
  1346.  
  1347. def HideMouseImage(self):
  1348. self.interface.HideMouseImage()
  1349.  
  1350. def StartAttack(self):
  1351. player.SetAttackKeyState(True)
  1352.  
  1353. def EndAttack(self):
  1354. player.SetAttackKeyState(False)
  1355.  
  1356. def MoveUp(self):
  1357. player.SetSingleDIKKeyState(app.DIK_UP, True)
  1358.  
  1359. def MoveDown(self):
  1360. player.SetSingleDIKKeyState(app.DIK_DOWN, True)
  1361.  
  1362. def MoveLeft(self):
  1363. player.SetSingleDIKKeyState(app.DIK_LEFT, True)
  1364.  
  1365. def MoveRight(self):
  1366. player.SetSingleDIKKeyState(app.DIK_RIGHT, True)
  1367.  
  1368. def StopUp(self):
  1369. player.SetSingleDIKKeyState(app.DIK_UP, False)
  1370.  
  1371. def StopDown(self):
  1372. player.SetSingleDIKKeyState(app.DIK_DOWN, False)
  1373.  
  1374. def StopLeft(self):
  1375. player.SetSingleDIKKeyState(app.DIK_LEFT, False)
  1376.  
  1377. def StopRight(self):
  1378. player.SetSingleDIKKeyState(app.DIK_RIGHT, False)
  1379.  
  1380. def PickUpItem(self):
  1381. player.PickCloseItem()
  1382.  
  1383. #def PickUpMoney(self):
  1384. # player.PickCloseMoney()
  1385.  
  1386. ###############################################################################################
  1387. ###############################################################################################
  1388. ## Event Handler
  1389.  
  1390. def OnKeyDown(self, key):
  1391. if self.interface.wndWeb and self.interface.wndWeb.IsShow():
  1392. return
  1393.  
  1394. if key == app.DIK_ESC:
  1395. self.RequestDropItem(False)
  1396.  
  1397. try:
  1398. self.onPressKeyDict[key]()
  1399. except KeyError:
  1400. pass
  1401. except:
  1402. raise
  1403.  
  1404. return True
  1405.  
  1406. def OnKeyUp(self, key):
  1407. if key == None:
  1408. return
  1409.  
  1410. try:
  1411. self.onClickKeyDict[key]()
  1412. except:
  1413. pass
  1414.  
  1415. return True
  1416.  
  1417. def OnMouseLeftButtonDown(self):
  1418. if self.interface.BUILD_OnMouseLeftButtonDown():
  1419. return
  1420.  
  1421. if mousemodule.mouseController.isAttached():
  1422. self.CheckFocus()
  1423. else:
  1424. hyperlink = ui.GetHyperlink()
  1425. if hyperlink:
  1426. return
  1427. else:
  1428. self.CheckFocus()
  1429. player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  1430.  
  1431. return True
  1432.  
  1433. def OnMouseLeftButtonUp(self):
  1434.  
  1435. if self.interface.BUILD_OnMouseLeftButtonUp():
  1436. return
  1437.  
  1438. if mousemodule.mouseController.isAttached():
  1439.  
  1440. attachedType = mousemodule.mouseController.GetAttachedType()
  1441. attachedItemIndex = mousemodule.mouseController.GetAttachedItemIndex()
  1442. attachedItemSlotPos = mousemodule.mouseController.GetAttachedSlotNumber()
  1443. attachedItemCount = mousemodule.mouseController.GetAttachedItemCount()
  1444. if app.__ENABLE_NEW_OFFLINESHOP__:
  1445. if uiofflineshop.IsBuildingShop() and uiofflineshop.IsSaleSlot(player.SlotTypeToInvenType(attachedType), attachedItemSlotPos): #toupdate
  1446. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.OFFLINESHOP_CANT_SELECT_ITEM_DURING_BUILING)
  1447. return
  1448.  
  1449.  
  1450.  
  1451. ## QuickSlot
  1452. if player.SLOT_TYPE_QUICK_SLOT == attachedType:
  1453. player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)
  1454.  
  1455. ## Inventory
  1456. elif player.SLOT_TYPE_INVENTORY == attachedType:
  1457.  
  1458. if player.ITEM_MONEY == attachedItemIndex:
  1459. self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1460. else:
  1461. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1462.  
  1463. ## DragonSoul
  1464. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1465. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1466.  
  1467.  
  1468. ## ExtraInventory
  1469. if app.ENABLE_EXTRA_INVENTORY:
  1470. if attachedType == player.SLOT_TYPE_EXTRA_INVENTORY:
  1471. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1472.  
  1473.  
  1474.  
  1475. mousemodule.mouseController.DeattachObject()
  1476.  
  1477. else:
  1478. hyperlink = ui.GetHyperlink()
  1479. if hyperlink:
  1480. if app.IsPressed(app.DIK_LALT):
  1481. link = chat.GetLinkFromHyperlink(hyperlink)
  1482. ime.PasteString(link)
  1483. else:
  1484. self.interface.MakeHyperlinkTooltip(hyperlink)
  1485. return
  1486. else:
  1487. player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  1488.  
  1489. #player.EndMouseWalking()
  1490. return True
  1491.  
  1492. def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
  1493.  
  1494.  
  1495. if app.ENABLE_EXTRA_INVENTORY:
  1496. if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType or player.SLOT_TYPE_EXTRA_INVENTORY == attachedType:
  1497. attachedInvenType = player.SlotTypeToInvenType(attachedType)
  1498. if True == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1499. if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType and player.SLOT_TYPE_EXTRA_INVENTORY != attachedType:
  1500. self.stream.popupWindow.Close()
  1501. self.stream.popupWindow.Open(localeinfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeinfo.UI_OK)
  1502. else:
  1503. if chr.IsNPC(dstChrID):
  1504. net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1505. else:
  1506. if app.ENABLE_MELEY_LAIR_DUNGEON:
  1507. if chr.IsStone(dstChrID):
  1508. net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1509. else:
  1510. net.SendExchangeStartPacket(dstChrID)
  1511. net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1512. else:
  1513. net.SendExchangeStartPacket(dstChrID)
  1514. net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1515. else:
  1516. self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1517. else:
  1518. if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1519. attachedInvenType = player.SlotTypeToInvenType(attachedType)
  1520. if True == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1521. if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType:
  1522. self.stream.popupWindow.Close()
  1523. self.stream.popupWindow.Open(localeinfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeinfo.UI_OK)
  1524. else:
  1525. if chr.IsNPC(dstChrID):
  1526. net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1527. else:
  1528. if app.ENABLE_MELEY_LAIR_DUNGEON:
  1529. if chr.IsStone(dstChrID):
  1530. net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1531. else:
  1532. net.SendExchangeStartPacket(dstChrID)
  1533. net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1534. else:
  1535. net.SendExchangeStartPacket(dstChrID)
  1536. net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1537. else:
  1538. self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1539.  
  1540. def __PutMoney(self, attachedType, attachedMoney, dstChrID):
  1541. if True == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1542. net.SendExchangeStartPacket(dstChrID)
  1543. net.SendExchangeElkAddPacket(attachedMoney)
  1544. else:
  1545. self.__DropMoney(attachedType, attachedMoney)
  1546.  
  1547. def __DropMoney(self, attachedType, attachedMoney):
  1548. # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1549. if uiprivateshopbuilder.IsBuildingPrivateShop():
  1550. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1551. return
  1552. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1553.  
  1554. if attachedMoney>=1000:
  1555. self.stream.popupWindow.Close()
  1556. self.stream.popupWindow.Open(localeinfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeinfo.UI_OK)
  1557. return
  1558.  
  1559. itemDropQuestionDialog = uicommon.QuestionDialog()
  1560. itemDropQuestionDialog.SetText(localeinfo.DO_YOU_DROP_MONEY % (attachedMoney))
  1561. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1562. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1563. itemDropQuestionDialog.Open()
  1564. itemDropQuestionDialog.dropType = attachedType
  1565. itemDropQuestionDialog.dropCount = attachedMoney
  1566. itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
  1567. self.itemDropQuestionDialog = itemDropQuestionDialog
  1568.  
  1569. def __SendDestroyItemPacket(self, itemVNum, itemInvenType = player.INVENTORY):
  1570. if uiprivateshopbuilder.IsBuildingPrivateShop():
  1571. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1572. return
  1573.  
  1574. net.SendItemDestroyPacket(itemVNum, itemInvenType)
  1575.  
  1576. def RequestDestroyItem(self, answer):
  1577. if not self.itemDropQuestionDialog:
  1578. return
  1579.  
  1580. if answer:
  1581. dropType = self.itemDropQuestionDialog.dropType
  1582. dropNumber = self.itemDropQuestionDialog.dropNumber
  1583. if player.SLOT_TYPE_INVENTORY == dropType:
  1584. self.__SendDestroyItemPacket(dropNumber, dropType)
  1585. elif app.ENABLE_EXTRA_INVENTORY and player.SLOT_TYPE_EXTRA_INVENTORY == dropType:
  1586. self.__SendDestroyItemPacket(dropNumber, 7)
  1587.  
  1588. self.itemDropQuestionDialog.Close()
  1589. self.itemDropQuestionDialog = None
  1590. constinfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1591.  
  1592. def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
  1593. # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1594. if uiprivateshopbuilder.IsBuildingPrivateShop():
  1595. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1596. return
  1597. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1598.  
  1599. if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos):
  1600. self.stream.popupWindow.Close()
  1601. self.stream.popupWindow.Open(localeinfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeinfo.UI_OK)
  1602.  
  1603. else:
  1604. if player.SLOT_TYPE_INVENTORY == attachedType:
  1605. dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
  1606.  
  1607. item.SelectItem(dropItemIndex)
  1608. dropItemName = item.GetItemName()
  1609.  
  1610. ## Question Text
  1611. questionText = localeinfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1612.  
  1613. ## Dialog
  1614. itemDropQuestionDialog = uicommon.QuestionDialogItem()
  1615. itemDropQuestionDialog.SetText(questionText)
  1616. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1617. itemDropQuestionDialog.SetDestroyEvent(lambda arg=True: self.RequestDestroyItem(arg))
  1618. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1619. itemDropQuestionDialog.Open()
  1620. itemDropQuestionDialog.dropType = attachedType
  1621. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1622. itemDropQuestionDialog.dropCount = attachedItemCount
  1623. self.itemDropQuestionDialog = itemDropQuestionDialog
  1624.  
  1625. constinfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1626. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1627. dropItemIndex = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, attachedItemSlotPos)
  1628.  
  1629. item.SelectItem(dropItemIndex)
  1630. dropItemName = item.GetItemName()
  1631.  
  1632. ## Question Text
  1633. questionText = localeinfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1634.  
  1635. ## Dialog
  1636. itemDropQuestionDialog = uicommon.QuestionDialog()
  1637. itemDropQuestionDialog.SetText(questionText)
  1638. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1639. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1640. itemDropQuestionDialog.Open()
  1641. itemDropQuestionDialog.dropType = attachedType
  1642. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1643. itemDropQuestionDialog.dropCount = attachedItemCount
  1644. self.itemDropQuestionDialog = itemDropQuestionDialog
  1645.  
  1646. constinfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1647.  
  1648. elif app.ENABLE_EXTRA_INVENTORY and player.SLOT_TYPE_EXTRA_INVENTORY == attachedType:
  1649. dropItemIndex = player.GetItemIndex(player.EXTRA_INVENTORY, attachedItemSlotPos)
  1650.  
  1651. item.SelectItem(dropItemIndex)
  1652. dropItemName = item.GetItemName()
  1653. questionText = localeinfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1654.  
  1655. itemDropQuestionDialog = uicommon.QuestionDialogItem()
  1656. itemDropQuestionDialog.SetText(questionText)
  1657. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1658. itemDropQuestionDialog.SetDestroyEvent(lambda arg=True: self.RequestDestroyItem(arg))
  1659. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1660. itemDropQuestionDialog.Open()
  1661. itemDropQuestionDialog.dropType = attachedType
  1662. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1663. itemDropQuestionDialog.dropCount = attachedItemCount
  1664. self.itemDropQuestionDialog = itemDropQuestionDialog
  1665.  
  1666. constinfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1667.  
  1668. def RequestDropItem(self, answer):
  1669. if not self.itemDropQuestionDialog:
  1670. return
  1671.  
  1672. if answer:
  1673. dropType = self.itemDropQuestionDialog.dropType
  1674. dropCount = self.itemDropQuestionDialog.dropCount
  1675. dropNumber = self.itemDropQuestionDialog.dropNumber
  1676.  
  1677. if player.SLOT_TYPE_INVENTORY == dropType:
  1678. if dropNumber == player.ITEM_MONEY:
  1679. net.SendGoldDropPacketNew(dropCount)
  1680. snd.PlaySound("sound/ui/money.wav")
  1681. else:
  1682. # PRIVATESHOP_DISABLE_ITEM_DROP
  1683. self.__SendDropItemPacket(dropNumber, dropCount)
  1684. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1685. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == dropType:
  1686. # PRIVATESHOP_DISABLE_ITEM_DROP
  1687. self.__SendDropItemPacket(dropNumber, dropCount, player.DRAGON_SOUL_INVENTORY)
  1688. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1689. if app.ENABLE_EXTRA_INVENTORY:
  1690. if player.SLOT_TYPE_EXTRA_INVENTORY == dropType:
  1691. self.__SendDropItemPacket(dropNumber, dropCount, player.EXTRA_INVENTORY)
  1692.  
  1693. self.itemDropQuestionDialog.Close()
  1694. self.itemDropQuestionDialog = None
  1695.  
  1696. constinfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1697.  
  1698. # PRIVATESHOP_DISABLE_ITEM_DROP
  1699. def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
  1700. if uiprivateshopbuilder.IsBuildingPrivateShop():
  1701. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1702. return
  1703.  
  1704. net.SendItemDropPacketNew(itemInvenType, itemVNum, itemCount)
  1705. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1706.  
  1707. def OnMouseRightButtonDown(self):
  1708.  
  1709. self.CheckFocus()
  1710.  
  1711. if True == mousemodule.mouseController.isAttached():
  1712. mousemodule.mouseController.DeattachObject()
  1713.  
  1714. else:
  1715. player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
  1716.  
  1717. return True
  1718.  
  1719. def OnMouseRightButtonUp(self):
  1720. if True == mousemodule.mouseController.isAttached():
  1721. return True
  1722.  
  1723. player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
  1724. return True
  1725.  
  1726. def OnMouseMiddleButtonDown(self):
  1727. player.SetMouseMiddleButtonState(player.MBS_PRESS)
  1728.  
  1729. def OnMouseMiddleButtonUp(self):
  1730. player.SetMouseMiddleButtonState(player.MBS_CLICK)
  1731.  
  1732. def OnUpdate(self):
  1733. app.UpdateGame()
  1734.  
  1735. if app.ENABLE_PVP_ADVANCED:
  1736. if pvp.DUEL_IS_SHOW_EQUIP == 1:
  1737. self.interface.CloseEquipmentDialog(int(pvp.DUEL_SAVE_VID))
  1738.  
  1739. #if self.mapNameShower.IsShow():
  1740. # self.mapNameShower.Update()
  1741.  
  1742. if self.isShowDebugInfo:
  1743. self.UpdateDebugInfo()
  1744.  
  1745. if self.enableXMasBoom:
  1746. self.__XMasBoom_Update()
  1747. self.wnddailygift.OnUpdate()
  1748. self.interface.BUILD_OnUpdate()
  1749.  
  1750. if app.KASMIR_PAKET_SYSTEM:
  1751. if marek38.VERI_PAKETI1==1:
  1752. self.__PrivateShop_Kasmir_Open()
  1753. marek38.VERI_PAKETI1=0
  1754.  
  1755. #if 0 == constinfo.auto_pick_yang:
  1756. # self.PickUpMoney()
  1757. if app.ENABLE_BIOLOGIST_UI:
  1758. if constinfo.haveBiologist == 1:
  1759. t = constinfo.remainBiologistTime - app.GetGlobalTimeStamp()
  1760. if t <= 0:
  1761. if systemSetting.GetBiologistAlert() == True:
  1762. name = player.GetName()
  1763. if not name in constinfo.notifiedBiologist:
  1764. constinfo.notifiedBiologist.append(name)
  1765. if self.biologistAlert and not self.biologistAlert.IsShow():
  1766. self.biologistAlert.Open()
  1767.  
  1768. def UpdateDebugInfo(self):
  1769. #
  1770. # 캐릭터 좌표 및 FPS 출력
  1771. (x, y, z) = player.GetMainCharacterPosition()
  1772. nUpdateTime = app.GetUpdateTime()
  1773. nUpdateFPS = app.GetUpdateFPS()
  1774. nRenderFPS = app.GetRenderFPS()
  1775. nFaceCount = app.GetFaceCount()
  1776. fFaceSpeed = app.GetFaceSpeed()
  1777. nST=background.GetRenderShadowTime()
  1778. (fAveRT, nCurRT) = app.GetRenderTime()
  1779. (iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
  1780. (iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
  1781. if iPatch == 0:
  1782. iPatch = 1
  1783.  
  1784. #(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
  1785.  
  1786. self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
  1787. xMouse, yMouse = wndMgr.GetMousePosition()
  1788. self.PrintMousePos.SetText("MousePosition: %d %d" % (xMouse, yMouse))
  1789.  
  1790. self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
  1791.  
  1792. if fAveRT>1.0:
  1793. self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
  1794.  
  1795. self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
  1796. #self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
  1797. #self.TextureNum.SetText("TN : %s" % (sTextureNum))
  1798. #self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
  1799. self.ViewDistance.SetText("Num : %d, FS : %f, FE : %f, FC : %f" % (iNum, fFogStart, fFogEnd, fFarCilp))
  1800.  
  1801. def OnRender(self):
  1802. app.RenderGame()
  1803.  
  1804. if self.console.Console.collision:
  1805. background.RenderCollision()
  1806. chr.RenderCollision()
  1807.  
  1808. (x, y) = app.GetCursorPosition()
  1809.  
  1810. ########################
  1811. # Picking
  1812. ########################
  1813. textTail.UpdateAllTextTail()
  1814.  
  1815. if True == wndMgr.IsPickedWindow(self.hWnd):
  1816.  
  1817. self.PickingCharacterIndex = chr.Pick()
  1818.  
  1819. if -1 != self.PickingCharacterIndex:
  1820. textTail.ShowCharacterTextTail(self.PickingCharacterIndex)
  1821. if 0 != self.targetBoard.GetTargetVID():
  1822. textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())
  1823.  
  1824. # ADD_ALWAYS_SHOW_NAME
  1825. if not self.__IsShowName():
  1826. self.PickingItemIndex = item.Pick()
  1827. if -1 != self.PickingItemIndex:
  1828. textTail.ShowItemTextTail(self.PickingItemIndex)
  1829. # END_OF_ADD_ALWAYS_SHOW_NAME
  1830.  
  1831. ## Show all name in the range
  1832.  
  1833. # ADD_ALWAYS_SHOW_NAME
  1834. if self.__IsShowName():
  1835. textTail.ShowAllTextTail()
  1836. self.PickingItemIndex = textTail.Pick(x, y)
  1837. # END_OF_ADD_ALWAYS_SHOW_NAME
  1838.  
  1839. textTail.UpdateShowingTextTail()
  1840. textTail.ArrangeTextTail()
  1841. if -1 != self.PickingItemIndex:
  1842. textTail.SelectItemName(self.PickingItemIndex)
  1843.  
  1844. grp.PopState()
  1845. grp.SetInterfaceRenderState()
  1846.  
  1847. textTail.Render()
  1848. textTail.HideAllTextTail()
  1849.  
  1850. def OnPressEscapeKey(self):
  1851. if app.TARGET == app.GetCursor():
  1852. app.SetCursor(app.NORMAL)
  1853.  
  1854. elif True == mousemodule.mouseController.isAttached():
  1855. mousemodule.mouseController.DeattachObject()
  1856.  
  1857. else:
  1858. self.interface.OpenSystemDialog()
  1859.  
  1860. return True
  1861.  
  1862. def OnIMEReturn(self):
  1863. if app.IsPressed(app.DIK_LSHIFT):
  1864. self.interface.OpenWhisperDialogWithoutTarget()
  1865. else:
  1866. self.interface.ToggleChat()
  1867. return True
  1868.  
  1869. def OnPressExitKey(self):
  1870. self.interface.ToggleSystemDialog()
  1871. return True
  1872.  
  1873. ## BINARY CALLBACK
  1874. ######################################################################################
  1875.  
  1876. # WEDDING
  1877. def BINARY_LoverInfo(self, name, lovePoint):
  1878. if self.interface.wndMessenger:
  1879. self.interface.wndMessenger.OnAddLover(name, lovePoint)
  1880. if self.affectShower:
  1881. self.affectShower.SetLoverInfo(name, lovePoint)
  1882.  
  1883. def BINARY_UpdateLovePoint(self, lovePoint):
  1884. if self.interface.wndMessenger:
  1885. self.interface.wndMessenger.OnUpdateLovePoint(lovePoint)
  1886. if self.affectShower:
  1887. self.affectShower.OnUpdateLovePoint(lovePoint)
  1888. # END_OF_WEDDING
  1889. if app.ENABLE_SEND_TARGET_INFO:
  1890. def BINARY_AddTargetMonsterDropInfo(self, raceNum, itemVnum, itemCount):
  1891. if not raceNum in constinfo.MONSTER_INFO_DATA:
  1892. constinfo.MONSTER_INFO_DATA.update({raceNum : {}})
  1893. constinfo.MONSTER_INFO_DATA[raceNum].update({"items" : []})
  1894. curList = constinfo.MONSTER_INFO_DATA[raceNum]["items"]
  1895.  
  1896. isUpgradeable = False
  1897. isMetin = False
  1898. item.SelectItem(itemVnum)
  1899. if item.GetItemType() == item.ITEM_TYPE_WEAPON or item.GetItemType() == item.ITEM_TYPE_ARMOR:
  1900. isUpgradeable = True
  1901. elif item.GetItemType() == item.ITEM_TYPE_METIN:
  1902. isMetin = True
  1903.  
  1904. for curItem in curList:
  1905. if isUpgradeable:
  1906. if curItem.has_key("vnum_list") and curItem["vnum_list"][0] / 10 * 10 == itemVnum / 10 * 10:
  1907. if not (itemVnum in curItem["vnum_list"]):
  1908. curItem["vnum_list"].append(itemVnum)
  1909. return
  1910. elif isMetin:
  1911. if curItem.has_key("vnum_list"):
  1912. baseVnum = curItem["vnum_list"][0]
  1913. if curItem.has_key("vnum_list") and (baseVnum - baseVnum%1000) == (itemVnum - itemVnum%1000):
  1914. if not (itemVnum in curItem["vnum_list"]):
  1915. curItem["vnum_list"].append(itemVnum)
  1916. return
  1917. else:
  1918. if curItem.has_key("vnum") and curItem["vnum"] == itemVnum and curItem["count"] == itemCount:
  1919. return
  1920.  
  1921. if isUpgradeable or isMetin:
  1922. curList.append({"vnum_list":[itemVnum], "count":itemCount})
  1923. else:
  1924. curList.append({"vnum":itemVnum, "count":itemCount})
  1925.  
  1926. def BINARY_RefreshTargetMonsterDropInfo(self, raceNum):
  1927. self.targetBoard.RefreshMonsterInfoBoard()
  1928.  
  1929. # QUEST_CONFIRM
  1930. def BINARY_OnQuestConfirm(self, msg, timeout, pid):
  1931. confirmDialog = uicommon.QuestionDialogWithTimeLimit()
  1932. confirmDialog.Open(msg, timeout)
  1933. confirmDialog.SetAcceptEvent(lambda answer=True, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1934. confirmDialog.SetCancelEvent(lambda answer=False, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1935. self.confirmDialog = confirmDialog
  1936. # END_OF_QUEST_CONFIRM
  1937.  
  1938. # GIFT command
  1939. def Gift_Show(self):
  1940. self.interface.ShowGift()
  1941.  
  1942. # CUBE
  1943. def BINARY_Cube_Open(self, npcVNUM):
  1944. self.currentCubeNPC = npcVNUM
  1945.  
  1946. self.interface.OpenCubeWindow()
  1947.  
  1948.  
  1949. if npcVNUM not in self.cubeInformation:
  1950. net.SendChatPacket("/cube r_info")
  1951. else:
  1952. cubeInfoList = self.cubeInformation[npcVNUM]
  1953.  
  1954. i = 0
  1955. for cubeInfo in cubeInfoList:
  1956. self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"])
  1957.  
  1958. j = 0
  1959. for materialList in cubeInfo["materialList"]:
  1960. for materialInfo in materialList:
  1961. itemVnum, itemCount = materialInfo
  1962. self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount)
  1963. j = j + 1
  1964.  
  1965. i = i + 1
  1966.  
  1967. self.interface.wndCube.Refresh()
  1968.  
  1969. def BINARY_Cube_Close(self):
  1970. self.interface.CloseCubeWindow()
  1971.  
  1972. # 제작에 필요한 골드, 예상되는 완성품의 VNUM과 개수 정보 update
  1973. def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count):
  1974. self.interface.UpdateCubeInfo(gold, itemVnum, count)
  1975.  
  1976. def BINARY_Cube_Succeed(self, itemVnum, count):
  1977. print "큐브 제작 성공"
  1978. self.interface.SucceedCubeWork(itemVnum, count)
  1979. pass
  1980.  
  1981. def BINARY_Cube_Failed(self):
  1982. print "큐브 제작 실패"
  1983. self.interface.FailedCubeWork()
  1984. pass
  1985.  
  1986. def BINARY_Cube_ResultList(self, npcVNUM, listText):
  1987. # ResultList Text Format : 72723,1/72725,1/72730.1/50001,5 이런식으로 "/" 문자로 구분된 리스트를 줌
  1988. #print listText
  1989.  
  1990. if npcVNUM == 0:
  1991. npcVNUM = self.currentCubeNPC
  1992.  
  1993. self.cubeInformation[npcVNUM] = []
  1994.  
  1995. try:
  1996. for eachInfoText in listText.split("/"):
  1997. eachInfo = eachInfoText.split(",")
  1998. itemVnum = int(eachInfo[0])
  1999. itemCount = int(eachInfo[1])
  2000.  
  2001. self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount})
  2002. self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount)
  2003.  
  2004. resultCount = len(self.cubeInformation[npcVNUM])
  2005. requestCount = 7
  2006. modCount = resultCount % requestCount
  2007. splitCount = resultCount / requestCount
  2008. for i in xrange(splitCount):
  2009. #print("/cube r_info %d %d" % (i * requestCount, requestCount))
  2010. net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
  2011.  
  2012. if 0 < modCount:
  2013. #print("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  2014. net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  2015.  
  2016. except RuntimeError, msg:
  2017. dbg.TraceError(msg)
  2018. return 0
  2019.  
  2020. pass
  2021.  
  2022. if app.ENABLE_ATTR_TRANSFER_SYSTEM:
  2023. def BINARY_AttrTransfer_Open(self):
  2024. self.interface.OpenAttrTransferWindow()
  2025.  
  2026. def BINARY_AttrTransfer_Close(self):
  2027. self.interface.CloseAttrTransferWindow()
  2028.  
  2029. def BINARY_AttrTransfer_Success(self):
  2030. self.interface.AttrTransferSuccess()
  2031.  
  2032. def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText):
  2033. # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000
  2034. try:
  2035. #print listText
  2036.  
  2037. if 3 > len(listText):
  2038. dbg.TraceError("Wrong Cube Material Infomation")
  2039. return 0
  2040.  
  2041.  
  2042.  
  2043. eachResultList = listText.split("@")
  2044.  
  2045. cubeInfo = self.cubeInformation[self.currentCubeNPC]
  2046.  
  2047. itemIndex = 0
  2048. for eachResultText in eachResultList:
  2049. cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []]
  2050. materialList = cubeInfo[startIndex + itemIndex]["materialList"]
  2051.  
  2052. gold = 0
  2053. splitResult = eachResultText.split("/")
  2054. if 1 < len(splitResult):
  2055. gold = int(splitResult[1])
  2056.  
  2057. #print "splitResult : ", splitResult
  2058. eachMaterialList = splitResult[0].split("&")
  2059.  
  2060. i = 0
  2061. for eachMaterialText in eachMaterialList:
  2062. complicatedList = eachMaterialText.split("|")
  2063.  
  2064. if 0 < len(complicatedList):
  2065. for complicatedText in complicatedList:
  2066. (itemVnum, itemCount) = complicatedText.split(",")
  2067. itemVnum = int(itemVnum)
  2068. itemCount = int(itemCount)
  2069. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  2070.  
  2071. materialList[i].append((itemVnum, itemCount))
  2072.  
  2073. else:
  2074. itemVnum, itemCount = eachMaterialText.split(",")
  2075. itemVnum = int(itemVnum)
  2076. itemCount = int(itemCount)
  2077. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  2078.  
  2079. materialList[i].append((itemVnum, itemCount))
  2080.  
  2081. i = i + 1
  2082.  
  2083.  
  2084.  
  2085. itemIndex = itemIndex + 1
  2086.  
  2087. self.interface.wndCube.Refresh()
  2088.  
  2089.  
  2090. except RuntimeError, msg:
  2091. dbg.TraceError(msg)
  2092. return 0
  2093.  
  2094. pass
  2095.  
  2096. # END_OF_CUBE
  2097.  
  2098. # 용혼석
  2099. def BINARY_Highlight_Item(self, inven_type, inven_pos):
  2100. # @fixme003 (+if self.interface:)
  2101. if self.interface:
  2102. self.interface.Highligt_Item(inven_type, inven_pos)
  2103.  
  2104. def BINARY_DragonSoulRefineWindow_Open(self):
  2105. self.interface.OpenDragonSoulRefineWindow()
  2106.  
  2107. def BINARY_DragonSoulRefineWindow_RefineFail(self, reason, inven_type, inven_pos):
  2108. self.interface.FailDragonSoulRefine(reason, inven_type, inven_pos)
  2109.  
  2110. def BINARY_DragonSoulRefineWindow_RefineSucceed(self, inven_type, inven_pos):
  2111. self.interface.SucceedDragonSoulRefine(inven_type, inven_pos)
  2112.  
  2113. # END of DRAGON SOUL REFINE WINDOW
  2114.  
  2115. if app.ENABLE_DUNGEON_INFO_SYSTEM:
  2116. def DungeonInfo(self, questindex):
  2117. constinfo.dungeonData["quest_index"] = questindex
  2118.  
  2119. def CleanDungeonInfo(self):
  2120. constinfo.dungeonInfo = []
  2121.  
  2122. def CleanDungeonRanking(self):
  2123. constinfo.dungeonRanking["ranking_list"] = []
  2124. constinfo.dungeonRanking["my_ranking"] = []
  2125.  
  2126. def GetDungeonInfo(self, cmd):
  2127. cmd = cmd.split("#")
  2128.  
  2129. if cmd[0] == "INPUT":
  2130. constinfo.INPUT_IGNORE = int(cmd[1])
  2131.  
  2132. elif cmd[0] == "CMD":
  2133. net.SendQuestInputStringPacket(constinfo.dungeonData["quest_cmd"])
  2134. constinfo.dungeonData["quest_cmd"] = ""
  2135.  
  2136. else:
  2137. pass
  2138.  
  2139. def UpdateDungeonInfo(self, status, waitTime, type, organization, levelMinLimit, levelMaxLimit, partyMemberMinLimit, partyMemberMaxLimit, mapIndex, mapCoordX, mapCoordY, cooldown, duration, entranceMapIndex, strengthBonusName, resistanceBonusName, itemVnum, itemCount, finished, fastestTime, highestDamage):
  2140. status = int(status)
  2141. waitTime = int(waitTime)
  2142. type = int(type)
  2143. organization = int(organization)
  2144. levelMinLimit = int(levelMinLimit)
  2145. levelMaxLimit = int(levelMaxLimit)
  2146. partyMemberMinLimit = int(partyMemberMinLimit)
  2147. partyMemberMaxLimit = int(partyMemberMaxLimit)
  2148. mapIndex = int(mapIndex)
  2149. mapCoordX = int(mapCoordX)
  2150. mapCoordY = int(mapCoordY)
  2151. cooldown = int(cooldown)
  2152. duration = int(duration)
  2153. entranceMapIndex = int(entranceMapIndex)
  2154. strengthBonusName = str(strengthBonusName).replace("_", " ")
  2155. resistanceBonusName = str(resistanceBonusName).replace("_", " ")
  2156. itemVnum = int(itemVnum)
  2157. itemCount = int(itemCount)
  2158. finished = int(finished)
  2159. fastestTime = int(fastestTime)
  2160. highestDamage = int(highestDamage)
  2161.  
  2162. constinfo.dungeonInfo.append(
  2163. {
  2164. "status" : status,
  2165. "wait_time" : waitTime,
  2166. "type" : type,
  2167. "organization" : organization,
  2168. "level_limit" : [levelMinLimit, levelMaxLimit],
  2169. "party_member_limit" : [partyMemberMinLimit, partyMemberMaxLimit],
  2170. "map_index" : mapIndex,
  2171. "map_coords" : [mapCoordX, mapCoordY],
  2172. "cooldown" : cooldown,
  2173. "duration" : duration,
  2174. "entrance_map_index" : entranceMapIndex,
  2175. "strength_bonus" : strengthBonusName,
  2176. "resistance_bonus" : resistanceBonusName,
  2177. "required_item" : [itemVnum, itemCount],
  2178. "finished" : finished,
  2179. "fastest_time" : fastestTime,
  2180. "highest_damage" : highestDamage
  2181. },
  2182. )
  2183.  
  2184. def UpdateDungeonRanking(self, name, level, rankType):
  2185. name = str(name)
  2186. level = int(level)
  2187. rankType = int(rankType)
  2188.  
  2189. constinfo.dungeonRanking["ranking_list"].append([name, level, rankType],)
  2190.  
  2191. def UpdateMyDungeonRanking(self, position, name, level, rankType):
  2192. position = int(position)
  2193. name = str(name)
  2194. level = int(level)
  2195. rankType = int(rankType)
  2196.  
  2197. constinfo.dungeonRanking["my_ranking"].append([position, name, level, rankType],)
  2198.  
  2199. def OpenDungeonRanking(self):
  2200. import uidungeoninfo
  2201. self.DungeonRank = uidungeoninfo.DungeonRank()
  2202. self.DungeonRank.Open()
  2203.  
  2204. def BINARY_SetBigMessage(self, message):
  2205. self.interface.bigBoard.SetTip(message)
  2206.  
  2207. def BINARY_SetTipMessage(self, message):
  2208. self.interface.tipBoard.SetTip(message)
  2209.  
  2210. def BINARY_AppendNotifyMessage(self, type):
  2211. if not type in localeinfo.NOTIFY_MESSAGE:
  2212. return
  2213. chat.AppendChat(chat.CHAT_TYPE_INFO, localeinfo.NOTIFY_MESSAGE[type])
  2214.  
  2215. def BINARY_Guild_EnterGuildArea(self, areaID):
  2216. self.interface.BULID_EnterGuildArea(areaID)
  2217.  
  2218. def BINARY_Guild_ExitGuildArea(self, areaID):
  2219. self.interface.BULID_ExitGuildArea(areaID)
  2220.  
  2221. def BINARY_GuildWar_OnSendDeclare(self, guildID):
  2222. pass
  2223.  
  2224. def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
  2225. mainCharacterName = player.GetMainCharacterName()
  2226. masterName = guild.GetGuildMasterName()
  2227. if mainCharacterName == masterName:
  2228. self.__GuildWar_OpenAskDialog(guildID, warType)
  2229.  
  2230. def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
  2231. self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
  2232.  
  2233. def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
  2234. self.interface.OnStartGuildWar(guildSelf, guildOpp)
  2235.  
  2236. def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
  2237. self.interface.OnEndGuildWar(guildSelf, guildOpp)
  2238.  
  2239. def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
  2240. self.interface.BINARY_SetObserverMode(isEnable)
  2241.  
  2242. def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
  2243. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  2244.  
  2245. def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
  2246. guildID1 = int(guildID1)
  2247. guildID2 = int(guildID2)
  2248. memberCount1 = int(memberCount1)
  2249. memberCount2 = int(memberCount2)
  2250. observerCount = int(observerCount)
  2251.  
  2252. self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
  2253. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  2254.  
  2255. def __GuildWar_OpenAskDialog(self, guildID, warType):
  2256.  
  2257. guildName = guild.GetGuildName(guildID)
  2258.  
  2259. # REMOVED_GUILD_BUG_FIX
  2260. if "Noname" == guildName:
  2261. return
  2262. # END_OF_REMOVED_GUILD_BUG_FIX
  2263.  
  2264. import uiguild
  2265. questionDialog = uiguild.AcceptGuildWarDialog()
  2266. questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept)
  2267. questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline)
  2268. questionDialog.Open(guildName, warType)
  2269.  
  2270. self.guildWarQuestionDialog = questionDialog
  2271.  
  2272. def __GuildWar_CloseAskDialog(self):
  2273. self.guildWarQuestionDialog.Close()
  2274. self.guildWarQuestionDialog = None
  2275.  
  2276. def __GuildWar_OnAccept(self):
  2277.  
  2278. guildName = self.guildWarQuestionDialog.GetGuildName()
  2279.  
  2280. net.SendChatPacket("/war " + guildName)
  2281. self.__GuildWar_CloseAskDialog()
  2282.  
  2283. return 1
  2284.  
  2285. def __GuildWar_OnDecline(self):
  2286.  
  2287. guildName = self.guildWarQuestionDialog.GetGuildName()
  2288.  
  2289. net.SendChatPacket("/nowar " + guildName)
  2290. self.__GuildWar_CloseAskDialog()
  2291.  
  2292. return 1
  2293.  
  2294. if app.ADVANCED_GUILD_INFO:
  2295. def GuildWar_OpenRank(self):
  2296. for i in xrange(50):
  2297. net.SendItemUsePacket(0)
  2298. #import event
  2299. #event.QuestButtonClick(int(constinfo.guildRankQuest))
  2300.  
  2301. def guildRankQuestID(self, idx):
  2302. constinfo.guildRankQuest = idx
  2303.  
  2304. def openGuildRank(self):
  2305. self.interface.OpenRankWindow()
  2306.  
  2307. def addGuildRank(self, text):
  2308. splittedValues = text.split("|")
  2309. while("" in splittedValues) :
  2310. splittedValues.remove("")
  2311. idx = int(splittedValues[0])
  2312. constinfo.GuildsRankList[idx]["Name"].append(splittedValues[1])
  2313. constinfo.GuildsRankList[idx]["Win"].append(splittedValues[2])
  2314. constinfo.GuildsRankList[idx]["Draw"].append(splittedValues[3])
  2315. constinfo.GuildsRankList[idx]["Loss"].append(splittedValues[4])
  2316. constinfo.GuildsRankList[idx]["Trophies"].append(splittedValues[5])
  2317.  
  2318. def clearGuildRank(self):
  2319. for i in constinfo.GuildsRankList:
  2320. i["Name"] = []
  2321. i["Win"] = []
  2322. i["Draw"]= []
  2323. i["Loss"] = []
  2324. i["Trophies"] = []
  2325.  
  2326. ## BINARY CALLBACK
  2327. ######################################################################################
  2328. def __ServerCommand_Build(self):
  2329. serverCommandList={
  2330. "ConsoleEnable" : self.__Console_Enable,
  2331. "DayMode" : self.__DayMode_Update,
  2332. "PRESERVE_DayMode" : self.__PRESERVE_DayMode_Update,
  2333. "CloseRestartWindow" : self.__RestartDialog_Close,
  2334. "OpenPrivateShop" : self.__PrivateShop_Open,
  2335. "PartyHealReady" : self.PartyHealReady,
  2336. "ShowMeSafeboxPassword" : self.AskSafeboxPassword,
  2337. "CloseSafebox" : self.CommandCloseSafebox,
  2338.  
  2339. # ADVANCED_GUILD_INFO
  2340. "callGuildRankId" : self.guildRankQuestID,
  2341. "openGuildRank" : self.openGuildRank,
  2342. "clearGuildRank" : self.clearGuildRank,
  2343. "addGuildRank" : self.addGuildRank,
  2344. # END_OF_ADVANCED_GUILD_INFO
  2345.  
  2346. # ITEM_MALL
  2347. "CloseMall" : self.CommandCloseMall,
  2348. "ShowMeMallPassword" : self.AskMallPassword,
  2349. "item_mall" : self.__ItemMall_Open,
  2350. # END_OF_ITEM_MALL
  2351.  
  2352. "RefineSuceeded" : self.RefineSuceededMessage,
  2353. "RefineFailed" : self.RefineFailedMessage,
  2354. "xmas_snow" : self.__XMasSnow_Enable,
  2355. "xmas_boom" : self.__XMasBoom_Enable,
  2356. "xmas_song" : self.__XMasSong_Enable,
  2357. "xmas_tree" : self.__XMasTree_Enable,
  2358. "newyear_boom" : self.__XMasBoom_Enable,
  2359. "PartyRequest" : self.__PartyRequestQuestion,
  2360. "PartyRequestDenied" : self.__PartyRequestDenied,
  2361. "horse_state" : self.__Horse_UpdateState,
  2362. "hide_horse_state" : self.__Horse_HideState,
  2363. "WarUC" : self.__GuildWar_UpdateMemberCount,
  2364. "test_server" : self.__EnableTestServerFlag,
  2365. "mall" : self.__InGameShop_Show,
  2366. # WEDDING
  2367. "lover_login" : self.__LoginLover,
  2368. "lover_logout" : self.__LogoutLover,
  2369. "lover_near" : self.__LoverNear,
  2370. "lover_far" : self.__LoverFar,
  2371. "lover_divorce" : self.__LoverDivorce,
  2372. "PlayMusic" : self.__PlayMusic,
  2373. # END_OF_WEDDING
  2374. "ManagerGiftSystem" : self.ManagerGiftSystem,
  2375. # PRIVATE_SHOP_PRICE_LIST
  2376. "MyShopPriceList" : self.__PrivateShop_PriceList,
  2377. # END_OF_PRIVATE_SHOP_PRICE_LIST
  2378. "AttrTransferMessage" : self.AttrTransferMessage,
  2379. "manage_exp_status" : self.ManageExpStatus,
  2380. }
  2381.  
  2382. if app.ENABLE_PVP_ADVANCED:
  2383. serverCommandList.update({
  2384. "BINARY_Duel_GetInfo" : self.BINARY_Duel_GetInfo,
  2385. "BINARY_Duel_Request" : self.BINARY_Duel_Request,
  2386. "BINARY_Duel_LiveInterface" : self.BINARY_Duel_LiveInterface,
  2387. "BINARY_Duel_Delete" : self.BINARY_Duel_Delete,
  2388. "equipview" : self.EquipView,
  2389. })
  2390.  
  2391. if app.KASMIR_PAKET_SYSTEM:
  2392. serverCommandList.update({
  2393. "OpenPrivateShopKasmir" : self.Kasmir_Paketi_Open,
  2394. "RefreshOfflineShop" : self.RefreshOfflineShop,
  2395. })
  2396.  
  2397. if app.NEW_PET_SYSTEM:
  2398. serverCommandList.update({
  2399. ##NewPetSystem
  2400. "PetEvolution" : self.SetPetEvolution,
  2401. "PetName" : self.SetPetName,
  2402. "PetLevel" : self.SetPetLevel,
  2403. "PetDuration" : self.SetPetDuration,
  2404. "PetBonus" : self.SetPetBonus,
  2405. "PetSkill" : self.SetPetskill,
  2406. "PetIcon" : self.SetPetIcon,
  2407. "PetExp" : self.SetPetExp,
  2408. "PetUnsummon" : self.PetUnsummon,
  2409. "OpenPetIncubator" : self.OpenPetIncubator,
  2410. "PetAge" : self.PetAge,
  2411. ##EndNewPetSystem
  2412. })
  2413.  
  2414. if app.CHANNEL_CHANGE_SYSTEM:
  2415. serverCommandList.update({
  2416. "channel" : self.BINARY_OnChannelPacket,
  2417. })
  2418.  
  2419. if app.ENABLE_GAYA_SYSTEM:
  2420. serverCommandList.update({
  2421. ##################### GAYA SYSTEM #####################
  2422. "OpenGuiGaya" : self.OpenGuiGaya,
  2423. "GayaCheck" : self.GayaCheck,
  2424.  
  2425. "OpenGuiGayaMarket" :self.OpenGuiGayaMarket,
  2426. "GayaMarketSlotsDesblock" : self.GayaMarketSlotsDesblock,
  2427. "GayaMarketItems" : self.GayaMarketItems,
  2428. "GayaMarketClear" : self.GayaMarketClear,
  2429. "GayaMarketTime" : self.GayaTimeMarket,
  2430. ################# END GAYA SYSTEM #####################
  2431. })
  2432.  
  2433. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  2434. serverCommandList.update({
  2435. "SetBodyCostumeHidden" : self.SetBodyCostumeHidden,
  2436. "SetHairCostumeHidden" : self.SetHairCostumeHidden,
  2437. "SetAcceCostumeHidden" : self.SetAcceCostumeHidden,
  2438. "SetWeaponCostumeHidden" : self.SetWeaponCostumeHidden,
  2439. })
  2440.  
  2441. if app.__ENABLE_EXTEND_INVEN_SYSTEM__:
  2442. serverCommandList.update({
  2443. "update_envanter_need" : self.Update_inventory_need,
  2444. "refreshinven" : self.Update_inventory_ref,
  2445. })
  2446.  
  2447. if app.ENABLE_DUNGEON_INFO_SYSTEM:
  2448. serverCommandList.update({
  2449. "DungeonInfo" : self.DungeonInfo,
  2450. "CleanDungeonInfo" : self.CleanDungeonInfo,
  2451. "CleanDungeonRanking" : self.CleanDungeonRanking,
  2452. "GetDungeonInfo" : self.GetDungeonInfo,
  2453. "UpdateDungeonInfo" : self.UpdateDungeonInfo,
  2454. "UpdateDungeonRanking" : self.UpdateDungeonRanking,
  2455. "UpdateMyDungeonRanking" : self.UpdateMyDungeonRanking,
  2456. "OpenDungeonRanking" : self.OpenDungeonRanking,
  2457. })
  2458.  
  2459. if app.ENABLE_WHISPER_ADMIN_SYSTEM:
  2460. serverCommandList["OnRecvWhisperAdminSystem"] = self.OnRecvWhisperAdminSystem
  2461.  
  2462. if app.ENABLE_SOUL_SYSTEM:
  2463. serverCommandList["RefineSoulSuceeded"] = self.__RefineSoulSuceededMessage
  2464. serverCommandList["RefineSoulFailed"] = self.__RefineSoulFailedMessage
  2465.  
  2466. if app.ENABLE_RUNE_SYSTEM:
  2467. serverCommandList["rune"] = self.RuneStatus
  2468. serverCommandList["rune_affect"] = self.RuneAffect
  2469.  
  2470. self.serverCommander=stringcommander.Analyzer()
  2471. if app.ENABLE_DEFENSE_WAVE:
  2472. serverCommandList["BINARY_Update_Mast_HP"] = self.BINARY_Update_Mast_HP
  2473. serverCommandList["BINARY_Update_Mast_Window"] = self.BINARY_Update_Mast_Window
  2474. serverCommandList["BINARY_Update_Mast_Timer"] = self.BINARY_Update_Mast_Timer
  2475.  
  2476. if app.ENABLE_LOCKED_EXTRA_INVENTORY:
  2477. serverCommandList["RefreshExpandInventory"] = self.RefreshExpandInventory
  2478.  
  2479. if app.ENABLE_CHOOSE_DOCTRINE_GUI:
  2480. serverCommandList["recv_doctrine"] = self.RecvDoctrineGui
  2481.  
  2482. if app.ENABLE_CHRISTMAS_WHEEL_OF_DESTINY:
  2483. serverCommandList["BINARY_WHEEL_ASKOPEN"] = self.BINARY_WHEEL_ASKOPEN
  2484. serverCommandList["BINARY_WHEEL_OPEN"] = self.BINARY_WHEEL_OPEN
  2485. serverCommandList["BINARY_WHEEL_CLOSE"] = self.BINARY_WHEEL_CLOSE
  2486. serverCommandList["BINARY_WHEEL_TURN"] = self.BINARY_WHEEL_TURN
  2487. serverCommandList["BINARY_WHEEL_ICON"] = self.BINARY_WHEEL_ICON
  2488.  
  2489. for serverCommandItem in serverCommandList.items():
  2490. self.serverCommander.SAFE_RegisterCallBack(
  2491. serverCommandItem[0], serverCommandItem[1]
  2492. )
  2493.  
  2494. if app.ENABLE_MELEY_LAIR_DUNGEON:
  2495. self.serverCommander.SAFE_RegisterCallBack("meley_open", self.OpenMeleyRanking)
  2496. self.serverCommander.SAFE_RegisterCallBack("meley_rank", self.AddRankMeleyRanking)
  2497.  
  2498. if app.ENABLE_SORT_INVEN:
  2499. self.serverCommander.SAFE_RegisterCallBack("inv_sort_done", self.Sort_InventoryDone)
  2500. self.serverCommander.SAFE_RegisterCallBack("ext_sort_done", self.Sort_ExtraInventoryDone)
  2501. if app.ENABLE_BIOLOGIST_UI:
  2502. self.serverCommander.SAFE_RegisterCallBack("biologist", self.DoBiologist)
  2503. self.serverCommander.SAFE_RegisterCallBack("biologist_delivered", self.DoBiologistDelivered)
  2504. self.serverCommander.SAFE_RegisterCallBack("biologist_time", self.DoBiologistTime)
  2505. self.serverCommander.SAFE_RegisterCallBack("biologist_reward", self.DoBiologistReward)
  2506. self.serverCommander.SAFE_RegisterCallBack("biologist_close", self.DoBiologistClose)
  2507. self.serverCommander.SAFE_RegisterCallBack("biologist_next", self.DoBiologistNext)
  2508. self.serverCommander.SAFE_RegisterCallBack("biologistch_clear", self.DoBiologistChangeClear)
  2509. self.serverCommander.SAFE_RegisterCallBack("biologistch_append", self.DoBiologistChangeAppend)
  2510. self.serverCommander.SAFE_RegisterCallBack("biologistch_open", self.DoBiologistChangeOpen)
  2511. self.serverCommander.SAFE_RegisterCallBack("biologistch_close", self.DoBiologistChangeClose)
  2512. if app.ENABLE_SAVEPOINT_SYSTEM:
  2513. self.serverCommander.SAFE_RegisterCallBack("append_savepoint", self.DoAppendSavepoint)
  2514. self.serverCommander.SAFE_RegisterCallBack("open_savepoint", self.DoOpenSavepoint)
  2515. self.serverCommander.SAFE_RegisterCallBack("update_savepoint", self.DoUpdateSavepoint)
  2516. if app.ENABLE_WHISPER_ADMIN_SYSTEM:
  2517. self.serverCommander.SAFE_RegisterCallBack("recv_whispersys", self.RecvWhisperSystem)
  2518.  
  2519. if app.ENABLE_CHOOSE_DOCTRINE_GUI:
  2520. def RecvDoctrineGui(self):
  2521. if self.interface:
  2522. self.interface.OnRecvDoctrine()
  2523.  
  2524. if app.ENABLE_BIOLOGIST_UI:
  2525. def DoBiologistTime(self, time):
  2526. n = int(time)
  2527. if n == 1:
  2528. constinfo.haveBiologist = 0
  2529. constinfo.remainBiologistTime = 0
  2530. else:
  2531. constinfo.haveBiologist = 1
  2532. constinfo.remainBiologistTime = n
  2533.  
  2534. def DoBiologist(self, args):
  2535. if self.interface:
  2536. self.interface.OpenBiologist(args)
  2537.  
  2538. def DoBiologistDelivered(self, args):
  2539. if self.interface:
  2540. self.interface.DeliveredBiologist(args)
  2541.  
  2542. def DoBiologistReward(self, args):
  2543. if self.interface:
  2544. self.interface.RewardBiologist(args)
  2545.  
  2546. def DoBiologistClose(self):
  2547. if self.interface:
  2548. self.interface.CloseBiologist()
  2549.  
  2550. def DoBiologistNext(self, args):
  2551. if self.interface:
  2552. self.interface.NextBiologist(args)
  2553.  
  2554. def DoBiologistChangeClear(self):
  2555. if self.interface:
  2556. self.interface.ClearBiologistChange()
  2557.  
  2558. def DoBiologistChangeAppend(self, args):
  2559. if self.interface:
  2560. self.interface.AppendBiologistChange(args)
  2561.  
  2562. def DoBiologistChangeOpen(self):
  2563. if self.interface:
  2564. self.interface.OpenBiologistChange()
  2565.  
  2566. def DoBiologistChangeClose(self):
  2567. if self.interface:
  2568. self.interface.CloseBiologistChange()
  2569.  
  2570. if app.ENABLE_SORT_INVEN:
  2571. def Sort_InventoryDone(self):
  2572. if self.interface:
  2573. self.interface.Sort_InventoryDone()
  2574.  
  2575. def Sort_ExtraInventoryDone(self):
  2576. if self.interface:
  2577. self.interface.Sort_ExtraInventoryDone()
  2578.  
  2579. if app.ENABLE_LOCKED_EXTRA_INVENTORY:
  2580. def RefreshExpandInventory(self):
  2581. if self.interface:
  2582. self.interface.ExtraInventoryRefresh()
  2583.  
  2584. def ManageExpStatus(self, arg):
  2585. constinfo.exp_status = int(arg)
  2586. if self.interface:
  2587. self.interface.RefreshExpBtn()
  2588.  
  2589. if app.ENABLE_CUBE_RENEWAL_WORLDARD:
  2590. def BINARY_CUBE_RENEWAL_OPEN(self):
  2591. if self.interface:
  2592. self.interface.BINARY_CUBE_RENEWAL_OPEN()
  2593.  
  2594. def BINARY_ServerCommand_Run(self, line):
  2595. #dbg.TraceError(line)
  2596. try:
  2597. #print " BINARY_ServerCommand_Run", line
  2598. return self.serverCommander.Run(line)
  2599. except RuntimeError, msg:
  2600. dbg.TraceError(msg)
  2601. return 0
  2602.  
  2603. def __ProcessPreservedServerCommand(self):
  2604. try:
  2605. command = net.GetPreservedServerCommand()
  2606. while command:
  2607. print " __ProcessPreservedServerCommand", command
  2608. self.serverCommander.Run(command)
  2609. command = net.GetPreservedServerCommand()
  2610. except RuntimeError, msg:
  2611. dbg.TraceError(msg)
  2612. return 0
  2613.  
  2614. def PartyHealReady(self):
  2615. self.interface.PartyHealReady()
  2616.  
  2617. def AskSafeboxPassword(self):
  2618. self.interface.AskSafeboxPassword()
  2619.  
  2620. # ITEM_MALL
  2621. def AskMallPassword(self):
  2622. self.interface.AskMallPassword()
  2623.  
  2624. def __ItemMall_Open(self):
  2625. self.interface.OpenItemMall();
  2626.  
  2627. def AttrTransferMessage(self):
  2628. snd.PlaySound("sound/ui/make_soket.wav")
  2629. self.PopupMessage(localeinfo.COMB_ALERT)
  2630.  
  2631. def CommandCloseMall(self):
  2632. self.interface.CommandCloseMall()
  2633. # END_OF_ITEM_MALL
  2634.  
  2635. def RefineSuceededMessage(self):
  2636. snd.PlaySound("sound/ui/make_soket.wav")
  2637. self.PopupMessage(localeinfo.REFINE_SUCCESS)
  2638.  
  2639. def RefineFailedMessage(self):
  2640. snd.PlaySound("sound/ui/jaeryun_fail.wav")
  2641. self.PopupMessage(localeinfo.REFINE_FAILURE)
  2642.  
  2643. if app.ENABLE_SOUL_SYSTEM:
  2644. def __RefineSoulSuceededMessage(self):
  2645. snd.PlaySound("sound/ui/make_soket.wav")
  2646. self.PopupMessage(localeinfo.SOUL_REFINE_SUCCESS)
  2647.  
  2648. def __RefineSoulFailedMessage(self):
  2649. snd.PlaySound("sound/ui/jaeryun_fail.wav")
  2650. self.PopupMessage(localeinfo.SOUL_REFINE_FAILURE)
  2651.  
  2652. def CommandCloseSafebox(self):
  2653. self.interface.CommandCloseSafebox()
  2654.  
  2655. # PRIVATE_SHOP_PRICE_LIST
  2656. def __PrivateShop_PriceList(self, itemVNum, itemPrice):
  2657. uiprivateshopbuilder.SetPrivateShopItemPrice(itemVNum, itemPrice)
  2658. # END_OF_PRIVATE_SHOP_PRICE_LIST
  2659.  
  2660. if app.CHANNEL_CHANGE_SYSTEM:
  2661. def BINARY_OnChannelPacket(self, channelID):
  2662. import serverinfo
  2663. regionID = 0
  2664. channelID = int(channelID)
  2665. if channelID == 0:
  2666. return
  2667.  
  2668. dict = {'name' : 'World of Metin2'}
  2669. if channelID == 99:
  2670. net.SetServerInfo((localeinfo.CH_99_NAME % (dict['name'])).strip())
  2671. else:
  2672. net.SetServerInfo((localeinfo.TEXT_CHANNEL % (dict['name'], channelID)).strip())
  2673.  
  2674. if self.interface:
  2675. self.interface.wndMiniMap.serverinfo.SetText(net.GetServerInfo())
  2676.  
  2677.  
  2678. for serverID in serverinfo.REGION_DICT[regionID].keys():
  2679. if serverinfo.REGION_DICT[regionID][serverID]["name"] == net.GetServerInfo().split(",")[0]:
  2680. try:
  2681. serverName = serverinfo.REGION_DICT[regionID][serverID]["name"]
  2682. channelName = serverinfo.REGION_DICT[regionID][serverID]["channel"][channelID]["name"]
  2683. markKey = regionID * 1000 + serverID * 10
  2684. markAddrValue=serverinfo.MARKADDR_DICT[markKey]
  2685. net.SetMarkServer(markAddrValue["ip"], markAddrValue["tcp_port"])
  2686. app.SetGuildMarkPath(markAddrValue["mark"])
  2687. app.SetGuildSymbolPath(markAddrValue["symbol_path"])
  2688. net.SetServerInfo("%s, %s" % (serverName, channelName))
  2689. except:
  2690. pass
  2691.  
  2692.  
  2693. def __Horse_HideState(self):
  2694. self.affectShower.SetHorseState(0, 0, 0)
  2695.  
  2696. if app.ENABLE_PVP_ADVANCED:
  2697. def ClickPvpEquipment(self):
  2698. if constinfo.equipview == 0:
  2699. net.SendChatPacket("/pvp_block_equipment BLOCK")
  2700. else:
  2701. net.SendChatPacket("/pvp_block_equipment UNBLOCK")
  2702.  
  2703. def BINARY_Duel_GetInfo(self, a, b, c, d, e, f, g, h):
  2704. self.wndDuelGui.OpenDialog(a, b, c, d, e, f, g, h)
  2705.  
  2706. def BINARY_Duel_Request(self, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q):
  2707. self.wndDuelGui.OpenDialog(a, b, c, d, e, f, g, h)
  2708. self.wndDuelGui.Selected([int(i), int(j), int(k), int(l), int(m), int(n), int(o), int(p), int(q)])
  2709.  
  2710. def BINARY_Duel_Delete(self):
  2711. self.wndDuelGui.Remove()
  2712.  
  2713. if self.wndDuelLive:
  2714. self.wndDuelLive.Close()
  2715.  
  2716. def BINARY_Duel_LiveInterface(self, a, b, c, d, e, f, g, h, i, j, k, l):
  2717. miniPetIsShowing = False
  2718. if app.NEW_PET_SYSTEM:
  2719. if self.petmini.IsShow():
  2720. miniPetIsShowing = True
  2721.  
  2722. if self.wndDuelLive:
  2723. self.wndDuelLive.ShowInformations([str(a), int(b), int(c), int(d), int(e), int(f), int(g), int(h), int(i), int(j), int(k), int(l)], miniPetIsShowing)
  2724.  
  2725. def EquipView(self, s):
  2726. i = 0
  2727. try:
  2728. i = int(s)
  2729. except:
  2730. pass
  2731.  
  2732. constinfo.equipview = i
  2733. # if self.interface:
  2734. # self.interface.OnRefreshBtnPvpMinimap()
  2735.  
  2736. def BINARY_SetDialogMessage(self, msg):
  2737. self.wndMsg = message.PopupDialog()
  2738. self.wndMsg.SetWidth(550)
  2739. self.wndMsg.SetText(msg)
  2740. self.wndMsg.Show()
  2741.  
  2742. def __Horse_UpdateState(self, level, health, battery):
  2743. self.affectShower.SetHorseState(int(level), int(health), int(battery))
  2744.  
  2745. def __IsXMasMap(self):
  2746. mapDict = ( "metin2_map_n_flame_01",
  2747. "metin2_map_n_desert_01",
  2748. "metin2_map_spiderdungeon",
  2749. "metin2_map_deviltower1", )
  2750.  
  2751. if background.GetCurrentMapName() in mapDict:
  2752. return False
  2753.  
  2754. return True
  2755.  
  2756. def __XMasSnow_Enable(self, mode):
  2757.  
  2758. self.__XMasSong_Enable(mode)
  2759.  
  2760. if "1"==mode:
  2761.  
  2762. if not self.__IsXMasMap():
  2763. return
  2764.  
  2765. print "XMAS_SNOW ON"
  2766. background.EnableSnow(1)
  2767.  
  2768. else:
  2769. print "XMAS_SNOW OFF"
  2770. background.EnableSnow(0)
  2771.  
  2772. def __XMasBoom_Enable(self, mode):
  2773. if "1"==mode:
  2774.  
  2775. if not self.__IsXMasMap():
  2776. return
  2777.  
  2778. print "XMAS_BOOM ON"
  2779. self.__DayMode_Update("dark")
  2780. self.enableXMasBoom = True
  2781. self.startTimeXMasBoom = app.GetTime()
  2782. else:
  2783. print "XMAS_BOOM OFF"
  2784. self.__DayMode_Update("light")
  2785. self.enableXMasBoom = False
  2786.  
  2787. def __XMasTree_Enable(self, grade):
  2788.  
  2789. print "XMAS_TREE ", grade
  2790. background.SetXMasTree(int(grade))
  2791.  
  2792. def __XMasSong_Enable(self, mode):
  2793. if "1"==mode:
  2794. print "XMAS_SONG ON"
  2795.  
  2796. XMAS_BGM = "xmas.mp3"
  2797.  
  2798. if app.IsExistFile("BGM/" + XMAS_BGM)==1:
  2799. if musicinfo.fieldMusic != "":
  2800. snd.FadeOutMusic("BGM/" + musicinfo.fieldMusic)
  2801.  
  2802. musicinfo.fieldMusic=XMAS_BGM
  2803. snd.FadeInMusic("BGM/" + musicinfo.fieldMusic)
  2804.  
  2805. else:
  2806. print "XMAS_SONG OFF"
  2807.  
  2808. if musicinfo.fieldMusic != "":
  2809. snd.FadeOutMusic("BGM/" + musicinfo.fieldMusic)
  2810.  
  2811. musicinfo.fieldMusic=musicinfo.METIN2THEMA
  2812. snd.FadeInMusic("BGM/" + musicinfo.fieldMusic)
  2813.  
  2814. def __RestartDialog_Close(self):
  2815. self.interface.CloseRestartDialog()
  2816.  
  2817. def __Console_Enable(self):
  2818. constinfo.CONSOLE_ENABLE = True
  2819. self.consoleEnable = True
  2820. app.EnableSpecialCameraMode()
  2821. ui.EnablePaste(True)
  2822.  
  2823. ## PrivateShop
  2824. def __PrivateShop_Open(self):
  2825. self.interface.OpenPrivateShopInputNameDialog()
  2826.  
  2827. if app.KASMIR_PAKET_SYSTEM:
  2828. def RefreshOfflineShop(self):
  2829. if not app.__ENABLE_NEW_OFFLINESHOP__:
  2830. return
  2831. else:
  2832. if self.Offlineshop:
  2833. self.Offlineshop.OpeningFailded()
  2834.  
  2835. def __PrivateShop_Kasmir_Open(self):
  2836. self.interface.OpenPrivateShopKasmirInputNameDialog()
  2837.  
  2838. def Kasmir_Paketi_Open(self):
  2839. self.interface.OpenKasmirPaketiDialog()
  2840.  
  2841. def BINARY_PrivateShop_Appear(self, vid, text, baslik):
  2842. self.interface.AppearPrivateShop(vid, text, baslik)
  2843. else:
  2844. def BINARY_PrivateShop_Appear(self, vid, text):
  2845. self.interface.AppearPrivateShop(vid, text)
  2846.  
  2847. def BINARY_PrivateShop_Disappear(self, vid):
  2848. self.interface.DisappearPrivateShop(vid)
  2849.  
  2850. ## DayMode
  2851. def __PRESERVE_DayMode_Update(self, mode):
  2852. if "light"==mode:
  2853. background.SetEnvironmentData(0)
  2854. elif "dark"==mode:
  2855.  
  2856. if not self.__IsXMasMap():
  2857. return
  2858.  
  2859.  
  2860. background.RegisterEnvironmentData(1, constinfo.ENVIRONMENT_NIGHT)
  2861. background.SetEnvironmentData(1)
  2862.  
  2863. #def __DayMode_Update(self, mode):
  2864. # if "light"==mode:
  2865. # self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
  2866. # elif "dark"==mode:
  2867. #
  2868. # if not self.__IsXMasMap():
  2869. # return
  2870. #
  2871. # self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
  2872.  
  2873. def __DayMode_Update(self, mode):
  2874. if "light"==mode:
  2875. systemSetting.SetEnvironment(0)
  2876. elif "dark"==mode:
  2877. systemSetting.SetEnvironment(1)
  2878.  
  2879. #def __DayMode_OnCompleteChangeToLight(self):
  2880. # background.SetEnvironmentData(0)
  2881. # self.curtain.FadeIn()
  2882. #
  2883. #def __DayMode_OnCompleteChangeToDark(self):
  2884. # background.RegisterEnvironmentData(1, constinfo.ENVIRONMENT_NIGHT)
  2885. # background.SetEnvironmentData(1)
  2886. # self.curtain.FadeIn()
  2887.  
  2888. ## XMasBoom
  2889. def __XMasBoom_Update(self):
  2890.  
  2891. self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
  2892. if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
  2893. return
  2894.  
  2895. boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
  2896. boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
  2897.  
  2898. if app.GetTime() - self.startTimeXMasBoom > boomTime:
  2899.  
  2900. self.indexXMasBoom += 1
  2901.  
  2902. for i in xrange(boomCount):
  2903. self.__XMasBoom_Boom()
  2904.  
  2905. def __XMasBoom_Boom(self):
  2906. x, y, z = player.GetMainCharacterPosition()
  2907. randX = app.GetRandom(-150, 150)
  2908. randY = app.GetRandom(-150, 150)
  2909.  
  2910. snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
  2911.  
  2912. def __PartyRequestQuestion(self, vid):
  2913. vid = int(vid)
  2914. partyRequestQuestionDialog = uicommon.QuestionDialog()
  2915. partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + localeinfo.PARTY_DO_YOU_ACCEPT)
  2916. partyRequestQuestionDialog.SetAcceptText(localeinfo.UI_ACCEPT)
  2917. partyRequestQuestionDialog.SetCancelText(localeinfo.UI_DENY)
  2918. partyRequestQuestionDialog.SetAcceptEvent(lambda arg=True: self.__AnswerPartyRequest(arg))
  2919. partyRequestQuestionDialog.SetCancelEvent(lambda arg=False: self.__AnswerPartyRequest(arg))
  2920. partyRequestQuestionDialog.Open()
  2921. partyRequestQuestionDialog.vid = vid
  2922. self.partyRequestQuestionDialog = partyRequestQuestionDialog
  2923.  
  2924. def __AnswerPartyRequest(self, answer):
  2925. if not self.partyRequestQuestionDialog:
  2926. return
  2927.  
  2928. vid = self.partyRequestQuestionDialog.vid
  2929.  
  2930. if answer:
  2931. net.SendChatPacket("/party_request_accept " + str(vid))
  2932. else:
  2933. net.SendChatPacket("/party_request_deny " + str(vid))
  2934.  
  2935. self.partyRequestQuestionDialog.Close()
  2936. self.partyRequestQuestionDialog = None
  2937.  
  2938. def __PartyRequestDenied(self):
  2939. self.PopupMessage(localeinfo.PARTY_REQUEST_DENIED)
  2940.  
  2941. def __EnableTestServerFlag(self):
  2942. app.EnableTestServerFlag()
  2943.  
  2944. def __InGameShop_Show(self, url):
  2945. if constinfo.IN_GAME_SHOP_ENABLE:
  2946. self.interface.OpenWebWindow(url)
  2947.  
  2948. # WEDDING
  2949. def __LoginLover(self):
  2950. if self.interface.wndMessenger:
  2951. self.interface.wndMessenger.OnLoginLover()
  2952.  
  2953. def __LogoutLover(self):
  2954. if self.interface.wndMessenger:
  2955. self.interface.wndMessenger.OnLogoutLover()
  2956. if self.affectShower:
  2957. self.affectShower.HideLoverState()
  2958.  
  2959. def __LoverNear(self):
  2960. if self.affectShower:
  2961. self.affectShower.ShowLoverState()
  2962.  
  2963. def __LoverFar(self):
  2964. if self.affectShower:
  2965. self.affectShower.HideLoverState()
  2966.  
  2967. def __LoverDivorce(self):
  2968. if self.interface.wndMessenger:
  2969. self.interface.wndMessenger.ClearLoverInfo()
  2970. if self.affectShower:
  2971. self.affectShower.ClearLoverState()
  2972.  
  2973. def __PlayMusic(self, flag, filename):
  2974. flag = int(flag)
  2975. if flag:
  2976. snd.FadeOutAllMusic()
  2977. musicinfo.SaveLastPlayFieldMusic()
  2978. snd.FadeInMusic("BGM/" + filename)
  2979. else:
  2980. snd.FadeOutAllMusic()
  2981. musicinfo.LoadLastPlayFieldMusic()
  2982. snd.FadeInMusic("BGM/" + musicinfo.fieldMusic)
  2983.  
  2984. if app.ENABLE_ACCE_SYSTEM:
  2985. def ActAcce(self, iAct, bWindow):
  2986. if self.interface:
  2987. self.interface.ActAcce(iAct, bWindow)
  2988.  
  2989. def AlertAcce(self, bWindow):
  2990. snd.PlaySound("sound/ui/make_soket.wav")
  2991. if bWindow:
  2992. self.PopupMessage(localeinfo.ACCE_DEL_SERVEITEM)
  2993. else:
  2994. self.PopupMessage(localeinfo.ACCE_DEL_ABSORDITEM)
  2995.  
  2996. if app.ENABLE_DEFENSE_WAVE:
  2997. def BINARY_Update_Mast_HP(self, hp):
  2998. self.interface.BINARY_Update_Mast_HP(int(hp))
  2999.  
  3000. def BINARY_Update_Mast_Timer(self, text):
  3001. self.interface.BINARY_Update_Mast_Timer(text)
  3002.  
  3003. def BINARY_Update_Mast_Window(self, i):
  3004. self.interface.BINARY_Update_Mast_Window(int(i))
  3005.  
  3006. if app.ENABLE_MELEY_LAIR_DUNGEON:
  3007. def OpenMeleyRanking(self):
  3008. if self.interface:
  3009. self.interface.OpenMeleyRanking()
  3010.  
  3011. def AddRankMeleyRanking(self, data):
  3012. if self.interface:
  3013. line = int(data.split("#")[1])
  3014. name = str(data.split("#")[2])
  3015. members = int(data.split("#")[3])
  3016. seconds = int(data.split("#")[4])
  3017. minutes = seconds // 60
  3018. seconds %= 60
  3019. if seconds > 0:
  3020. time = localeinfo.TIME_MIN_SEC % (minutes, seconds)
  3021. else:
  3022. time = localeinfo.TIME_MIN % (minutes)
  3023.  
  3024. self.interface.RankMeleyRanking(line, name, members, time)
  3025.  
  3026.  
  3027.  
  3028. # END_OF_WEDDING
  3029.  
  3030. if app.ENABLE_SWITCHBOT:
  3031. def RefreshSwitchbotWindow(self):
  3032. if self.interface:
  3033. self.interface.RefreshSwitchbotWindow()
  3034.  
  3035. def RefreshSwitchbotItem(self, slot):
  3036. if self.interface:
  3037. self.interface.RefreshSwitchbotItem(slot)
  3038.  
  3039. def ManagerGiftSystem(self, cmd):
  3040. cmd = cmd.split("|")
  3041. if cmd[0] == "Show":
  3042. self.wnddailygift.Open()
  3043. elif cmd[0] == "DeleteRewards":
  3044. self.wnddailygift.DeleteRewards()
  3045. elif cmd[0] == "SetDailyReward":
  3046. self.wnddailygift.SetDailyReward(cmd[1])
  3047. elif cmd[0] == "SetTime":
  3048. self.wnddailygift.SetTime(cmd[1])
  3049. elif cmd[0] == "SetReward":
  3050. self.wnddailygift.SetReward(cmd[1], cmd[2])
  3051. elif cmd[0] == "SetRewardDone":
  3052. self.wnddailygift.SetRewardDone()
  3053.  
  3054. if app.ENABLE_GAYA_SYSTEM:
  3055. def OpenGuiGaya(self):
  3056. self.interface.OpenGuiGaya()
  3057.  
  3058. def GayaCheck(self):
  3059. self.interface.GayaCheck()
  3060.  
  3061. def OpenGuiGayaMarket(self):
  3062. self.interface.OpenGuiGayaMarket()
  3063.  
  3064. def GayaMarketItems(self,vnums,gaya,count):
  3065. self.interface.GayaMarketItems(vnums,gaya,count)
  3066.  
  3067. def GayaMarketSlotsDesblock(self,slot0,slot1,slot2,slot3,slot4,slot5):
  3068. self.interface.GayaMarketSlotsDesblock(slot0,slot1,slot2,slot3,slot4,slot5)
  3069.  
  3070. def GayaMarketClear(self):
  3071. self.interface.GayaMarketClear()
  3072.  
  3073. def GayaTimeMarket(self, time):
  3074. self.interface.GayaTime(time)
  3075.  
  3076. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  3077. def SetBodyCostumeHidden(self, hidden):
  3078. constinfo.HIDDEN_BODY_COSTUME = int(hidden)
  3079. self.interface.RefreshVisibleCostume()
  3080.  
  3081. def SetHairCostumeHidden(self, hidden):
  3082. constinfo.HIDDEN_HAIR_COSTUME = int(hidden)
  3083. self.interface.RefreshVisibleCostume()
  3084.  
  3085. def SetAcceCostumeHidden(self, hidden):
  3086. if app.ENABLE_ACCE_COSTUME_SYSTEM:
  3087. constinfo.HIDDEN_ACCE_COSTUME = int(hidden)
  3088. self.interface.RefreshVisibleCostume()
  3089. else:
  3090. pass
  3091.  
  3092. def SetWeaponCostumeHidden(self, hidden):
  3093. if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  3094. constinfo.HIDDEN_WEAPON_COSTUME = int(hidden)
  3095. self.interface.RefreshVisibleCostume()
  3096. else:
  3097. pass
  3098.  
  3099.  
  3100. if app.__ENABLE_EXTEND_INVEN_SYSTEM__:
  3101. def Update_inventory_ref(self):
  3102. if self.interface:
  3103. self.interface.SetInventoryPageLock()
  3104.  
  3105. def Update_inventory_need(self, need):
  3106. self.wndPopupDialog = uicommon.PopupDialog()
  3107. self.wndPopupDialog.SetText(localeinfo.ENVANTER_KEY_NEED % int(need))
  3108. self.wndPopupDialog.Open()
  3109.  
  3110. if app.ENABLE_BATTLE_PASS:
  3111. def OpenBattlePassWindow(self):
  3112. net.SendBattlePassAction(1)
  3113.  
  3114. def BINARY_BattlePassOpen(self):
  3115. if self.interface:
  3116. self.interface.OpenBattlePass()
  3117.  
  3118. def BINARY_BattlePassAddMission(self, missionType, missionInfo1, missionInfo2, missionInfo3):
  3119. if self.interface:
  3120. self.interface.AddBattlePassMission(missionType, missionInfo1, missionInfo2, missionInfo3)
  3121.  
  3122. def BINARY_BattlePassAddMissionReward(self, missionType, itemVnum, itemCount):
  3123. if self.interface:
  3124. self.interface.AddBattlePassMissionReward(missionType, itemVnum, itemCount)
  3125.  
  3126. def BINARY_BattlePassUpdate(self, missionType, newProgress):
  3127. if self.interface:
  3128. self.interface.UpdateBattlePassMission(missionType, newProgress)
  3129.  
  3130. def BINARY_BattlePassAddReward(self, itemVnum, itemCount):
  3131. if self.interface:
  3132. self.interface.AddBattlePassReward(itemVnum, itemCount)
  3133.  
  3134. def BINARY_BattlePassAddRanking(self, pos, playerName, finishTime):
  3135. if self.interface:
  3136. self.interface.AddBattlePassRanking(pos, playerName, finishTime)
  3137.  
  3138. def BINARY_BattlePassRefreshRanking(self):
  3139. if self.interface:
  3140. self.interface.RefreshBattlePassRanking()
  3141.  
  3142. def BINARY_BattlePassOpenRanking(self):
  3143. if self.interface:
  3144. self.interface.OpenBattlePassRanking()
  3145.  
  3146. if app.NEW_PET_SYSTEM:
  3147. def SetPetEvolution(self, evo):
  3148. petname = [localeinfo.PET_MISSING1_1, localeinfo.PET_MISSING1_2, localeinfo.PET_MISSING1_3, localeinfo.PET_MISSING1_4]
  3149. self.petmain.SetEvolveName(petname[int(evo)])
  3150. constinfo.PETMINIEVO = int(evo)
  3151. if app.ENABLE_PVP_ADVANCED:
  3152. if self.wndDuelLive:
  3153. self.wndDuelLive.UpdatePosition(True)
  3154.  
  3155. def SetPetName(self, name):
  3156. if len(name) > 1 and name != "":
  3157. self.petmini.Show()
  3158. self.petmain.SetName(name)
  3159.  
  3160. def SetPetLevel(self, level):
  3161. self.petmain.SetLevel(level)
  3162. constinfo.PETMINILEVEL = int(level)
  3163.  
  3164. def SetPetDuration(self, dur, durt):
  3165. if int(durt) > 0:
  3166. self.petmini.SetDuration(dur, durt)
  3167. self.petmain.SetDuration(dur, durt)
  3168.  
  3169. def PetAge(self, arg):
  3170. self.petmain.SetAge(int(arg))
  3171.  
  3172. def SetPetBonus(self, hp, dif, sp):
  3173. self.petmain.SetHp(hp)
  3174. self.petmain.SetDef(dif)
  3175. self.petmain.SetSp(sp)
  3176.  
  3177. def SetPetskill(self, slot, idx, lv):
  3178. self.petmini.SetSkill(slot, idx, lv)
  3179. self.petmain.SetSkill(slot, idx, lv)
  3180. if int(slot) == 0:
  3181. if self.affectShower:
  3182. self.affectShower.BINARY_NEW_RemoveAffect(int(constinfo.SKILL_PET1), 0)
  3183.  
  3184. constinfo.SKILL_PET1 = 5400 + int(idx)
  3185.  
  3186. if int(slot) == 1:
  3187. if self.affectShower:
  3188. self.affectShower.BINARY_NEW_RemoveAffect(int(constinfo.SKILL_PET2), 0)
  3189.  
  3190. constinfo.SKILL_PET2 = 5400 + int(idx)
  3191.  
  3192. if int(slot) == 2:
  3193. if self.affectShower:
  3194. self.affectShower.BINARY_NEW_RemoveAffect(int(constinfo.SKILL_PET3), 0)
  3195.  
  3196. constinfo.SKILL_PET3 = 5400 + int(idx)
  3197.  
  3198. if int(slot) == 3:
  3199. if self.affectShower:
  3200. self.affectShower.BINARY_NEW_RemoveAffect(int(constinfo.SKILL_PET4), 0)
  3201.  
  3202. constinfo.SKILL_PET4 = 5400 + int(idx)
  3203.  
  3204. if int(idx) > 0:
  3205. if self.affectShower:
  3206. self.affectShower.BINARY_NEW_AddAffect(5400+int(idx), int(constinfo.LASTAFFECT_POINT)+1, int(constinfo.LASTAFFECT_VALUE)+1, 0)
  3207.  
  3208. def SetPetIcon(self, vnum):
  3209. if int(vnum) > 0:
  3210. self.petmini.SetImageSlot(vnum)
  3211. self.petmain.SetImageSlot(vnum)
  3212.  
  3213. def SetPetExp(self, exp, expi, exptot):
  3214. if int(exptot) > 0:
  3215. self.petmini.SetExperience(exp, expi, exptot)
  3216. self.petmain.SetExperience(exp, expi, exptot)
  3217.  
  3218. def PetUnsummon(self):
  3219. self.petmini.SetDefaultInfo()
  3220. self.petmini.Close()
  3221. self.petmain.SetDefaultInfo()
  3222. self.affectShower.BINARY_NEW_RemoveAffect(int(constinfo.SKILL_PET1), 0)
  3223. self.affectShower.BINARY_NEW_RemoveAffect(int(constinfo.SKILL_PET2), 0)
  3224. self.affectShower.BINARY_NEW_RemoveAffect(int(constinfo.SKILL_PET3), 0)
  3225. self.affectShower.BINARY_NEW_RemoveAffect(int(constinfo.SKILL_PET4), 0)
  3226. constinfo.SKILL_PET1 = 0
  3227. constinfo.SKILL_PET2 = 0
  3228. constinfo.SKILL_PET3 = 0
  3229. constinfo.SKILL_PET4 = 0
  3230. if app.ENABLE_PVP_ADVANCED:
  3231. if self.wndDuelLive:
  3232. self.wndDuelLive.UpdatePosition(False)
  3233.  
  3234. def OpenPetMainGui(self):
  3235. if not self.petmain.IsShow():
  3236. self.petmain.Show()
  3237. self.petmain.SetTop()
  3238. else:
  3239. self.petmain.Close()
  3240.  
  3241. def OpenPetIncubator(self, pet_new = 0):
  3242. import uipetincubatrice
  3243. self.petinc = uipetincubatrice.PetSystemIncubator(pet_new)
  3244. self.petinc.Show()
  3245. self.petinc.SetTop()
  3246.  
  3247. def OpenPetMini(self):
  3248. self.petmini.Show()
  3249. self.petmini.SetTop()
  3250.  
  3251. def OpenPetFeed(self):
  3252. self.feedwind = uipetfeed.PetFeedWindow()
  3253. self.feedwind.Show()
  3254. self.feedwind.SetTop()
  3255.  
  3256. if app.ENABLE_MULTI_LANGUAGE:
  3257. def BINARY_RequestChangeLanguage(self, language):
  3258. serverLang = constinfo.TRANSFORM_LANG(language)
  3259. if app.GetLocaleName() != serverLang:
  3260. net.SendChangeLanguagePacket(constinfo.TRANSFORM_LANG(app.GetLocaleName()))
  3261.  
  3262. def BINARY_RecvTargetLang(self, name, lang):
  3263. if self.interface:
  3264. self.interface.RecvLangOnWhisper(name, lang)
  3265.  
  3266. if app.ENABLE_WHISPER_ADMIN_SYSTEM:
  3267. def OnRecvWhisperAdminSystem(self, name, line, color):
  3268.  
  3269. def ExistCustomColor(val):
  3270. return (val > 0)
  3271.  
  3272. def GetColor(type):
  3273. WHISPER_COLOR_MESSAGE = {
  3274. 0: "|cffffffff|H|h",
  3275. 1: "|cffff796a|H|h",
  3276. 2: "|cffb1ff80|H|h",
  3277. 3: "|cff46deff|H|h"
  3278. }
  3279. return WHISPER_COLOR_MESSAGE[type]
  3280.  
  3281. def ResizeTextWithColor(color, text):
  3282. return str("%s%s|h|r" % (GetColor(color), text))
  3283.  
  3284. import datetime
  3285. now = datetime.datetime.now()
  3286. ret = line.replace("#", " ")
  3287. line2 = ret
  3288.  
  3289. if ExistCustomColor(int(color)):
  3290. ret = ResizeTextWithColor(int(color), ret)
  3291. else:
  3292. ret = ResizeTextWithColor(0, ret)
  3293.  
  3294. time = now.strftime("%Y-%m-%d %H:%M")
  3295. text = localeinfo.WHISPER_ADMIN_MESSAGE % (time, ret)
  3296.  
  3297. self.interface.RegisterGameMasterName(name)
  3298. chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, name, text)
  3299. self.interface.RecvWhisper(name)
  3300.  
  3301. #def OpenTeleporter(self):
  3302. # if self.interface:
  3303. # self.interface.ToggleMapTeleporter()
  3304.  
  3305. def OpenSavepoint(self):
  3306. if self.interface:
  3307. self.interface.ClickBtnSavepoint()
  3308.  
  3309. if app.ENABLE_EXTRA_INVENTORY:
  3310. def OpenExtrainventory(self):
  3311. if self.interface:
  3312. self.interface.ToggleExtraInventoryWindow()
  3313.  
  3314. def OpenDungeoninfo(self):
  3315. if self.interface:
  3316. self.interface.ToggleDungeonInfoWindow()
  3317.  
  3318. if app.ENABLE_WHISPER_ADMIN_SYSTEM:
  3319. def OpenWhisperSystem(self):
  3320. net.SendChatPacket("/open_whispersys")
  3321.  
  3322. def RecvWhisperSystem(self):
  3323. if self.interface:
  3324. self.interface.OpenWhisperSystem()
  3325.  
  3326. def BINARY_RecieveWhisperInfo(self, name, language, empire):
  3327. if self.interface:
  3328. self.interface.RecieveWhisperDetails(name, language, empire)
  3329.  
  3330. if app.INGAME_WIKI:
  3331. def ToggleWikiWindow(self):
  3332. if not self.wndWiki:
  3333. return
  3334.  
  3335. if self.wndWiki.IsShow():
  3336. self.wndWiki.Hide()
  3337. else:
  3338. self.wndWiki.Show()
  3339. self.wndWiki.SetTop()
  3340.  
  3341. if app.WJ_ENABLE_TRADABLE_ICON:
  3342. def BINARY_AddItemToExchange(self, inven_type, inven_pos, display_pos):
  3343. if inven_type == player.INVENTORY:
  3344. self.interface.CantTradableItemExchange(display_pos, inven_pos)
  3345. elif inven_type == player.EXTRA_INVENTORY:
  3346. self.interface.CantTradableExtraItemExchange(display_pos, inven_pos)
  3347.  
  3348. if app.ENABLE_SAVEPOINT_SYSTEM:
  3349. def DoAppendSavepoint(self, id, name, mapIndex, x, y):
  3350. if self.interface:
  3351. self.interface.AppendSavepoint(id, name, mapIndex, x, y)
  3352.  
  3353. def DoOpenSavepoint(self):
  3354. if self.interface:
  3355. self.interface.OpenSavepoint()
  3356.  
  3357. def DoUpdateSavepoint(self, id, name, mapIndex, x, y):
  3358. if self.interface:
  3359. self.interface.UpdateSavepoint(id, name, mapIndex, x, y)
  3360.  
  3361. if app.ENABLE_CHRISTMAS_WHEEL_OF_DESTINY:
  3362. def BINARY_WHEEL_ASKOPEN(self):
  3363. if not self.wheeldestiny.IsShow():
  3364. net.WheelPacket(0)
  3365.  
  3366. def BINARY_WHEEL_OPEN(self):
  3367. if self.wheeldestiny:
  3368. self.wheeldestiny.Open(0, 0)
  3369.  
  3370. def BINARY_WHEEL_CLOSE(self):
  3371. if self.wheeldestiny:
  3372. self.wheeldestiny.Close()
  3373.  
  3374. def BINARY_WHEEL_TURN(self, item, count, spin, number):
  3375. if self.wheeldestiny.IsShow():
  3376. self.wheeldestiny.TurnWheel(item, count, spin, number)
  3377.  
  3378. def BINARY_WHEEL_ICON(self, item, count, number):
  3379. if self.wheeldestiny:
  3380. self.wheeldestiny.SetIcons(item, count, number)
  3381.  
  3382. def __toggleSwitchbot(self):
  3383. if self.switchbot.bot_shown == 1:
  3384. self.switchbot.Hide()
  3385. else:
  3386. self.switchbot.Show()
Advertisement
Add Comment
Please, Sign In to add comment