Advertisement
Guest User

Untitled

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