Advertisement
Guest User

game.py

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