Advertisement
Guest User

game.py

a guest
Jan 17th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 94.21 KB | None | 0 0
  1. import os
  2. import app
  3. import dbg
  4. import day
  5. import grp
  6. import item
  7. import background
  8. import chr
  9. import chrmgr
  10. import player
  11. import snd
  12. import chat
  13. import textTail
  14. import snd
  15. import net
  16. import effect
  17. import calendar
  18. import wndMgr
  19. import uiwiki
  20. import fly
  21. import systemSetting
  22. import quest
  23. import guild
  24. import skill
  25. import messenger
  26. import uimarbleshop
  27. import localeInfo
  28. import constInfo
  29. import exchange
  30. import ime
  31. import uisidebar
  32. import ui
  33. import uiCommon
  34. import uiPhaseCurtain
  35. import uiMapNameShower
  36. import uiAffectShower
  37. import uiPlayerGauge
  38. import uiCharacter
  39. import uiTarget
  40. import time
  41. import uiPopup
  42.  
  43. # PRIVATE_SHOP_PRICE_LIST
  44. import uiPrivateShopBuilder
  45. import uiOfflineShopBuilder
  46. import uiOfflineShop
  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.  
  56. import musicInfo
  57. import debugInfo
  58. import uipetsystem
  59. import stringCommander
  60.  
  61. from _weakref import proxy
  62. from switchbot import Bot
  63. from stergeitem import CubodeBasura
  64.  
  65. # TEXTTAIL_LIVINGTIME_CONTROL
  66. #if localeInfo.IsJAPAN():
  67. # app.SetTextTailLivingTime(8.0)
  68. # END_OF_TEXTTAIL_LIVINGTIME_CONTROL
  69.  
  70. # SCREENSHOT_CWDSAVE
  71. SCREENSHOT_CWDSAVE = FALSE
  72. SCREENSHOT_DIR = None
  73.  
  74. if localeInfo.IsEUROPE():
  75. SCREENSHOT_CWDSAVE = TRUE
  76.  
  77. if localeInfo.IsCIBN10():
  78. SCREENSHOT_CWDSAVE = FALSE
  79. SCREENSHOT_DIR = "YT2W"
  80.  
  81. cameraDistance = 1550.0
  82. cameraPitch = 27.0
  83. cameraRotation = 0.0
  84. cameraHeight = 100.0
  85.  
  86. testAlignment = 0
  87. BPisLodaded = 0
  88.  
  89. class GameWindow(ui.ScriptWindow):
  90. def __init__(self, stream):
  91. self.sideBar = uisidebar.SideBar()
  92. self.sideBar.AddButton("Switchbot", self.__toggleSwitchbot)
  93. self.sideBar.AddButton("Marble Shop", self.OpenMarbleShop)
  94. self.sideBar.AddButton("Title", self.OpenTitleSystem)
  95. self.sideBar.AddButton("Offline Shop", self.__ToggleOfflineShopAdminPanelWindow)
  96. self.sideBar.AddButton("System AFK", self.__afk)
  97. self.sideBar.AddButton("Guild", self.__ToggleGuildWindow)
  98. self.sideBar.AddButton("Recycle Bin", self.ClickSterge)
  99. self.sideBar.AddButton("Calendar", self.Calendar)
  100. self.sideBar.Show ()
  101. day.nacht =0
  102. day.tag =0
  103. ui.ScriptWindow.__init__(self, "GAME")
  104. self.SetWindowName("game")
  105. net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)
  106. player.SetGameWindow(self)
  107. self.utilizareTaste = time.clock() + 4
  108. self.lastupdate = 0
  109. self.lastupdatee = 0
  110.  
  111. self.quickSlotPageIndex = 0
  112. self.lastPKModeSendedTime = 0
  113. self.pressNumber = None
  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. if (app.ENABLE_AFFECT_POLYMORPH_REMOVE):
  123. self.polymorphQuestionDialog = None
  124.  
  125. self.stream=stream
  126. self.interface = interfaceModule.Interface()
  127. self.interface.SetStream(self.stream)
  128. self.interface.MakeInterface()
  129. self.interface.ShowDefaultWindows()
  130. self.stream.isAutoSelect = 0
  131.  
  132. self.curtain = uiPhaseCurtain.PhaseCurtain()
  133. self.curtain.speed = 0.03
  134. self.curtain.Hide()
  135.  
  136. self.targetBoard = uiTarget.TargetBoard()
  137. self.targetBoard.SetWhisperEvent(ui.__mem_func__(self.interface.OpenWhisperDialog))
  138. self.targetBoard.Hide()
  139.  
  140. self.petmain = uipetsystem.PetSystemMain()
  141. self.petmini = uipetsystem.PetSystemMini()
  142.  
  143. self.wiki = uiwiki.AgeofPlatonWiki()
  144.  
  145.  
  146. self.console = consoleModule.ConsoleWindow()
  147. self.console.BindGameClass(self)
  148. self.console.SetConsoleSize(wndMgr.GetScreenWidth(), 200)
  149. self.console.Hide()
  150.  
  151. self.mapNameShower = uiMapNameShower.MapNameShower()
  152. self.affectShower = uiAffectShower.AffectShower()
  153. self.wndMarbleShop = uimarbleshop.MarbleShopWindow()
  154. if app.ENABLE_TITLE_SYSTEM:
  155. import title_system
  156. self.wndTitleSystem = title_system.Title_System()
  157.  
  158. self.playerGauge = uiPlayerGauge.PlayerGauge(self)
  159. self.playerGauge.Hide()
  160.  
  161. self.switchbot = Bot()
  162. self.switchbot.Hide()
  163.  
  164. self.elimina = CubodeBasura()
  165. self.elimina.Hide()
  166.  
  167. self.itemDropQuestionDialog = None
  168.  
  169. self.__SetQuickSlotMode()
  170.  
  171. self.__ServerCommand_Build()
  172. self.__ProcessPreservedServerCommand()
  173.  
  174. def __del__(self):
  175. player.SetGameWindow(0)
  176. net.ClearPhaseWindow(net.PHASE_WINDOW_GAME, self)
  177. ui.ScriptWindow.__del__(self)
  178.  
  179. def Open(self):
  180. app.SetFrameSkip(1)
  181.  
  182. self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  183.  
  184. self.quickSlotPageIndex = 0
  185. self.PickingCharacterIndex = -1
  186. self.PickingItemIndex = -1
  187. self.consoleEnable = FALSE
  188. self.isShowDebugInfo = FALSE
  189. self.ShowNameFlag = FALSE
  190.  
  191. self.enableXMasBoom = FALSE
  192. self.startTimeXMasBoom = 0.0
  193. self.indexXMasBoom = 0
  194.  
  195. global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  196.  
  197. app.SetCamera(cameraDistance, cameraPitch, cameraRotation, cameraHeight)
  198.  
  199. constInfo.SET_DEFAULT_CAMERA_MAX_DISTANCE()
  200. constInfo.SET_DEFAULT_CHRNAME_COLOR()
  201. constInfo.SET_DEFAULT_FOG_LEVEL()
  202. constInfo.SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE()
  203. constInfo.SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS()
  204. constInfo.SET_DEFAULT_USE_SKILL_EFFECT_ENABLE()
  205.  
  206. # TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  207. constInfo.SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE()
  208. # END_OF_TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  209.  
  210. import event
  211. event.SetLeftTimeString(localeInfo.UI_LEFT_TIME)
  212.  
  213. textTail.EnablePKTitle(constInfo.PVPMODE_ENABLE)
  214.  
  215. if constInfo.PVPMODE_TEST_ENABLE:
  216. self.testPKMode = ui.TextLine()
  217. self.testPKMode.SetFontName(localeInfo.UI_DEF_FONT)
  218. self.testPKMode.SetPosition(0, 15)
  219. self.testPKMode.SetWindowHorizontalAlignCenter()
  220. self.testPKMode.SetHorizontalAlignCenter()
  221. self.testPKMode.SetFeather()
  222. self.testPKMode.SetOutline()
  223. self.testPKMode.Show()
  224.  
  225. self.testAlignment = ui.TextLine()
  226. self.testAlignment.SetFontName(localeInfo.UI_DEF_FONT)
  227. self.testAlignment.SetPosition(0, 35)
  228. self.testAlignment.SetWindowHorizontalAlignCenter()
  229. self.testAlignment.SetHorizontalAlignCenter()
  230. self.testAlignment.SetFeather()
  231. self.testAlignment.SetOutline()
  232. self.testAlignment.Show()
  233.  
  234. self.__BuildKeyDict()
  235. self.__BuildDebugInfo()
  236.  
  237. # PRIVATE_SHOP_PRICE_LIST
  238. uiPrivateShopBuilder.Clear()
  239. # END_OF_PRIVATE_SHOP_PRICE_LIST
  240.  
  241. uiOfflineShopBuilder.Clear()
  242.  
  243. # UNKNOWN_UPDATE
  244. exchange.InitTrading()
  245. # END_OF_UNKNOWN_UPDATE
  246.  
  247. if debugInfo.IsDebugMode():
  248. self.ToggleDebugInfo()
  249.  
  250. ## Sound
  251. snd.SetMusicVolume(systemSetting.GetMusicVolume()*net.GetFieldMusicVolume())
  252. snd.SetSoundVolume(systemSetting.GetSoundVolume())
  253.  
  254. netFieldMusicFileName = net.GetFieldMusicFileName()
  255. if netFieldMusicFileName:
  256. snd.FadeInMusic("BGM/" + netFieldMusicFileName)
  257. elif musicInfo.fieldMusic != "":
  258. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  259.  
  260. self.__SetQuickSlotMode()
  261. self.__SelectQuickPage(self.quickSlotPageIndex)
  262.  
  263. self.SetFocus()
  264. self.Show()
  265. app.ShowCursor()
  266.  
  267. net.SendEnterGamePacket()
  268.  
  269. # START_GAME_ERROR_EXIT
  270. try:
  271. self.StartGame()
  272. except:
  273. import exception
  274. exception.Abort("GameWindow.Open")
  275. # END_OF_START_GAME_ERROR_EXIT
  276.  
  277. # NPC가 큐브시스템으로 만들 수 있는 아이템들의 목록을 캐싱
  278. # ex) cubeInformation[20383] = [ {"rewordVNUM": 72723, "rewordCount": 1, "materialInfo": "101,1&102,2", "price": 999 }, ... ]
  279. self.cubeInformation = {}
  280. self.currentCubeNPC = 0
  281.  
  282. def Close(self):
  283. self.Hide()
  284.  
  285. global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  286. (cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
  287.  
  288. if musicInfo.fieldMusic != "":
  289. snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
  290.  
  291. self.onPressKeyDict = None
  292. self.onClickKeyDict = None
  293.  
  294. chat.Close()
  295. snd.StopAllSound()
  296. grp.InitScreenEffect()
  297. chr.Destroy()
  298. textTail.Clear()
  299. quest.Clear()
  300. background.Destroy()
  301. guild.Destroy()
  302. messenger.Destroy()
  303. skill.ClearSkillData()
  304. wndMgr.Unlock()
  305. mouseModule.mouseController.DeattachObject()
  306.  
  307. if self.guildWarQuestionDialog:
  308. self.guildWarQuestionDialog.Close()
  309.  
  310. self.guildNameBoard = None
  311. self.partyRequestQuestionDialog = None
  312. self.partyInviteQuestionDialog = None
  313. self.guildInviteQuestionDialog = None
  314. self.guildWarQuestionDialog = None
  315. self.messengerAddFriendQuestion = None
  316.  
  317. # UNKNOWN_UPDATE
  318. self.itemDropQuestionDialog = None
  319. # END_OF_UNKNOWN_UPDATE
  320.  
  321. # QUEST_CONFIRM
  322. self.confirmDialog = None
  323. # END_OF_QUEST_CONFIRM
  324.  
  325. self.PrintCoord = None
  326. self.FrameRate = None
  327. self.Pitch = None
  328. self.Splat = None
  329. self.TextureNum = None
  330. self.ObjectNum = None
  331. self.ViewDistance = None
  332. self.PrintMousePos = None
  333.  
  334. self.ClearDictionary()
  335. self.petmain.Close()
  336. self.petmini.Close()
  337.  
  338. self.playerGauge = None
  339. self.mapNameShower = None
  340. self.affectShower = None
  341.  
  342. if self.console:
  343. self.console.BindGameClass(0)
  344. self.console.Close()
  345. self.console=None
  346.  
  347. if self.targetBoard:
  348. self.targetBoard.Destroy()
  349. self.targetBoard = None
  350.  
  351. if self.wndMarbleShop:
  352. self.wndMarbleShop.Hide()
  353.  
  354. if app.ENABLE_TITLE_SYSTEM:
  355. self.wndTitleSystem.Close()
  356.  
  357. if self.sideBar.IsShow():
  358. self.sideBar.Hide()
  359.  
  360. if self.interface:
  361. self.interface.HideAllWindows()
  362. self.interface.Close()
  363. self.interface=None
  364.  
  365. player.ClearSkillDict()
  366. player.ResetCameraRotation()
  367.  
  368. self.KillFocus()
  369. app.HideCursor()
  370.  
  371. print "---------------------------------------------------------------------------- CLOSE GAME WINDOW"
  372.  
  373. def __BuildKeyDict(self):
  374. onPressKeyDict = {}
  375.  
  376. ##PressKey 는 누르고 있는 동안 계속 적용되는 키이다.
  377.  
  378. ## 숫자 단축키 퀵슬롯에 이용된다.(이후 숫자들도 퀵 슬롯용 예약)
  379. ## F12 는 클라 디버그용 키이므로 쓰지 않는 게 좋다.
  380. onPressKeyDict[app.DIK_1] = lambda : self.__PressNumKey(1)
  381. onPressKeyDict[app.DIK_2] = lambda : self.__PressNumKey(2)
  382. onPressKeyDict[app.DIK_3] = lambda : self.__PressNumKey(3)
  383. onPressKeyDict[app.DIK_4] = lambda : self.__PressNumKey(4)
  384. onPressKeyDict[app.DIK_5] = lambda : self.__PressNumKey(5)
  385. onPressKeyDict[app.DIK_6] = lambda : self.__PressNumKey(6)
  386. onPressKeyDict[app.DIK_7] = lambda : self.__PressNumKey(7)
  387. onPressKeyDict[app.DIK_8] = lambda : self.__PressNumKey(8)
  388. onPressKeyDict[app.DIK_9] = lambda : self.__PressNumKey(9)
  389. onPressKeyDict[app.DIK_F1] = lambda : self.__PressQuickSlot(4)
  390. onPressKeyDict[app.DIK_F2] = lambda : self.__PressQuickSlot(5)
  391. onPressKeyDict[app.DIK_F3] = lambda : self.__PressQuickSlot(6)
  392. onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7)
  393. onPressKeyDict[app.DIK_F6] = lambda : net.SendChatPacket("/remove_polymorph")
  394. onPressKeyDict[app.DIK_F11] = lambda : self.__OnWiki()
  395. #onPressKeyDict[app.DIK_F5] = lambda : self.__PressQuickSlot(7)
  396. onPressKeyDict[app.DIK_F9] = lambda: self.__ArayuzManager()
  397.  
  398. onPressKeyDict[app.DIK_LALT] = lambda : self.ShowName()
  399. onPressKeyDict[app.DIK_LCONTROL] = lambda : self.ShowMouseImage()
  400. onPressKeyDict[app.DIK_SYSRQ] = lambda : self.SaveScreen()
  401. onPressKeyDict[app.DIK_SPACE] = lambda : self.StartAttack()
  402. onPressKeyDict[app.DIK_TAB] = lambda : self.ClickTeleport()
  403.  
  404. #캐릭터 이동키
  405. onPressKeyDict[app.DIK_UP] = lambda : self.MoveUp()
  406. onPressKeyDict[app.DIK_DOWN] = lambda : self.MoveDown()
  407. onPressKeyDict[app.DIK_LEFT] = lambda : self.MoveLeft()
  408. onPressKeyDict[app.DIK_RIGHT] = lambda : self.MoveRight()
  409. onPressKeyDict[app.DIK_W] = lambda : self.MoveUp()
  410. onPressKeyDict[app.DIK_S] = lambda : self.MoveDown()
  411. onPressKeyDict[app.DIK_A] = lambda : self.MoveLeft()
  412. onPressKeyDict[app.DIK_D] = lambda : self.MoveRight()
  413.  
  414. onPressKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
  415. onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
  416. onPressKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  417. onPressKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
  418. onPressKeyDict[app.DIK_G] = self.__PressGKey
  419. onPressKeyDict[app.DIK_Q] = self.__PressQKey
  420. onPressKeyDict[app.DIK_P] = self.__PressPKey
  421.  
  422. onPressKeyDict[app.DIK_NUMPAD9] = lambda: app.MovieResetCamera()
  423. onPressKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
  424. onPressKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)
  425. onPressKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)
  426. onPressKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
  427. onPressKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
  428. onPressKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
  429. onPressKeyDict[app.DIK_NUMPAD3] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
  430. onPressKeyDict[app.DIK_GRAVE] = lambda : self.PickUpItem()
  431. onPressKeyDict[app.DIK_Z] = lambda : self.PickUpItem()
  432. onPressKeyDict[app.DIK_C] = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
  433. onPressKeyDict[app.DIK_V] = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
  434. onPressKeyDict[app.DIK_B] = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
  435. onPressKeyDict[app.DIK_N] = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
  436. onPressKeyDict[app.DIK_I] = lambda : self.interface.ToggleInventoryWindow()
  437. onPressKeyDict[app.DIK_O] = lambda : self.interface.ToggleDragonSoulWindowWithNoInfo()
  438. onPressKeyDict[app.DIK_M] = lambda : self.interface.PressMKey()
  439. onPressKeyDict[app.DIK_H] = lambda : self.interface.OpenHelpWindow()
  440. onPressKeyDict[app.DIK_ADD] = lambda : self.interface.MiniMapScaleUp()
  441. onPressKeyDict[app.DIK_SUBTRACT] = lambda : self.interface.MiniMapScaleDown()
  442. onPressKeyDict[app.DIK_L] = lambda : self.interface.ToggleChatLogWindow()
  443. onPressKeyDict[app.DIK_K] = lambda : self.interface.ToggleGuildWindow()
  444. onPressKeyDict[app.DIK_COMMA] = lambda : self.ShowConsole() # "`" key
  445. onPressKeyDict[app.DIK_LSHIFT] = lambda : self.__SetQuickPageMode()
  446.  
  447. onPressKeyDict[app.DIK_J] = lambda : self.__PressJKey()
  448. onPressKeyDict[app.DIK_H] = lambda : self.__PressHKey()
  449. onPressKeyDict[app.DIK_B] = lambda : self.__PressBKey()
  450. onPressKeyDict[app.DIK_F] = lambda : self.__PressFKey()
  451.  
  452. ## CUBE_TEST
  453. ## onPressKeyDict[app.DIK_K] = lambda : self.interface.OpenCubeWindow()
  454. ## CUBE_TEST_END
  455.  
  456. self.onPressKeyDict = onPressKeyDict
  457.  
  458. onClickKeyDict = {}
  459. onClickKeyDict[app.DIK_UP] = lambda : self.StopUp()
  460. onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown()
  461. onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft()
  462. onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight()
  463. onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack()
  464.  
  465. onClickKeyDict[app.DIK_W] = lambda : self.StopUp()
  466. onClickKeyDict[app.DIK_S] = lambda : self.StopDown()
  467. onClickKeyDict[app.DIK_A] = lambda : self.StopLeft()
  468. onClickKeyDict[app.DIK_D] = lambda : self.StopRight()
  469. onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP)
  470. onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP)
  471. onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  472. onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  473. onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP)
  474. onClickKeyDict[app.DIK_G] = lambda: self.__ReleaseGKey()
  475. onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  476. onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  477. onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  478. onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  479. onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  480. onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  481. onClickKeyDict[app.DIK_LALT] = lambda: self.HideName()
  482. onClickKeyDict[app.DIK_TAB] = lambda: self.ClickTeleport()
  483. onClickKeyDict[app.DIK_LCONTROL] = lambda: self.HideMouseImage()
  484. onClickKeyDict[app.DIK_LSHIFT] = lambda: self.__SetQuickSlotMode()
  485. onClickKeyDict[app.DIK_P] = lambda: self.OpenPetMainGui()
  486.  
  487. # if constInfo.PVPMODE_ACCELKEY_ENABLE:
  488. ## onClickKeyDict[app.DIK_B] = lambda: self.ChangePKMode()
  489.  
  490. self.onClickKeyDict=onClickKeyDict
  491.  
  492. def __PressNumKey(self,num):
  493. if time.clock() >= self.utilizareTaste:
  494. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  495.  
  496. if num >= 1 and num <= 9:
  497. if(chrmgr.IsPossibleEmoticon(-1)):
  498. chrmgr.SetEmoticon(-1,int(num)-1)
  499. net.SendEmoticon(int(num)-1)
  500. else:
  501. if num >= 1 and num <= 4:
  502. self.pressNumber(num-1)
  503. else:
  504. chat.AppendChat(chat.CHAT_TYPE_INFO, "|cFF00ff33[System] > |h|cFFf7eccc|hWait a few seconds to use the command.")
  505.  
  506. # AFk Systen
  507. def __afk(self):
  508. if constInfo.AFK == 0:
  509. constInfo.AFK = 1
  510. self.PopupMessage("System AFK Turned ON")
  511. elif constInfo.AFK == 1:
  512. constInfo.AFK = 0
  513. self.PopupMessage("System AFK Turned OFF")
  514. # Afk, sfarsit
  515.  
  516. def __ClickBKey(self):
  517. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  518. return
  519. else:
  520. if constInfo.PVPMODE_ACCELKEY_ENABLE:
  521. self.ChangePKMode()
  522.  
  523. def __PressHKey(self):
  524. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  525. net.SendChatPacket("/user_horse_ride")
  526. else:
  527. self.interface.OpenHelpWindow()
  528.  
  529. def __PressBKey(self):
  530. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  531. net.SendChatPacket("/user_horse_back")
  532. else:
  533. state = "EMOTICON"
  534. self.interface.ToggleCharacterWindow(state)
  535.  
  536. def __PressFKey(self):
  537. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  538. net.SendChatPacket("/user_horse_feed")
  539. else:
  540. app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  541.  
  542. def __PressGKey(self):
  543. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  544. if player.IsMountingHorse():
  545. net.SendChatPacket("/unmount")
  546. else:
  547. net.SendChatPacket("/ride")
  548. if not uiPrivateShopBuilder.IsBuildingPrivateShop() or not uiOfflineShopBuilder.IsBuildingOfflineShop():
  549. for i in xrange(player.INVENTORY_PAGE_SIZE):
  550. if player.GetItemIndex(i) in (71125, 71126, 71127):
  551. net.SendItemUsePacket(i)
  552. if self.ShowNameFlag:
  553. self.interface.ToggleGuildWindow()
  554. break
  555.  
  556. def __ReleaseGKey(self):
  557. app.PitchCamera(app.CAMERA_STOP)
  558. if app.ENABLE_TITLE_SYSTEM:
  559. def OpenTitleSystem(self):
  560. self.wndTitleSystem.OpenWindow()
  561.  
  562. def __PressQKey(self):
  563. if (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
  564. if (interfaceModule.IsQBHide == 0):
  565. interfaceModule.IsQBHide = 1
  566. self.interface.HideAllQuestButton()
  567. else:
  568. interfaceModule.IsQBHide = 0
  569. self.interface.ShowAllQuestButton()
  570. else:
  571. app.RotateCamera(app.CAMERA_TO_NEGATIVE)
  572.  
  573. def __PressPKey(self):
  574. if (app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL)):
  575. if (interfaceModule.IsWhisperHide == 0):
  576. interfaceModule.IsWhisperHide = 1
  577. self.interface.HideAllWhisperButton()
  578. else:
  579. interfaceModule.IsWhisperHide = 0
  580. self.interface.ShowAllWhisperButton()
  581.  
  582. def __SetQuickSlotMode(self):
  583. self.pressNumber=ui.__mem_func__(self.__PressQuickSlot)
  584.  
  585. def __SetQuickPageMode(self):
  586. self.pressNumber=ui.__mem_func__(self.__SelectQuickPage)
  587.  
  588. def __PressQuickSlot(self, localSlotIndex):
  589. if time.clock() >= self.utilizareTaste:
  590. player.RequestUseLocalQuickSlot(localSlotIndex)
  591. else:
  592. chat.AppendChat(chat.CHAT_TYPE_INFO, "|cFF00ff33[System] > |h|cFFf7eccc|hWait a few seconds to use the command.")
  593.  
  594. def __SelectQuickPage(self, pageIndex):
  595. self.quickSlotPageIndex = pageIndex
  596. player.SetQuickPage(pageIndex)
  597.  
  598. def ToggleDebugInfo(self):
  599. self.isShowDebugInfo = not self.isShowDebugInfo
  600.  
  601. if self.isShowDebugInfo:
  602. self.PrintCoord.Show()
  603. self.FrameRate.Show()
  604. self.Pitch.Show()
  605. self.Splat.Show()
  606. self.TextureNum.Show()
  607. self.ObjectNum.Show()
  608. self.ViewDistance.Show()
  609. self.PrintMousePos.Show()
  610. else:
  611. self.PrintCoord.Hide()
  612. self.FrameRate.Hide()
  613. self.Pitch.Hide()
  614. self.Splat.Hide()
  615. self.TextureNum.Hide()
  616. self.ObjectNum.Hide()
  617. self.ViewDistance.Hide()
  618. self.PrintMousePos.Hide()
  619.  
  620. def __BuildDebugInfo(self):
  621. ## Character Position Coordinate
  622. self.PrintCoord = ui.TextLine()
  623. self.PrintCoord.SetFontName(localeInfo.UI_DEF_FONT)
  624. self.PrintCoord.SetPosition(wndMgr.GetScreenWidth() - 270, 0)
  625.  
  626. ## Frame Rate
  627. self.FrameRate = ui.TextLine()
  628. self.FrameRate.SetFontName(localeInfo.UI_DEF_FONT)
  629. self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
  630.  
  631. ## Camera Pitch
  632. self.Pitch = ui.TextLine()
  633. self.Pitch.SetFontName(localeInfo.UI_DEF_FONT)
  634. self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
  635.  
  636. ## Splat
  637. self.Splat = ui.TextLine()
  638. self.Splat.SetFontName(localeInfo.UI_DEF_FONT)
  639. self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
  640.  
  641. ##
  642. self.PrintMousePos = ui.TextLine()
  643. self.PrintMousePos.SetFontName(localeInfo.UI_DEF_FONT)
  644. self.PrintMousePos.SetPosition(wndMgr.GetScreenWidth() - 270, 80)
  645.  
  646. # TextureNum
  647. self.TextureNum = ui.TextLine()
  648. self.TextureNum.SetFontName(localeInfo.UI_DEF_FONT)
  649. self.TextureNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
  650.  
  651. # 오브젝트 그리는 개수
  652. self.ObjectNum = ui.TextLine()
  653. self.ObjectNum.SetFontName(localeInfo.UI_DEF_FONT)
  654. self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 120)
  655.  
  656. # 시야거리
  657. self.ViewDistance = ui.TextLine()
  658. self.ViewDistance.SetFontName(localeInfo.UI_DEF_FONT)
  659. self.ViewDistance.SetPosition(0, 0)
  660.  
  661. def __NotifyError(self, msg):
  662. chat.AppendChat(chat.CHAT_TYPE_INFO, msg)
  663.  
  664. def ChangePKMode(self):
  665.  
  666. if not app.IsPressed(app.DIK_LCONTROL):
  667. return
  668.  
  669. if player.GetStatus(player.LEVEL)<constInfo.PVPMODE_PROTECTED_LEVEL:
  670. self.__NotifyError(localeInfo.OPTION_PVPMODE_PROTECT % (constInfo.PVPMODE_PROTECTED_LEVEL))
  671. return
  672.  
  673. curTime = app.GetTime()
  674. if curTime - self.lastPKModeSendedTime < constInfo.PVPMODE_ACCELKEY_DELAY:
  675. return
  676.  
  677. self.lastPKModeSendedTime = curTime
  678.  
  679. curPKMode = player.GetPKMode()
  680. nextPKMode = curPKMode + 1
  681. if nextPKMode == player.PK_MODE_PROTECT:
  682. if 0 == player.GetGuildID():
  683. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
  684. nextPKMode = 0
  685. else:
  686. nextPKMode = player.PK_MODE_GUILD
  687.  
  688. elif nextPKMode == player.PK_MODE_MAX_NUM:
  689. nextPKMode = 0
  690.  
  691. net.SendChatPacket("/PKMode " + str(nextPKMode))
  692. print "/PKMode " + str(nextPKMode)
  693.  
  694. def OnChangePKMode(self):
  695.  
  696. self.interface.OnChangePKMode()
  697.  
  698. try:
  699. self.__NotifyError(localeInfo.OPTION_PVPMODE_MESSAGE_DICT[player.GetPKMode()])
  700. except KeyError:
  701. print "UNKNOWN PVPMode[%d]" % (player.GetPKMode())
  702.  
  703. if constInfo.PVPMODE_TEST_ENABLE:
  704. curPKMode = player.GetPKMode()
  705. alignment, grade = chr.testGetPKData()
  706. self.pkModeNameDict = { 0 : "PEACE", 1 : "REVENGE", 2 : "FREE", 3 : "PROTECT", }
  707. self.testPKMode.SetText("Current PK Mode : " + self.pkModeNameDict.get(curPKMode, "UNKNOWN"))
  708. self.testAlignment.SetText("Current Alignment : " + str(alignment) + " (" + localeInfo.TITLE_NAME_LIST[grade] + ")")
  709.  
  710. ###############################################################################################
  711. ###############################################################################################
  712. ## Game Callback Functions
  713.  
  714. # Start
  715. def StartGame(self):
  716. self.RefreshInventory()
  717. self.RefreshEquipment()
  718. self.RefreshCharacter()
  719. self.RefreshSkill()
  720.  
  721. # Refresh
  722. def CheckGameButton(self):
  723. if self.interface:
  724. self.interface.CheckGameButton()
  725.  
  726. def RefreshAlignment(self):
  727. self.interface.RefreshAlignment()
  728.  
  729. def Calendar(self):
  730. import calendar
  731.  
  732. self.calendar = calendar.Calendar()
  733. self.calendar.Show()
  734.  
  735. def RefreshStatus(self):
  736. self.CheckGameButton()
  737.  
  738. if self.interface:
  739. self.interface.RefreshStatus()
  740.  
  741. if self.playerGauge:
  742. self.playerGauge.RefreshGauge()
  743.  
  744. def RefreshStamina(self):
  745. self.interface.RefreshStamina()
  746.  
  747. def RefreshSkill(self):
  748. self.CheckGameButton()
  749. if self.interface:
  750. self.interface.RefreshSkill()
  751.  
  752. def RefreshQuest(self):
  753. self.interface.RefreshQuest()
  754.  
  755. def RefreshMessenger(self):
  756. self.interface.RefreshMessenger()
  757.  
  758. def RefreshGuildInfoPage(self):
  759. self.interface.RefreshGuildInfoPage()
  760.  
  761. def RefreshGuildBoardPage(self):
  762. self.interface.RefreshGuildBoardPage()
  763.  
  764. def RefreshGuildMemberPage(self):
  765. self.interface.RefreshGuildMemberPage()
  766.  
  767. def RefreshGuildMemberPageGradeComboBox(self):
  768. self.interface.RefreshGuildMemberPageGradeComboBox()
  769.  
  770. def RefreshGuildSkillPage(self):
  771. self.interface.RefreshGuildSkillPage()
  772.  
  773. def RefreshGuildGradePage(self):
  774. self.interface.RefreshGuildGradePage()
  775.  
  776. def RefreshMobile(self):
  777. if self.interface:
  778. self.interface.RefreshMobile()
  779.  
  780. def OnMobileAuthority(self):
  781. self.interface.OnMobileAuthority()
  782.  
  783. def OnBlockMode(self, mode):
  784. self.interface.OnBlockMode(mode)
  785.  
  786. def OpenQuestWindow(self, skin, idx):
  787. self.interface.OpenQuestWindow(skin, idx)
  788.  
  789. def HideAllQuestWindow(self):
  790. self.interface.HideAllQuestWindow()
  791.  
  792. def AskGuildName(self):
  793.  
  794. guildNameBoard = uiCommon.InputDialog()
  795. guildNameBoard.SetTitle(localeInfo.GUILD_NAME)
  796. guildNameBoard.SetAcceptEvent(ui.__mem_func__(self.ConfirmGuildName))
  797. guildNameBoard.SetCancelEvent(ui.__mem_func__(self.CancelGuildName))
  798. guildNameBoard.Open()
  799.  
  800. self.guildNameBoard = guildNameBoard
  801.  
  802. def ConfirmGuildName(self):
  803. guildName = self.guildNameBoard.GetText()
  804. if not guildName:
  805. return
  806.  
  807. if net.IsInsultIn(guildName):
  808. self.PopupMessage(localeInfo.GUILD_CREATE_ERROR_INSULT_NAME)
  809. return
  810.  
  811. net.SendAnswerMakeGuildPacket(guildName)
  812. self.guildNameBoard.Close()
  813. self.guildNameBoard = None
  814. return TRUE
  815.  
  816. def CancelGuildName(self):
  817. self.guildNameBoard.Close()
  818. self.guildNameBoard = None
  819. return TRUE
  820.  
  821. ## Refine
  822. def PopupMessage(self, msg):
  823. self.stream.popupWindow.Close()
  824. self.stream.popupWindow.Open(msg, 0, localeInfo.UI_OK)
  825.  
  826. def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type=0):
  827. self.interface.OpenRefineDialog(targetItemPos, nextGradeItemVnum, cost, prob, type)
  828.  
  829. def AppendMaterialToRefineDialog(self, vnum, count):
  830. self.interface.AppendMaterialToRefineDialog(vnum, count)
  831.  
  832. def RunUseSkillEvent(self, slotIndex, coolTime):
  833. self.interface.OnUseSkill(slotIndex, coolTime)
  834.  
  835. def ClearAffects(self):
  836. self.affectShower.ClearAffects()
  837.  
  838. def SetAffect(self, affect):
  839. self.affectShower.SetAffect(affect)
  840.  
  841. def ResetAffect(self, affect):
  842. self.affectShower.ResetAffect(affect)
  843.  
  844. # UNKNOWN_UPDATE
  845. def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  846. self.affectShower.BINARY_NEW_AddAffect(type, pointIdx, value, duration)
  847. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  848. self.interface.DragonSoulActivate(type - chr.NEW_AFFECT_DRAGON_SOUL_DECK1)
  849. elif chr.NEW_AFFECT_DRAGON_SOUL_QUALIFIED == type:
  850. self.BINARY_DragonSoulGiveQuilification()
  851.  
  852. def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  853. self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  854. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  855. self.interface.DragonSoulDeactivate()
  856.  
  857.  
  858.  
  859. # END_OF_UNKNOWN_UPDATE
  860.  
  861. def ActivateSkillSlot(self, slotIndex):
  862. if self.interface:
  863. self.interface.OnActivateSkill(slotIndex)
  864.  
  865. def DeactivateSkillSlot(self, slotIndex):
  866. if self.interface:
  867. self.interface.OnDeactivateSkill(slotIndex)
  868.  
  869. def RefreshEquipment(self):
  870. if self.interface:
  871. self.interface.RefreshInventory()
  872.  
  873. def RefreshInventory(self):
  874. if self.interface:
  875. self.interface.RefreshInventory()
  876.  
  877. def RefreshCharacter(self):
  878. if self.interface:
  879. self.interface.RefreshCharacter()
  880.  
  881. def OnGameOver(self):
  882. self.CloseTargetBoard()
  883. self.OpenRestartDialog()
  884.  
  885. def OpenRestartDialog(self):
  886. self.interface.OpenRestartDialog()
  887.  
  888. def ChangeCurrentSkill(self, skillSlotNumber):
  889. self.interface.OnChangeCurrentSkill(skillSlotNumber)
  890.  
  891. ## TargetBoard
  892. def SetPCTargetBoard(self, vid, name):
  893. self.targetBoard.Open(vid, name)
  894.  
  895. if app.IsPressed(app.DIK_LCONTROL):
  896.  
  897. if not player.IsSameEmpire(vid):
  898. return
  899.  
  900. if player.IsMainCharacterIndex(vid):
  901. return
  902. elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(vid):
  903. return
  904.  
  905. self.interface.OpenWhisperDialog(name)
  906.  
  907.  
  908. def RefreshTargetBoardByVID(self, vid):
  909. self.targetBoard.RefreshByVID(vid)
  910.  
  911. def RefreshTargetBoardByName(self, name):
  912. self.targetBoard.RefreshByName(name)
  913.  
  914. def __RefreshTargetBoard(self):
  915. self.targetBoard.Refresh()
  916.  
  917. if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  918. def SetHPTargetBoard(self, vid, hpPercentage, iMinHP, iMaxHP):
  919. if vid != self.targetBoard.GetTargetVID():
  920. self.targetBoard.ResetTargetBoard()
  921. self.targetBoard.SetEnemyVID(vid)
  922.  
  923. self.targetBoard.SetHP(hpPercentage, iMinHP, iMaxHP)
  924. self.targetBoard.Show()
  925. else:
  926. def SetHPTargetBoard(self, vid, hpPercentage):
  927. if vid != self.targetBoard.GetTargetVID():
  928. self.targetBoard.ResetTargetBoard()
  929. self.targetBoard.SetEnemyVID(vid)
  930.  
  931. self.targetBoard.SetHP(hpPercentage)
  932. self.targetBoard.Show()
  933.  
  934. def CloseTargetBoardIfDifferent(self, vid):
  935. if vid != self.targetBoard.GetTargetVID():
  936. self.targetBoard.Close()
  937.  
  938. def CloseTargetBoard(self):
  939. self.targetBoard.Close()
  940.  
  941. ## View Equipment
  942. def OpenEquipmentDialog(self, vid):
  943. self.interface.OpenEquipmentDialog(vid)
  944.  
  945. def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
  946. self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
  947.  
  948. def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
  949. self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
  950.  
  951. def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
  952. self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
  953.  
  954. # SHOW_LOCAL_MAP_NAME
  955. def ShowMapName(self, mapName, x, y):
  956.  
  957. if self.mapNameShower:
  958. self.mapNameShower.ShowMapName(mapName, x, y)
  959.  
  960. if self.interface:
  961. self.interface.SetMapName(mapName)
  962. # END_OF_SHOW_LOCAL_MAP_NAME
  963.  
  964. def BINARY_OpenAtlasWindow(self):
  965. self.interface.BINARY_OpenAtlasWindow()
  966.  
  967. ## Chat
  968. def OnRecvWhisper(self, mode, name, line):
  969. global afk
  970. afk = time.strftime("%H:%M")
  971. if mode == chat.WHISPER_TYPE_GM:
  972. self.interface.RegisterGameMasterName(name)
  973. if line[-25:] == "This Person is Afk":
  974. net.SendWhisperPacket(name, afk)
  975. chat.AppendWhisper(mode, name, line)
  976. self.interface.RecvWhisper(name)
  977. return
  978. afk = time.strftime("%H:%M")
  979. if constInfo.AFK == 1 and line[-5:] != afk and line[-28] != "This Person Seems to be in Afk Mode":
  980. net.SendWhisperPacket(name, "Contact Him Later")
  981. chat.AppendWhisper(mode, name, line)
  982. self.interface.RecvWhisper(name)
  983. else:
  984. chat.AppendWhisper(mode, name, line)
  985. self.interface.RecvWhisper(name)
  986.  
  987. pnblock = open("pn.dll", "r")
  988. pnauslese = pnblock.read()
  989. pnblock.close()
  990. if pnauslese.find(name + "\n") !=-1 and name[0] != "[" and line.find("72nasd31?_Get") == -1 and line.find("72nasd31?_Set") == -1:
  991. if name.find("[") !=-1:
  992. chat.AppendWhisper(mode, name, line)
  993. self.interface.RecvWhisper(name)
  994. else:
  995. chat.AppendChat(chat.CHAT_TYPE_INFO, "The player blocked " + name + "has tried to contact you.")
  996. net.SendWhisperPacket(name, "You have been added to the blocked users list.")
  997. return
  998. elif line.find("72nasd31?_Get") != -1:
  999. alignment1, grade1 = player.GetAlignmentData()
  1000. net.SendWhisperPacket(name, "72nasd31?_Set//" + str(player.GetStatus(player.SP)) + "//" + str(player.GetStatus(player.MAX_SP)) + "//" + str(player.GetStatus(player.HP)) + "//" + str(player.GetStatus(player.MAX_HP)) + "//" + str(player.GetStatus(player.EXP)) + "//" + str(player.GetStatus(player.NEXT_EXP)) + "//" + str(player.GetStatus(player.LEVEL)) + "//" + str(net.GetMainActorRace()) + "//" + str(alignment1) + "//" + str(grade1))
  1001. elif line.find("72nasd31?_Set") != -1:
  1002. x = line.split("//")
  1003. constInfo.other_exp = x[5]
  1004. constInfo.other_exp_next = x[6]
  1005. constInfo.other_hp = x[3]
  1006. constInfo.other_hp_max = x[4]
  1007. constInfo.other_mp = x[1]
  1008. constInfo.other_mp_max = x[2]
  1009. constInfo.other_race = x[8]
  1010. constInfo.other_level = x[7]
  1011. constInfo.other_rank = x[9]
  1012. constInfo.other_grade = x[10]
  1013. elif line.find("_pn_groupx1888329") !=-1:
  1014. x = line.split("||")
  1015. constInfo.groups[x[2]] = x[1].split(",")
  1016. chat.AppendWhisper(mode, x[2], x[3])
  1017. self.interface.RecvWhisper(x[2])
  1018. if x[3].find("|cff00ff00|hThe group was created!") != -1:
  1019. net.SendWhisperPacket(x[1].split(",")[len(x[1])-2], player.GetName() + " |cffffcc00|hjoined the group!")
  1020. else:
  1021. chat.AppendWhisper(mode, name, line)
  1022. self.interface.RecvWhisper(name)
  1023.  
  1024. def OnRecvWhisperSystemMessage(self, mode, name, line):
  1025. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
  1026. self.interface.RecvWhisper(name)
  1027.  
  1028. def OnRecvWhisperError(self, mode, name, line):
  1029. if localeInfo.WHISPER_ERROR.has_key(mode):
  1030. if app.OFFLINE_MESSAGE:
  1031. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, name + " is not online at this time. You can leave a message using #. Exemple: #Mesaj")
  1032. else:
  1033. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name))
  1034.  
  1035. def RecvWhisper(self, name):
  1036. self.interface.RecvWhisper(name)
  1037.  
  1038. def OnPickMoney(self, money):
  1039. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_PICK_MONEY % (money))
  1040.  
  1041. def OnPickMoney(self, money):
  1042. if constInfo.YangDrop == 1:
  1043. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_PICK_MONEY % (money))
  1044. else:
  1045. return
  1046. #YangDrop
  1047.  
  1048. def OnShopError(self, type):
  1049. try:
  1050. self.PopupMessage(localeInfo.SHOP_ERROR_DICT[type])
  1051. except KeyError:
  1052. self.PopupMessage(localeInfo.SHOP_ERROR_UNKNOWN % (type))
  1053.  
  1054. def OnSafeBoxError(self):
  1055. self.PopupMessage(localeInfo.SAFEBOX_ERROR)
  1056.  
  1057. def OnFishingSuccess(self, isFish, fishName):
  1058. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_SUCCESS(isFish, fishName), 2000)
  1059.  
  1060. # ADD_FISHING_MESSAGE
  1061. def OnFishingNotifyUnknown(self):
  1062. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_UNKNOWN)
  1063.  
  1064. def OnFishingWrongPlace(self):
  1065. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_WRONG_PLACE)
  1066. # END_OF_ADD_FISHING_MESSAGE
  1067.  
  1068. def OnFishingNotify(self, isFish, fishName):
  1069. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_NOTIFY(isFish, fishName))
  1070.  
  1071. def OnFishingFailure(self):
  1072. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_FAILURE, 2000)
  1073.  
  1074. def OnCannotPickItem(self):
  1075. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_PICK_ITEM)
  1076.  
  1077. # MINING
  1078. def OnCannotMining(self):
  1079. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_MINING)
  1080. # END_OF_MINING
  1081.  
  1082. def OnCannotUseSkill(self, vid, type):
  1083. if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
  1084. textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type])
  1085.  
  1086. if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
  1087. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type])
  1088.  
  1089. def OnCannotShotError(self, vid, type):
  1090. textTail.RegisterInfoTail(vid, localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type)))
  1091.  
  1092. ## PointReset
  1093. def StartPointReset(self):
  1094. self.interface.OpenPointResetDialog()
  1095.  
  1096. ## Shop
  1097. def StartShop(self, vid):
  1098. self.interface.OpenShopDialog(vid)
  1099.  
  1100. def EndShop(self):
  1101. self.interface.CloseShopDialog()
  1102.  
  1103. def RefreshShop(self):
  1104. self.interface.RefreshShopDialog()
  1105.  
  1106. def SetShopSellingPrice(self, Price):
  1107. pass
  1108.  
  1109. ## OfflineShop
  1110. def StartOfflineShop(self, vid):
  1111. self.interface.OpenOfflineShopDialog(vid)
  1112.  
  1113. def EndOfflineShop(self):
  1114. self.interface.CloseOfflineShopDialog()
  1115.  
  1116. def RefreshOfflineShop(self):
  1117. self.interface.RefreshOfflineShopDialog()
  1118.  
  1119. if app.HADES_BARBUT_SYSTEM:
  1120. def StartDice(self):
  1121. self.interface.StartDice()
  1122.  
  1123. if app.HADES_BARBUT_SYSTEM:
  1124. def EndDice(self):
  1125. self.interface.EndDice()
  1126.  
  1127. if app.HADES_BARBUT_SYSTEM:
  1128. def RefreshDice(self):
  1129. self.interface.RefreshDice()
  1130.  
  1131. if app.HADES_BARBUT_SYSTEM:
  1132. def __DiceHasDone(self, myNumber, targetNumber):
  1133. self.interface.AddDiceNumber(myNumber, targetNumber)
  1134.  
  1135. ## Exchange
  1136. def StartExchange(self):
  1137. self.interface.StartExchange()
  1138.  
  1139. def EndExchange(self):
  1140. self.interface.EndExchange()
  1141.  
  1142. def RefreshExchange(self):
  1143. self.interface.RefreshExchange()
  1144.  
  1145. ## Party
  1146. def RecvPartyInviteQuestion(self, leaderVID, leaderName):
  1147. partyInviteQuestionDialog = uiCommon.QuestionDialog()
  1148. partyInviteQuestionDialog.SetText(leaderName + localeInfo.PARTY_DO_YOU_JOIN)
  1149. partyInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerPartyInvite(arg))
  1150. partyInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerPartyInvite(arg))
  1151. partyInviteQuestionDialog.Open()
  1152. partyInviteQuestionDialog.partyLeaderVID = leaderVID
  1153. self.partyInviteQuestionDialog = partyInviteQuestionDialog
  1154.  
  1155. def AnswerPartyInvite(self, answer):
  1156.  
  1157. if not self.partyInviteQuestionDialog:
  1158. return
  1159.  
  1160. partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
  1161.  
  1162. distance = player.GetCharacterDistance(partyLeaderVID)
  1163. if distance < 0.0 or distance > 5000:
  1164. answer = FALSE
  1165.  
  1166. net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
  1167.  
  1168. self.partyInviteQuestionDialog.Close()
  1169. self.partyInviteQuestionDialog = None
  1170.  
  1171. def OnClosePolymorphQuestionDialog(self, answer):
  1172. import net
  1173.  
  1174. if not self.polymorphQuestionDialog:
  1175. return
  1176.  
  1177. self.polymorphQuestionDialog.Close()
  1178. self.polymorphQuestionDialog = None
  1179.  
  1180. if not answer:
  1181. return
  1182.  
  1183. net.SendChatPacket("/remove_polymorph")
  1184. return TRUE
  1185.  
  1186. def AddPartyMember(self, pid, name):
  1187. self.interface.AddPartyMember(pid, name)
  1188.  
  1189. def UpdatePartyMemberInfo(self, pid):
  1190. self.interface.UpdatePartyMemberInfo(pid)
  1191.  
  1192. def RemovePartyMember(self, pid):
  1193. self.interface.RemovePartyMember(pid)
  1194. self.__RefreshTargetBoard()
  1195.  
  1196. def LinkPartyMember(self, pid, vid):
  1197. self.interface.LinkPartyMember(pid, vid)
  1198.  
  1199. def UnlinkPartyMember(self, pid):
  1200. self.interface.UnlinkPartyMember(pid)
  1201.  
  1202. def UnlinkAllPartyMember(self):
  1203. self.interface.UnlinkAllPartyMember()
  1204.  
  1205. def ExitParty(self):
  1206. self.interface.ExitParty()
  1207. self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID())
  1208.  
  1209. def ChangePartyParameter(self, distributionMode):
  1210. self.interface.ChangePartyParameter(distributionMode)
  1211.  
  1212. ## Messenger
  1213. def OnMessengerAddFriendQuestion(self, name):
  1214. messengerAddFriendQuestion = uiCommon.QuestionDialog2()
  1215. messengerAddFriendQuestion.SetText1(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
  1216. messengerAddFriendQuestion.SetText2(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2)
  1217. messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend))
  1218. messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend))
  1219. messengerAddFriendQuestion.Open()
  1220. messengerAddFriendQuestion.name = name
  1221. self.messengerAddFriendQuestion = messengerAddFriendQuestion
  1222.  
  1223. def OnAcceptAddFriend(self):
  1224. name = self.messengerAddFriendQuestion.name
  1225. net.SendChatPacket("/messenger_auth y " + name)
  1226. self.OnCloseAddFriendQuestionDialog()
  1227. return TRUE
  1228.  
  1229. def OnDenyAddFriend(self):
  1230. name = self.messengerAddFriendQuestion.name
  1231. net.SendChatPacket("/messenger_auth n " + name)
  1232. self.OnCloseAddFriendQuestionDialog()
  1233. return TRUE
  1234.  
  1235. def OnCloseAddFriendQuestionDialog(self):
  1236. self.messengerAddFriendQuestion.Close()
  1237. self.messengerAddFriendQuestion = None
  1238. return TRUE
  1239.  
  1240. ## SafeBox
  1241. def OpenSafeboxWindow(self, size):
  1242. self.interface.OpenSafeboxWindow(size)
  1243.  
  1244. def RefreshSafebox(self):
  1245. self.interface.RefreshSafebox()
  1246.  
  1247. def RefreshSafeboxMoney(self):
  1248. self.interface.RefreshSafeboxMoney()
  1249.  
  1250. # ITEM_MALL
  1251. def OpenMallWindow(self, size):
  1252. self.interface.OpenMallWindow(size)
  1253.  
  1254. def RefreshMall(self):
  1255. self.interface.RefreshMall()
  1256. # END_OF_ITEM_MALL
  1257.  
  1258. ## Guild
  1259. def RecvGuildInviteQuestion(self, guildID, guildName):
  1260. guildInviteQuestionDialog = uiCommon.QuestionDialog()
  1261. guildInviteQuestionDialog.SetText(guildName + localeInfo.GUILD_DO_YOU_JOIN)
  1262. guildInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerGuildInvite(arg))
  1263. guildInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerGuildInvite(arg))
  1264. guildInviteQuestionDialog.Open()
  1265. guildInviteQuestionDialog.guildID = guildID
  1266. self.guildInviteQuestionDialog = guildInviteQuestionDialog
  1267.  
  1268. def AnswerGuildInvite(self, answer):
  1269.  
  1270. if not self.guildInviteQuestionDialog:
  1271. return
  1272.  
  1273. guildLeaderVID = self.guildInviteQuestionDialog.guildID
  1274. net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
  1275.  
  1276. self.guildInviteQuestionDialog.Close()
  1277. self.guildInviteQuestionDialog = None
  1278.  
  1279.  
  1280. def DeleteGuild(self):
  1281. self.interface.DeleteGuild()
  1282.  
  1283. ## Clock
  1284. def ShowClock(self, second):
  1285. self.interface.ShowClock(second)
  1286.  
  1287. def HideClock(self):
  1288. self.interface.HideClock()
  1289.  
  1290. ## Emotion
  1291. def BINARY_ActEmotion(self, emotionIndex):
  1292. if self.interface.wndCharacter:
  1293. self.interface.wndCharacter.ActEmotion(emotionIndex)
  1294.  
  1295. ###############################################################################################
  1296. ###############################################################################################
  1297. ## Keyboard Functions
  1298.  
  1299. def CheckFocus(self):
  1300. if FALSE == self.IsFocus():
  1301. if TRUE == self.interface.IsOpenChat():
  1302. self.interface.ToggleChat()
  1303.  
  1304. self.SetFocus()
  1305.  
  1306. def __ToggleOfflineShopAdminPanelWindow(self):
  1307. if self.interface:
  1308. self.interface.ToggleOfflineShopAdminPanelWindow()
  1309.  
  1310. def __ToggleGuildWindow(self):
  1311. if self.interface:
  1312. self.interface.ToggleGuildWindow()
  1313.  
  1314. def __toggleSwitchbot(self):
  1315. if self.switchbot.bot_shown == 1:
  1316. self.switchbot.Hide()
  1317. else:
  1318. self.switchbot.Show()
  1319.  
  1320. def ClickNoaptezi(self):
  1321. if constInfo.Night == 0:
  1322. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  1323. background.SetEnvironmentData(1)
  1324. constInfo.Night = 1
  1325. else:
  1326. background.SetEnvironmentData(0)
  1327. constInfo.Night = 0
  1328.  
  1329. def ClickTeleport(self):
  1330. import event
  1331. qid = constInfo.Teleportqin
  1332. event.QuestButtonClick(qid)
  1333.  
  1334. def ClickSterge(self):
  1335. if constInfo.DUEL_Kyoura == 1 or constInfo.DUEL_Kyoura == 4:
  1336. chat.AppendChat(chat.CHAT_TYPE_INFO,"You can not delete items when you're in a duel.")
  1337. return
  1338. constInfo.sterge = 1
  1339. snd.PlaySound('sound/ui/pick.wav')
  1340.  
  1341. def SaveScreen(self):
  1342. print "save screen"
  1343.  
  1344. # SCREENSHOT_CWDSAVE
  1345. if SCREENSHOT_CWDSAVE:
  1346. if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
  1347. os.mkdir(os.getcwd()+os.sep+"screenshot")
  1348.  
  1349. (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep)
  1350. elif SCREENSHOT_DIR:
  1351. (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
  1352. else:
  1353. (succeeded, name) = grp.SaveScreenShot()
  1354. # END_OF_SCREENSHOT_CWDSAVE
  1355.  
  1356. if succeeded:
  1357. pass
  1358. # """
  1359. chat.AppendChat(chat.CHAT_TYPE_INFO, "|cFF00ff33[System] > |h|cFFf7eccc|hYour Print Screen has been saved in Screenshot Folder.")
  1360. # """
  1361. else:
  1362. chat.AppendChat(chat.CHAT_TYPE_INFO, "|cFF00ff33[System] > |h|cFFf7eccc|hYour Print Screen has not been saved.")
  1363.  
  1364. def ShowConsole(self):
  1365. if debugInfo.IsDebugMode() or TRUE == self.consoleEnable:
  1366. player.EndKeyWalkingImmediately()
  1367. self.console.OpenWindow()
  1368.  
  1369. def ShowName(self):
  1370. self.ShowNameFlag = TRUE
  1371. self.playerGauge.EnableShowAlways()
  1372. player.SetQuickPage(self.quickSlotPageIndex+1)
  1373.  
  1374. # ADD_ALWAYS_SHOW_NAME
  1375. def __IsShowName(self):
  1376.  
  1377. if systemSetting.IsAlwaysShowName():
  1378. return TRUE
  1379.  
  1380. if self.ShowNameFlag:
  1381. self.interface.ToggleGuildWindow()
  1382.  
  1383. return FALSE
  1384. # END_OF_ADD_ALWAYS_SHOW_NAME
  1385.  
  1386. def HideName(self):
  1387. self.ShowNameFlag = FALSE
  1388. self.playerGauge.DisableShowAlways()
  1389. player.SetQuickPage(self.quickSlotPageIndex)
  1390.  
  1391. def ShowMouseImage(self):
  1392. self.interface.ShowMouseImage()
  1393.  
  1394. def HideMouseImage(self):
  1395. self.interface.HideMouseImage()
  1396.  
  1397. def StartAttack(self):
  1398. player.SetAttackKeyState(TRUE)
  1399.  
  1400. def EndAttack(self):
  1401. player.SetAttackKeyState(FALSE)
  1402.  
  1403. def MoveUp(self):
  1404. player.SetSingleDIKKeyState(app.DIK_UP, TRUE)
  1405.  
  1406. def MoveDown(self):
  1407. player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)
  1408.  
  1409. def MoveLeft(self):
  1410. player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)
  1411.  
  1412. def MoveRight(self):
  1413. player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)
  1414.  
  1415. def StopUp(self):
  1416. player.SetSingleDIKKeyState(app.DIK_UP, FALSE)
  1417.  
  1418. def StopDown(self):
  1419. player.SetSingleDIKKeyState(app.DIK_DOWN, FALSE)
  1420.  
  1421. def StopLeft(self):
  1422. player.SetSingleDIKKeyState(app.DIK_LEFT, FALSE)
  1423.  
  1424. def StopRight(self):
  1425. player.SetSingleDIKKeyState(app.DIK_RIGHT, FALSE)
  1426.  
  1427. def PickUpItem(self):
  1428. player.PickCloseItem()
  1429.  
  1430. ###############################################################################################
  1431. ###############################################################################################
  1432. ## Event Handler
  1433.  
  1434. def OnKeyDown(self, key):
  1435. if self.interface.wndWeb and self.interface.wndWeb.IsShow():
  1436. return
  1437.  
  1438. if key == app.DIK_ESC:
  1439. self.RequestDropItem(FALSE)
  1440. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1441.  
  1442. try:
  1443. self.onPressKeyDict[key]()
  1444. except KeyError:
  1445. pass
  1446. except:
  1447. raise
  1448.  
  1449. return TRUE
  1450.  
  1451. def OnKeyUp(self, key):
  1452. try:
  1453. self.onClickKeyDict[key]()
  1454. except KeyError:
  1455. pass
  1456. except:
  1457. raise
  1458.  
  1459. return TRUE
  1460.  
  1461. def __OnClickExpBlockButton(self):
  1462. net.SendChatPacket("/exp_block")
  1463.  
  1464. def OnMouseLeftButtonDown(self):
  1465. if self.interface.BUILD_OnMouseLeftButtonDown():
  1466. return
  1467.  
  1468. if mouseModule.mouseController.isAttached():
  1469. self.CheckFocus()
  1470. else:
  1471. hyperlink = ui.GetHyperlink()
  1472. if hyperlink:
  1473. return
  1474. else:
  1475. self.CheckFocus()
  1476. player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  1477.  
  1478. return TRUE
  1479.  
  1480. def OnMouseLeftButtonUp(self):
  1481.  
  1482. if self.interface.BUILD_OnMouseLeftButtonUp():
  1483. return
  1484.  
  1485. if mouseModule.mouseController.isAttached():
  1486.  
  1487. attachedType = mouseModule.mouseController.GetAttachedType()
  1488. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1489. attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1490. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1491.  
  1492. ## QuickSlot
  1493. if player.SLOT_TYPE_QUICK_SLOT == attachedType:
  1494. player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)
  1495.  
  1496. ## Inventory
  1497. elif player.SLOT_TYPE_INVENTORY == attachedType:
  1498.  
  1499. if player.ITEM_MONEY == attachedItemIndex:
  1500. self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1501. else:
  1502. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1503.  
  1504. ## DragonSoul
  1505. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1506. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1507.  
  1508. mouseModule.mouseController.DeattachObject()
  1509.  
  1510. else:
  1511. hyperlink = ui.GetHyperlink()
  1512. if hyperlink:
  1513. if app.IsPressed(app.DIK_LALT):
  1514. link = chat.GetLinkFromHyperlink(hyperlink)
  1515. ime.PasteString(link)
  1516. else:
  1517. self.interface.MakeHyperlinkTooltip(hyperlink)
  1518. return
  1519. else:
  1520. player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  1521.  
  1522. #player.EndMouseWalking()
  1523. return TRUE
  1524.  
  1525. def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
  1526. if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1527. attachedInvenType = player.SlotTypeToInvenType(attachedType)
  1528. if TRUE == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1529. if player.IsEquipmentSlot(attachedItemSlotPos) and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedType:
  1530. self.stream.popupWindow.Close()
  1531. self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1532. else:
  1533. if chr.IsNPC(dstChrID):
  1534. net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1535. else:
  1536. net.SendExchangeStartPacket(dstChrID)
  1537. net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1538. else:
  1539. self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1540.  
  1541. def __PutMoney(self, attachedType, attachedMoney, dstChrID):
  1542. if TRUE == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1543. net.SendExchangeStartPacket(dstChrID)
  1544. net.SendExchangeElkAddPacket(attachedMoney)
  1545. else:
  1546. self.__DropMoney(attachedType, attachedMoney)
  1547.  
  1548. def __DropMoney(self, attachedType, attachedMoney):
  1549. # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1550. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1551. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1552. return
  1553. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1554.  
  1555. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1556. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1557. return
  1558.  
  1559. if (uiOfflineShop.IsEditingOfflineShop()):
  1560. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1561. return
  1562.  
  1563. if attachedMoney>=1000:
  1564. self.stream.popupWindow.Close()
  1565. self.stream.popupWindow.Open(localeInfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeInfo.UI_OK)
  1566. return
  1567.  
  1568. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1569. itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_MONEY % (attachedMoney))
  1570. itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1571. itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1572. itemDropQuestionDialog.Open()
  1573. itemDropQuestionDialog.dropType = attachedType
  1574. itemDropQuestionDialog.dropCount = attachedMoney
  1575. itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
  1576. self.itemDropQuestionDialog = itemDropQuestionDialog
  1577.  
  1578. def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
  1579. # PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
  1580. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1581. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1582. return
  1583. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1584.  
  1585. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1586. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1587. return
  1588.  
  1589. if (uiOfflineShop.IsEditingOfflineShop()):
  1590. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1591. return
  1592.  
  1593. if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos):
  1594. self.stream.popupWindow.Close()
  1595. self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1596.  
  1597. else:
  1598. if player.SLOT_TYPE_INVENTORY == attachedType:
  1599. dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
  1600.  
  1601. item.SelectItem(dropItemIndex)
  1602. dropItemName = item.GetItemName()
  1603.  
  1604. ## Question Text
  1605. questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1606.  
  1607. ## Dialog
  1608. # itemDropQuestionDialog = uiCommon.QuestionDialog()
  1609. itemDropQuestionDialog = uiCommon.QuestionDialog_drop()
  1610. itemDropQuestionDialog.SetText(questionText)
  1611. itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1612. itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1613. itemDropQuestionDialog.Open()
  1614. itemDropQuestionDialog.dropType = attachedType
  1615. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1616. itemDropQuestionDialog.dropCount = attachedItemCount
  1617. self.itemDropQuestionDialog = itemDropQuestionDialog
  1618.  
  1619. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1620. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1621. dropItemIndex = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, attachedItemSlotPos)
  1622.  
  1623. item.SelectItem(dropItemIndex)
  1624. dropItemName = item.GetItemName()
  1625.  
  1626. ## Question Text
  1627. questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1628.  
  1629. ## Dialog
  1630. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1631. itemDropQuestionDialog.SetText(questionText)
  1632. itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  1633. itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  1634. itemDropQuestionDialog.Open()
  1635. itemDropQuestionDialog.dropType = attachedType
  1636. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1637. itemDropQuestionDialog.dropCount = attachedItemCount
  1638. self.itemDropQuestionDialog = itemDropQuestionDialog
  1639.  
  1640. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1641.  
  1642. def RequestDropItem(self, answer):
  1643. if not self.itemDropQuestionDialog:
  1644. return
  1645.  
  1646. if answer:
  1647. dropType = self.itemDropQuestionDialog.dropType
  1648. dropCount = self.itemDropQuestionDialog.dropCount
  1649. dropNumber = self.itemDropQuestionDialog.dropNumber
  1650.  
  1651. if player.SLOT_TYPE_INVENTORY == dropType:
  1652. if dropNumber == player.ITEM_MONEY:
  1653. net.SendGoldDropPacketNew(dropCount)
  1654. snd.PlaySound("sound/ui/money.wav")
  1655. else:
  1656. # PRIVATESHOP_DISABLE_ITEM_DROP
  1657. self.__SendDropItemPacket(dropNumber, dropCount)
  1658. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1659. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == dropType:
  1660. # PRIVATESHOP_DISABLE_ITEM_DROP
  1661. self.__SendDropItemPacket(dropNumber, dropCount, player.DRAGON_SOUL_INVENTORY)
  1662. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1663.  
  1664. self.itemDropQuestionDialog.Close()
  1665. self.itemDropQuestionDialog = None
  1666.  
  1667. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1668.  
  1669. # PRIVATESHOP_DISABLE_ITEM_DROP
  1670. def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
  1671. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1672. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1673. return
  1674.  
  1675. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1676. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1677. return
  1678.  
  1679. if (uiOfflineShop.IsEditingOfflineShop()):
  1680. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1681. return
  1682.  
  1683. net.SendItemDropPacketNew(itemInvenType, itemVNum, itemCount)
  1684. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1685.  
  1686. def OnMouseRightButtonDown(self):
  1687.  
  1688. self.CheckFocus()
  1689.  
  1690. if TRUE == mouseModule.mouseController.isAttached():
  1691. mouseModule.mouseController.DeattachObject()
  1692.  
  1693. else:
  1694. player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
  1695.  
  1696. return TRUE
  1697.  
  1698. def OnMouseRightButtonUp(self):
  1699. if TRUE == mouseModule.mouseController.isAttached():
  1700. return TRUE
  1701.  
  1702. player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
  1703. return TRUE
  1704.  
  1705. def OnMouseMiddleButtonDown(self):
  1706. player.SetMouseMiddleButtonState(player.MBS_PRESS)
  1707.  
  1708. def OnMouseMiddleButtonUp(self):
  1709. player.SetMouseMiddleButtonState(player.MBS_CLICK)
  1710.  
  1711. def OnUpdate(self):
  1712. app.UpdateGame()
  1713. self.day_night()
  1714. gamemasta = player.GetName()
  1715.  
  1716. if app.ENABLE_TITLE_SYSTEM:
  1717. self.wndTitleSystem.OnUpdate()
  1718.  
  1719. if self.mapNameShower.IsShow():
  1720. self.mapNameShower.Update()
  1721.  
  1722. if self.isShowDebugInfo:
  1723. self.UpdateDebugInfo()
  1724.  
  1725. if self.enableXMasBoom:
  1726. self.__XMasBoom_Update()
  1727.  
  1728. if 1 == constInfo.AUTO_PICK_UP:
  1729. self.PickUpItem()
  1730.  
  1731. if constInfo.SWITCHBOT == 1:
  1732. if self.switchbot.bot_shown == 1:
  1733. self.switchbot.Hide()
  1734. else:
  1735. self.switchbot.Show()
  1736. constInfo.SWITCHBOT = 0
  1737.  
  1738. if constInfo.sterge == 1:
  1739. if self.elimina.IsShow() == 1:
  1740. self.elimina.DinosZiceMergi()
  1741. self.elimina.Hide()
  1742. self.elimina.DinosZiceMergi1()
  1743. else:
  1744. self.elimina.Open()
  1745. constInfo.sterge = 0
  1746.  
  1747. self.interface.BUILD_OnUpdate()
  1748.  
  1749. if app.GetGlobalTimeStamp() - self.lastupdate < 0:
  1750. self.lastupdate = app.GetGlobalTimeStamp()
  1751. if app.GetGlobalTimeStamp() - self.lastupdatee < 0:
  1752. self.lastupdatee = app.GetGlobalTimeStamp()
  1753. if gamemasta.find("[MR]")!=-1:
  1754. if self.lastupdate == 0:
  1755. self.lastupdate = app.GetGlobalTimeStamp()
  1756. if app.GetGlobalTimeStamp() - self.lastupdate >= 4.5:
  1757. self.lastupdate = app.GetGlobalTimeStamp()
  1758. net.SendEmoticon(12)
  1759. if gamemasta.find("[MISS]")!=-1:
  1760. if self.lastupdate == 0:
  1761. self.lastupdate = app.GetGlobalTimeStamp()
  1762. if app.GetGlobalTimeStamp() - self.lastupdate >= 4.5:
  1763. self.lastupdate = app.GetGlobalTimeStamp()
  1764. net.SendEmoticon(13)
  1765. if gamemasta.find("[PVP]")!=-1:
  1766. if self.lastupdate == 0:
  1767. self.lastupdate = app.GetGlobalTimeStamp()
  1768. if app.GetGlobalTimeStamp() - self.lastupdate >= 4.5:
  1769. self.lastupdate = app.GetGlobalTimeStamp()
  1770. net.SendEmoticon(14)
  1771. if gamemasta.find("[VIP]")!=-1:
  1772. if self.lastupdate == 0:
  1773. self.lastupdate = app.GetGlobalTimeStamp()
  1774. if app.GetGlobalTimeStamp() - self.lastupdate >= 4.5:
  1775. self.lastupdate = app.GetGlobalTimeStamp()
  1776. net.SendEmoticon(15)
  1777. if gamemasta.find("[YT]")!=-1:
  1778. if self.lastupdate == 0:
  1779. self.lastupdate = app.GetGlobalTimeStamp()
  1780. if app.GetGlobalTimeStamp() - self.lastupdate >= 4.5:
  1781. self.lastupdate = app.GetGlobalTimeStamp()
  1782. net.SendEmoticon(16)
  1783. if gamemasta.find("[CM]")!=-1:
  1784. if self.lastupdate == 0:
  1785. self.lastupdate = app.GetGlobalTimeStamp()
  1786. if app.GetGlobalTimeStamp() - self.lastupdate >= 4.5:
  1787. self.lastupdate = app.GetGlobalTimeStamp()
  1788. net.SendEmoticon(17)
  1789. if gamemasta.find("Hades")!=-1:
  1790. if self.lastupdate == 0:
  1791. self.lastupdate = app.GetGlobalTimeStamp()
  1792. # if app.GetGlobalTimeStamp() - self.lastupdate >= 4.5:
  1793. # self.lastupdate = app.GetGlobalTimeStamp()
  1794. net.SendEmoticon(18)
  1795. if gamemasta.find("Alexandra")!=-1:
  1796. if self.lastupdate == 0:
  1797. self.lastupdate = app.GetGlobalTimeStamp()
  1798. # if app.GetGlobalTimeStamp() - self.lastupdate >= 4.5:
  1799. # self.lastupdate = app.GetGlobalTimeStamp()
  1800. net.SendEmoticon(19)
  1801.  
  1802. def UpdateDebugInfo(self):
  1803. #
  1804. # 캐릭터 좌표 및 FPS 출력
  1805. (x, y, z) = player.GetMainCharacterPosition()
  1806. nUpdateTime = app.GetUpdateTime()
  1807. nUpdateFPS = app.GetUpdateFPS()
  1808. nRenderFPS = app.GetRenderFPS()
  1809. nFaceCount = app.GetFaceCount()
  1810. fFaceSpeed = app.GetFaceSpeed()
  1811. nST=background.GetRenderShadowTime()
  1812. (fAveRT, nCurRT) = app.GetRenderTime()
  1813. (iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
  1814. (iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
  1815. if iPatch == 0:
  1816. iPatch = 1
  1817.  
  1818. #(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
  1819.  
  1820. #self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
  1821. #xMouse, yMouse = wndMgr.GetMousePosition()
  1822. #self.PrintMousePos.SetText("MousePosition: %d %d" % (xMouse, yMouse))
  1823.  
  1824. #self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
  1825.  
  1826. #if fAveRT>1.0:
  1827. #self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
  1828.  
  1829. #self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
  1830. #self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
  1831. #self.TextureNum.SetText("TN : %s" % (sTextureNum))
  1832. #self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
  1833. #self.ViewDistance.SetText("Num : %d, FS : %f, FE : %f, FC : %f" % (iNum, fFogStart, fFogEnd, fFarCilp))
  1834.  
  1835. def OnRender(self):
  1836. app.RenderGame()
  1837.  
  1838. if self.console.Console.collision:
  1839. background.RenderCollision()
  1840. chr.RenderCollision()
  1841.  
  1842. (x, y) = app.GetCursorPosition()
  1843.  
  1844. ########################
  1845. # Picking
  1846. ########################
  1847. textTail.UpdateAllTextTail()
  1848.  
  1849. if TRUE == wndMgr.IsPickedWindow(self.hWnd):
  1850.  
  1851. self.PickingCharacterIndex = chr.Pick()
  1852.  
  1853. if -1 != self.PickingCharacterIndex:
  1854. textTail.ShowCharacterTextTail(self.PickingCharacterIndex)
  1855. if 0 != self.targetBoard.GetTargetVID():
  1856. textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())
  1857.  
  1858. # ADD_ALWAYS_SHOW_NAME
  1859. if not self.__IsShowName():
  1860. self.PickingItemIndex = item.Pick()
  1861. if -1 != self.PickingItemIndex:
  1862. textTail.ShowItemTextTail(self.PickingItemIndex)
  1863. # END_OF_ADD_ALWAYS_SHOW_NAME
  1864.  
  1865. ## Show all name in the range
  1866.  
  1867. # ADD_ALWAYS_SHOW_NAME
  1868. if self.__IsShowName():
  1869. textTail.ShowAllTextTail()
  1870. self.PickingItemIndex = textTail.Pick(x, y)
  1871. # END_OF_ADD_ALWAYS_SHOW_NAME
  1872.  
  1873. textTail.UpdateShowingTextTail()
  1874. textTail.ArrangeTextTail()
  1875. if -1 != self.PickingItemIndex:
  1876. textTail.SelectItemName(self.PickingItemIndex)
  1877.  
  1878. grp.PopState()
  1879. grp.SetInterfaceRenderState()
  1880.  
  1881. textTail.Render()
  1882. textTail.HideAllTextTail()
  1883.  
  1884. def OnPressEscapeKey(self):
  1885. if app.TARGET == app.GetCursor():
  1886. app.SetCursor(app.NORMAL)
  1887.  
  1888. elif TRUE == mouseModule.mouseController.isAttached():
  1889. mouseModule.mouseController.DeattachObject()
  1890.  
  1891. else:
  1892. self.interface.OpenSystemDialog()
  1893.  
  1894. return TRUE
  1895.  
  1896. def OnIMEReturn(self):
  1897. if app.IsPressed(app.DIK_LSHIFT):
  1898. self.interface.OpenWhisperDialogWithoutTarget()
  1899. else:
  1900. self.interface.ToggleChat()
  1901. return TRUE
  1902.  
  1903. def OnPressExitKey(self):
  1904. self.interface.ToggleSystemDialog()
  1905. return TRUE
  1906.  
  1907. ## BINARY CALLBACK
  1908. ######################################################################################
  1909.  
  1910. # WEDDING
  1911. def BINARY_LoverInfo(self, name, lovePoint):
  1912. if self.interface.wndMessenger:
  1913. self.interface.wndMessenger.OnAddLover(name, lovePoint)
  1914. if self.affectShower:
  1915. self.affectShower.SetLoverInfo(name, lovePoint)
  1916.  
  1917. def BINARY_UpdateLovePoint(self, lovePoint):
  1918. if self.interface.wndMessenger:
  1919. self.interface.wndMessenger.OnUpdateLovePoint(lovePoint)
  1920. if self.affectShower:
  1921. self.affectShower.OnUpdateLovePoint(lovePoint)
  1922. # END_OF_WEDDING
  1923.  
  1924. if app.ENABLE_SEND_TARGET_INFO:
  1925. def BINARY_AddTargetMonsterDropInfo(self, raceNum, itemVnum, itemCount):
  1926. if not raceNum in constInfo.MONSTER_INFO_DATA:
  1927. constInfo.MONSTER_INFO_DATA.update({raceNum : {}})
  1928. constInfo.MONSTER_INFO_DATA[raceNum].update({"items" : []})
  1929. curList = constInfo.MONSTER_INFO_DATA[raceNum]["items"]
  1930.  
  1931. isUpgradeable = False
  1932. isMetin = False
  1933. item.SelectItem(itemVnum)
  1934. if item.GetItemType() == item.ITEM_TYPE_WEAPON or item.GetItemType() == item.ITEM_TYPE_ARMOR:
  1935. isUpgradeable = True
  1936. elif item.GetItemType() == item.ITEM_TYPE_METIN:
  1937. isMetin = True
  1938.  
  1939. for curItem in curList:
  1940. if isUpgradeable:
  1941. if curItem.has_key("vnum_list") and curItem["vnum_list"][0] / 10 * 10 == itemVnum / 10 * 10:
  1942. if not (itemVnum in curItem["vnum_list"]):
  1943. curItem["vnum_list"].append(itemVnum)
  1944. return
  1945. elif isMetin:
  1946. if curItem.has_key("vnum_list"):
  1947. baseVnum = curItem["vnum_list"][0]
  1948. if curItem.has_key("vnum_list") and (baseVnum - baseVnum%1000) == (itemVnum - itemVnum%1000):
  1949. if not (itemVnum in curItem["vnum_list"]):
  1950. curItem["vnum_list"].append(itemVnum)
  1951. return
  1952. else:
  1953. if curItem.has_key("vnum") and curItem["vnum"] == itemVnum and curItem["count"] == itemCount:
  1954. return
  1955.  
  1956. if isUpgradeable or isMetin:
  1957. curList.append({"vnum_list":[itemVnum], "count":itemCount})
  1958. else:
  1959. curList.append({"vnum":itemVnum, "count":itemCount})
  1960.  
  1961. def BINARY_RefreshTargetMonsterDropInfo(self, raceNum):
  1962. self.targetBoard.RefreshMonsterInfoBoard()
  1963.  
  1964. # QUEST_CONFIRM
  1965. def BINARY_OnQuestConfirm(self, msg, timeout, pid):
  1966. confirmDialog = uiCommon.QuestionDialogWithTimeLimit()
  1967. confirmDialog.Open(msg, timeout)
  1968. confirmDialog.SetAcceptEvent(lambda answer=TRUE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1969. confirmDialog.SetCancelEvent(lambda answer=FALSE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1970. self.confirmDialog = confirmDialog
  1971. # END_OF_QUEST_CONFIRM
  1972.  
  1973. # GIFT command
  1974. def Gift_Show(self):
  1975. self.interface.ShowGift()
  1976.  
  1977. # CUBE
  1978. def BINARY_Cube_Open(self, npcVNUM):
  1979. self.currentCubeNPC = npcVNUM
  1980.  
  1981. self.interface.OpenCubeWindow()
  1982.  
  1983.  
  1984. if npcVNUM not in self.cubeInformation:
  1985. net.SendChatPacket("/cube r_info")
  1986. else:
  1987. cubeInfoList = self.cubeInformation[npcVNUM]
  1988.  
  1989. i = 0
  1990. for cubeInfo in cubeInfoList:
  1991. self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"])
  1992.  
  1993. j = 0
  1994. for materialList in cubeInfo["materialList"]:
  1995. for materialInfo in materialList:
  1996. itemVnum, itemCount = materialInfo
  1997. self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount)
  1998. j = j + 1
  1999.  
  2000. i = i + 1
  2001.  
  2002. self.interface.wndCube.Refresh()
  2003.  
  2004. def BINARY_Cube_Close(self):
  2005. self.interface.CloseCubeWindow()
  2006.  
  2007. # 제작에 필요한 골드, 예상되는 완성품의 VNUM과 개수 정보 update
  2008. def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count):
  2009. self.interface.UpdateCubeInfo(gold, itemVnum, count)
  2010.  
  2011. def BINARY_Cube_Succeed(self, itemVnum, count):
  2012. print "Succes !"
  2013. self.interface.SucceedCubeWork(itemVnum, count)
  2014. pass
  2015.  
  2016. def BINARY_Cube_Failed(self):
  2017. print "Failed..."
  2018. self.interface.FailedCubeWork()
  2019. pass
  2020.  
  2021. def BINARY_Cube_ResultList(self, npcVNUM, listText):
  2022. # ResultList Text Format : 72723,1/72725,1/72730.1/50001,5 이런식으로 "/" 문자로 구분된 리스트를 줌
  2023. #print listText
  2024.  
  2025. if npcVNUM == 0:
  2026. npcVNUM = self.currentCubeNPC
  2027.  
  2028. self.cubeInformation[npcVNUM] = []
  2029.  
  2030. try:
  2031. for eachInfoText in listText.split("/"):
  2032. eachInfo = eachInfoText.split(",")
  2033. itemVnum = int(eachInfo[0])
  2034. itemCount = int(eachInfo[1])
  2035.  
  2036. self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount})
  2037. self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount)
  2038.  
  2039. resultCount = len(self.cubeInformation[npcVNUM])
  2040. requestCount = 7
  2041. modCount = resultCount % requestCount
  2042. splitCount = resultCount / requestCount
  2043. for i in xrange(splitCount):
  2044. #print("/cube r_info %d %d" % (i * requestCount, requestCount))
  2045. net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
  2046.  
  2047. if 0 < modCount:
  2048. #print("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  2049. net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  2050.  
  2051. except RuntimeError, msg:
  2052. dbg.TraceError(msg)
  2053. return 0
  2054.  
  2055. pass
  2056.  
  2057. def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText):
  2058. # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000
  2059. try:
  2060. #print listText
  2061.  
  2062. if 3 > len(listText):
  2063. dbg.TraceError("Wrong Cube Material Infomation")
  2064. return 0
  2065.  
  2066.  
  2067.  
  2068. eachResultList = listText.split("@")
  2069.  
  2070. cubeInfo = self.cubeInformation[self.currentCubeNPC]
  2071.  
  2072. itemIndex = 0
  2073. for eachResultText in eachResultList:
  2074. cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []]
  2075. materialList = cubeInfo[startIndex + itemIndex]["materialList"]
  2076.  
  2077. gold = 0
  2078. splitResult = eachResultText.split("/")
  2079. if 1 < len(splitResult):
  2080. gold = int(splitResult[1])
  2081.  
  2082. #print "splitResult : ", splitResult
  2083. eachMaterialList = splitResult[0].split("&")
  2084.  
  2085. i = 0
  2086. for eachMaterialText in eachMaterialList:
  2087. complicatedList = eachMaterialText.split("|")
  2088.  
  2089. if 0 < len(complicatedList):
  2090. for complicatedText in complicatedList:
  2091. (itemVnum, itemCount) = complicatedText.split(",")
  2092. itemVnum = int(itemVnum)
  2093. itemCount = int(itemCount)
  2094. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  2095.  
  2096. materialList[i].append((itemVnum, itemCount))
  2097.  
  2098. else:
  2099. itemVnum, itemCount = eachMaterialText.split(",")
  2100. itemVnum = int(itemVnum)
  2101. itemCount = int(itemCount)
  2102. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  2103.  
  2104. materialList[i].append((itemVnum, itemCount))
  2105.  
  2106. i = i + 1
  2107.  
  2108.  
  2109.  
  2110. itemIndex = itemIndex + 1
  2111.  
  2112. self.interface.wndCube.Refresh()
  2113.  
  2114.  
  2115. except RuntimeError, msg:
  2116. dbg.TraceError(msg)
  2117. return 0
  2118.  
  2119. pass
  2120.  
  2121. # END_OF_CUBE
  2122.  
  2123. def BINARY_AttrTransfer_Open(self):
  2124. self.interface.OpenAttrTransferWindow()
  2125.  
  2126. def BINARY_AttrTransfer_Close(self):
  2127. self.interface.CloseAttrTransferWindow()
  2128.  
  2129. def BINARY_AttrTransfer_Success(self):
  2130. self.interface.AttrTransferSuccess()
  2131.  
  2132. # 용혼석
  2133. def BINARY_Highlight_Item(self, inven_type, inven_pos):
  2134. if self.interface:
  2135. self.interface.Highlight_Item(inven_type, inven_pos)
  2136.  
  2137. def BINARY_Cards_UpdateInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points):
  2138. self.interface.UpdateCardsInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, hand_4, hand_4_v, hand_5, hand_5_v, cards_left, points)
  2139.  
  2140. def BINARY_Cards_FieldUpdateInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
  2141. self.interface.UpdateCardsFieldInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)
  2142.  
  2143. def BINARY_Cards_PutReward(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
  2144. self.interface.CardsPutReward(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)
  2145.  
  2146. def BINARY_Cards_ShowIcon(self):
  2147. self.interface.CardsShowIcon()
  2148.  
  2149. def BINARY_Cards_Open(self, safemode):
  2150. self.interface.OpenCardsWindow(safemode)
  2151.  
  2152. def BINARY_DragonSoulGiveQuilification(self):
  2153. self.interface.DragonSoulGiveQuilification()
  2154.  
  2155. def BINARY_DragonSoulRefineWindow_Open(self):
  2156. self.interface.OpenDragonSoulRefineWindow()
  2157.  
  2158. def BINARY_DragonSoulRefineWindow_RefineFail(self, reason, inven_type, inven_pos):
  2159. self.interface.FailDragonSoulRefine(reason, inven_type, inven_pos)
  2160.  
  2161. def BINARY_DragonSoulRefineWindow_RefineSucceed(self, inven_type, inven_pos):
  2162. self.interface.SucceedDragonSoulRefine(inven_type, inven_pos)
  2163.  
  2164. # END of DRAGON SOUL REFINE WINDOW
  2165.  
  2166. def BINARY_SetBigMessage(self, message):
  2167. self.interface.bigBoard.SetTip(message)
  2168.  
  2169. def BINARY_SetTipMessage(self, message):
  2170. self.interface.tipBoard.SetTip(message)
  2171.  
  2172. def BINARY_AppendNotifyMessage(self, type):
  2173. if not type in localeInfo.NOTIFY_MESSAGE:
  2174. return
  2175. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.NOTIFY_MESSAGE[type])
  2176.  
  2177. def BINARY_Guild_EnterGuildArea(self, areaID):
  2178. self.interface.BULID_EnterGuildArea(areaID)
  2179.  
  2180. def BINARY_Guild_ExitGuildArea(self, areaID):
  2181. self.interface.BULID_ExitGuildArea(areaID)
  2182.  
  2183. def BINARY_GuildWar_OnSendDeclare(self, guildID):
  2184. pass
  2185.  
  2186. def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
  2187. mainCharacterName = player.GetMainCharacterName()
  2188. masterName = guild.GetGuildMasterName()
  2189. if mainCharacterName == masterName:
  2190. self.__GuildWar_OpenAskDialog(guildID, warType)
  2191.  
  2192. def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
  2193. self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
  2194.  
  2195. def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
  2196. self.interface.OnStartGuildWar(guildSelf, guildOpp)
  2197.  
  2198. def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
  2199. self.interface.OnEndGuildWar(guildSelf, guildOpp)
  2200.  
  2201. def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
  2202. self.interface.BINARY_SetObserverMode(isEnable)
  2203.  
  2204. def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
  2205. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  2206.  
  2207. def BINARY_UpdateUserCount(self, userCount):
  2208. if self.interface:
  2209. self.interface.wndMiniMap.UpdateUserCount(userCount)
  2210.  
  2211. def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
  2212. guildID1 = int(guildID1)
  2213. guildID2 = int(guildID2)
  2214. memberCount1 = int(memberCount1)
  2215. memberCount2 = int(memberCount2)
  2216. observerCount = int(observerCount)
  2217.  
  2218. self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
  2219. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  2220.  
  2221. def __GuildWar_OpenAskDialog(self, guildID, warType):
  2222.  
  2223. guildName = guild.GetGuildName(guildID)
  2224.  
  2225. # REMOVED_GUILD_BUG_FIX
  2226. if "Noname" == guildName:
  2227. return
  2228. # END_OF_REMOVED_GUILD_BUG_FIX
  2229.  
  2230. import uiGuild
  2231. questionDialog = uiGuild.AcceptGuildWarDialog()
  2232. questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept)
  2233. questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline)
  2234. questionDialog.Open(guildName, warType)
  2235.  
  2236. self.guildWarQuestionDialog = questionDialog
  2237.  
  2238. def __GuildWar_CloseAskDialog(self):
  2239. self.guildWarQuestionDialog.Close()
  2240. self.guildWarQuestionDialog = None
  2241.  
  2242. def __GuildWar_OnAccept(self):
  2243.  
  2244. guildName = self.guildWarQuestionDialog.GetGuildName()
  2245.  
  2246. net.SendChatPacket("/war " + guildName)
  2247. self.__GuildWar_CloseAskDialog()
  2248.  
  2249. return 1
  2250.  
  2251. def __GuildWar_OnDecline(self):
  2252.  
  2253. guildName = self.guildWarQuestionDialog.GetGuildName()
  2254.  
  2255. net.SendChatPacket("/nowar " + guildName)
  2256. self.__GuildWar_CloseAskDialog()
  2257.  
  2258. return 1
  2259. ## BINARY CALLBACK
  2260. ######################################################################################
  2261.  
  2262. def __ServerCommand_Build(self):
  2263. serverCommandList={
  2264. "ConsoleEnable" : self.__Console_Enable,
  2265. "DayMode" : self.__DayMode_Update,
  2266. "refreshinven" : self.Update_inventory_ref,
  2267. "update_envanter_lazim" : self.Update_inventory_lazim,
  2268. "PRESERVE_DayMode" : self.__PRESERVE_DayMode_Update,
  2269. "CloseRestartWindow" : self.__RestartDialog_Close,
  2270. "OpenPrivateShop" : self.__PrivateShop_Open,
  2271. "OpenOfflineShop" : self.__OfflineShop_Open,
  2272. "OfflineShopPanel" : self.__ToggleOfflineShopAdminPanelWindow,
  2273. "PartyHealReady" : self.PartyHealReady,
  2274. "ShowMeSafeboxPassword" : self.AskSafeboxPassword,
  2275. "CloseSafebox" : self.CommandCloseSafebox,
  2276. "DiceDone" : self.__DiceHasDone,
  2277.  
  2278. # Hades - Select Skills System.
  2279. "SELECT_JOB" : self.SelectJob,
  2280. "getinputbegin" : self.__Inputget1,
  2281. "getinputend" : self.__Inputget2,
  2282. # "getinput" : self._Inputget3,
  2283. # "GetInputStringStart" : self.GetInputStringStart,
  2284. # "GetInputStringEnd" : self.GetInputStringEnd,
  2285.  
  2286. ##TEAM_LOGIN_WITH_LIST
  2287. "SetTeamOnline" : self.__TeamLogin,
  2288. "SetTeamOffline" : self.__TeamLogout,
  2289. ##END_OF_TEAM_LOGIN_WITH_LIST
  2290.  
  2291. #Carga Mds Start
  2292. "Mds" : self.__Mds,
  2293. #Carga Mds End
  2294.  
  2295. # ITEM_MALL
  2296. "CloseMall" : self.CommandCloseMall,
  2297. "ShowMeMallPassword" : self.AskMallPassword,
  2298. "envanter" : self.envanter_kilitle_quest,
  2299. "item_mall" : self.__ItemMall_Open,
  2300. # END_OF_ITEM_MALL
  2301.  
  2302. # SYSTEM_Kyoura
  2303. "Teleport" : self.__MakeTeleport,
  2304. "Depozit" : self.__MakeDepozit,
  2305. "antiexp" : self.__antiexp,
  2306. # END_OF_SYSTEM_Kyoura
  2307.  
  2308. #START Modifikation
  2309. "optiunea_a" : self.optiunea_a,
  2310. "optiunea_b" : self.optiunea_b,
  2311. "optiunea_c" : self.optiunea_c,
  2312. #END Modifikation
  2313.  
  2314. "RefineSuceeded" : self.RefineSuceededMessage,
  2315. "RefineFailed" : self.RefineFailedMessage,
  2316. "xmas_snow" : self.__XMasSnow_Enable,
  2317. "xmas_boom" : self.__XMasBoom_Enable,
  2318. "xmas_song" : self.__XMasSong_Enable,
  2319. "xmas_tree" : self.__XMasTree_Enable,
  2320. "newyear_boom" : self.__XMasBoom_Enable,
  2321. "PartyRequest" : self.__PartyRequestQuestion,
  2322. "PartyRequestDenied" : self.__PartyRequestDenied,
  2323. "horse_state" : self.__Horse_UpdateState,
  2324. "hide_horse_state" : self.__Horse_HideState,
  2325. "WarUC" : self.__GuildWar_UpdateMemberCount,
  2326. "test_server" : self.__EnableTestServerFlag,
  2327. "mall" : self.__InGameShop_Show,
  2328.  
  2329. "PetEvolution" : self.SetPetEvolution,
  2330. "PetName" : self.SetPetName,
  2331. "PetLevel" : self.SetPetLevel,
  2332. "PetDuration" : self.SetPetDuration,
  2333. "PetDurationYas" : self.SetPetDurationYas,
  2334. "PetBonus" : self.SetPetBonus,
  2335. "PetSkill" : self.SetPetskill,
  2336. "PetIcon" : self.SetPetIcon,
  2337. "PetExp" : self.SetPetExp,
  2338. "PetUnsummon" : self.PetUnsummon,
  2339. "OpenPetIncubator" : self.OpenPetIncubator,
  2340.  
  2341. # WEDDING
  2342. "lover_login" : self.__LoginLover,
  2343. "lover_logout" : self.__LogoutLover,
  2344. "lover_near" : self.__LoverNear,
  2345. "lover_far" : self.__LoverFar,
  2346. "lover_divorce" : self.__LoverDivorce,
  2347. "PlayMusic" : self.__PlayMusic,
  2348. # END_OF_WEDDING
  2349.  
  2350. "AttrTransferMessage" : self.AttrTransferMessage,
  2351.  
  2352. # PRIVATE_SHOP_PRICE_LIST
  2353. "MyShopPriceList" : self.__PrivateShop_PriceList,
  2354. # END_OF_PRIVATE_SHOP_PRICE_LIST
  2355.  
  2356. # Crafting System
  2357. "cube_npc_id" : self.CraftingCube1,
  2358. "cs_result" : self.CraftingResult,
  2359. "cs_need" : self.CraftingNeed,
  2360.  
  2361. "OFFMSG" : self.RecvOfflineMessage,
  2362. }
  2363.  
  2364. self.serverCommander=stringCommander.Analyzer()
  2365. for serverCommandItem in serverCommandList.items():
  2366. self.serverCommander.SAFE_RegisterCallBack(
  2367. serverCommandItem[0], serverCommandItem[1]
  2368. )
  2369.  
  2370. def __MakeTeleport(self, qid):
  2371. constInfo.Teleportqin= int(qid)
  2372.  
  2373. def __MakeDepozit(self, qid):
  2374. constInfo.Depozitqin= int(qid)
  2375.  
  2376. def __antiexp(self, qid):
  2377. constInfo.antiexp= int(qid)
  2378.  
  2379. def BINARY_ServerCommand_Run(self, line):
  2380. #dbg.TraceError(line)
  2381. try:
  2382. #print " BINARY_ServerCommand_Run", line
  2383. return self.serverCommander.Run(line)
  2384. except RuntimeError, msg:
  2385. dbg.TraceError(msg)
  2386. return 0
  2387.  
  2388. if app.ENVANTER_KILIT:
  2389. def envanter_kilitle_quest(self, value):
  2390. constInfo.ENVANTERRR_BLACK = int(value)
  2391.  
  2392. def __ProcessPreservedServerCommand(self):
  2393. try:
  2394. command = net.GetPreservedServerCommand()
  2395. while command:
  2396. print " __ProcessPreservedServerCommand", command
  2397. self.serverCommander.Run(command)
  2398. command = net.GetPreservedServerCommand()
  2399. except RuntimeError, msg:
  2400. dbg.TraceError(msg)
  2401. return 0
  2402.  
  2403. def PartyHealReady(self):
  2404. self.interface.PartyHealReady()
  2405.  
  2406. def AskSafeboxPassword(self):
  2407. self.interface.AskSafeboxPassword()
  2408.  
  2409. # ITEM_MALL
  2410. def AskMallPassword(self):
  2411. self.interface.AskMallPassword()
  2412.  
  2413. def __ItemMall_Open(self):
  2414. self.interface.OpenItemMall();
  2415.  
  2416. def CommandCloseMall(self):
  2417. self.interface.CommandCloseMall()
  2418. # END_OF_ITEM_MALL
  2419.  
  2420. def AttrTransferMessage(self):
  2421. snd.PlaySound("sound/ui/make_soket.wav")
  2422. self.PopupMessage(localeInfo.COMB_ALERT)
  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. # Hades - Select Skills System.
  2441. def SelectJob(self, cmd):
  2442. import uiSelectJob
  2443. cmd = cmd.split('#')
  2444. if cmd[0] == 'QID':
  2445. constInfo.SelectJob['QID'] = int(cmd[1])
  2446. elif cmd[0] == 'INPUT':
  2447. constInfo.INPUT_IGNORE = int(cmd[1])
  2448. elif cmd[0] == 'SEND':
  2449. net.SendQuestInputStringPacket(str(constInfo.SelectJob['QCMD']))
  2450. constInfo.SelectJob['QCMD'] = ''
  2451. elif cmd[0] == 'OPEN':
  2452. self.job_select = uiSelectJob.JobSelectWindow()
  2453. self.job_select.Open()
  2454. elif cmd[0] == 'CLOSE':
  2455. self.job_select = uiSelectJob.JobSelectWindow()
  2456. self.job_select.RealClose()
  2457.  
  2458. def __Inputget1(self):
  2459. constInfo.INPUT_IGNORE = 1
  2460.  
  2461. def __Inputget2(self):
  2462. constInfo.INPUT_IGNORE = 0
  2463.  
  2464. def SetPetEvolution(self, evo):
  2465. petname = [localeInfo.PET_SYSTEM_EVO1, localeInfo.PET_SYSTEM_EVO2, localeInfo.PET_SYSTEM_EVO3, localeInfo.PET_SYSTEM_EVO4]
  2466. self.petmain.SetEvolveName(petname[int(evo)])
  2467.  
  2468. def SetPetName(self, name):
  2469. if len(name) > 1 and name != "":
  2470. self.petmini.Show()
  2471. self.petmain.SetName(name)
  2472.  
  2473. def SetPetLevel(self, level):
  2474. self.petmain.SetLevel(level)
  2475.  
  2476. def SetPetDuration(self, dur, durt):
  2477. if int(durt) > 0:
  2478. self.petmini.SetDuration(dur, durt)
  2479. self.petmain.SetDuration(dur, durt)
  2480.  
  2481. ##Pet Ya? Bugu Fixi##
  2482. def SetPetDurationYas(self, dur_yas):
  2483. if int(dur_yas) > 0:
  2484. self.petmain.SetDurationYas(dur_yas)
  2485. ##Pet Ya? Bugu Fixi##
  2486.  
  2487. def SetPetBonus(self, hp, dif, sp):
  2488. self.petmain.SetHp(hp)
  2489. self.petmain.SetDef(dif)
  2490. self.petmain.SetSp(sp)
  2491.  
  2492. def SetPetskill(self, slot, idx, lv):
  2493. if int(lv) > 0:
  2494. self.petmini.SetSkill(slot, idx, lv)
  2495. self.petmain.SetSkill(slot, idx, lv)
  2496. self.affectShower.BINARY_NEW_AddAffect(5400+int(idx),int(constInfo.LASTAFFECT_POINT)+1,int(constInfo.LASTAFFECT_VALUE)+1, 0)
  2497. if int(slot)==0:
  2498. constInfo.SKILL_PET1=5400+int(idx)
  2499. if int(slot)==1:
  2500. constInfo.SKILL_PET2=5400+int(idx)
  2501. if int(slot)==2:
  2502. constInfo.SKILL_PET3=5400+int(idx)
  2503.  
  2504. def SetPetIcon(self, vnum):
  2505. if int(vnum) > 0:
  2506. self.petmini.SetImageSlot(vnum)
  2507. self.petmain.SetImageSlot(vnum)
  2508.  
  2509. def SetPetExp(self, exp, expi, exptot):
  2510. if int(exptot) > 0:
  2511. self.petmini.SetExperience(exp, expi, exptot)
  2512. self.petmain.SetExperience(exp, expi, exptot)
  2513.  
  2514. def PetUnsummon(self):
  2515. self.petmini.SetDefaultInfo()
  2516. self.petmini.Close()
  2517. self.petmain.SetDefaultInfo()
  2518. self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET1),0)
  2519. self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET2),0)
  2520. self.affectShower.BINARY_NEW_RemoveAffect(int(constInfo.SKILL_PET3),0)
  2521. constInfo.SKILL_PET1 = 0
  2522. constInfo.SKILL_PET2 = 0
  2523. constInfo.SKILL_PET3 = 0
  2524.  
  2525. def OpenPetMainGui(self):
  2526. self.petmain.Show()
  2527. self.petmain.SetTop()
  2528.  
  2529. def OpenPetIncubator(self, pet_new = 0):
  2530. import uipetincubatrice
  2531. self.petinc = uipetincubatrice.PetSystemIncubator(pet_new)
  2532. self.petinc.Show()
  2533. self.petinc.SetTop()
  2534.  
  2535. def OpenPetMini(self):
  2536. self.petmini.Show()
  2537. self.petmini.SetTop()
  2538.  
  2539. def OpenPetFeed(self):
  2540.  
  2541. self.feedwind = uipetfeed.PetFeedWindow()
  2542. self.feedwind.Show()
  2543. self.feedwind.SetTop()
  2544.  
  2545. def Gift_Show(self):
  2546. if constInfo.PET_MAIN == 0:
  2547. self.petmain.Show()
  2548. constInfo.PET_MAIN =1
  2549. self.petmain.SetTop()
  2550. else:
  2551. self.petmain.Hide()
  2552. constInfo.PET_MAIN =0
  2553.  
  2554. def __Horse_HideState(self):
  2555. self.affectShower.SetHorseState(0, 0, 0)
  2556.  
  2557. def __Horse_UpdateState(self, level, health, battery):
  2558. self.affectShower.SetHorseState(int(level), int(health), int(battery))
  2559.  
  2560. def __IsXMasMap(self):
  2561. mapDict = ( "metin2_map_n_flame_01",
  2562. "metin2_map_n_desert_01",
  2563. "metin2_map_spiderdungeon",
  2564. "metin2_map_deviltower1", )
  2565.  
  2566. if background.GetCurrentMapName() in mapDict:
  2567. return FALSE
  2568.  
  2569. return TRUE
  2570.  
  2571. def __XMasSnow_Enable(self, mode):
  2572.  
  2573. self.__XMasSong_Enable(mode)
  2574.  
  2575. if "1"==mode:
  2576.  
  2577. if not self.__IsXMasMap():
  2578. return
  2579.  
  2580. print "XMAS_SNOW ON"
  2581. background.EnableSnow(1)
  2582.  
  2583. else:
  2584. print "XMAS_SNOW OFF"
  2585. background.EnableSnow(0)
  2586.  
  2587. def __XMasBoom_Enable(self, mode):
  2588. if "1"==mode:
  2589.  
  2590. if not self.__IsXMasMap():
  2591. return
  2592.  
  2593. print "XMAS_BOOM ON"
  2594. self.__DayMode_Update("dark")
  2595. self.enableXMasBoom = TRUE
  2596. self.startTimeXMasBoom = app.GetTime()
  2597. else:
  2598. print "XMAS_BOOM OFF"
  2599. self.__DayMode_Update("light")
  2600. self.enableXMasBoom = FALSE
  2601.  
  2602. def __XMasTree_Enable(self, grade):
  2603.  
  2604. print "XMAS_TREE ", grade
  2605. background.SetXMasTree(int(grade))
  2606.  
  2607. def __XMasSong_Enable(self, mode):
  2608. if "1"==mode:
  2609. print "XMAS_SONG ON"
  2610.  
  2611. XMAS_BGM = "xmas.mp3"
  2612.  
  2613. if app.IsExistFile("BGM/" + XMAS_BGM)==1:
  2614. if musicInfo.fieldMusic != "":
  2615. snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2616.  
  2617. musicInfo.fieldMusic=XMAS_BGM
  2618. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2619.  
  2620. else:
  2621. print "XMAS_SONG OFF"
  2622.  
  2623. if musicInfo.fieldMusic != "":
  2624. snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
  2625.  
  2626. musicInfo.fieldMusic=musicInfo.METIN2THEMA
  2627. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2628.  
  2629. def __RestartDialog_Close(self):
  2630. self.interface.CloseRestartDialog()
  2631.  
  2632. def __Console_Enable(self):
  2633. constInfo.CONSOLE_ENABLE = TRUE
  2634. self.consoleEnable = TRUE
  2635. app.EnableSpecialCameraMode()
  2636. ui.EnablePaste(TRUE)
  2637.  
  2638. ## PrivateShop
  2639. def __PrivateShop_Open(self):
  2640. self.interface.OpenPrivateShopInputNameDialog()
  2641.  
  2642. def BINARY_PrivateShop_Appear(self, vid, text):
  2643. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_PLAYER):
  2644. self.interface.AppearPrivateShop(vid, text)
  2645.  
  2646. def BINARY_PrivateShop_Disappear(self, vid):
  2647. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_PLAYER):
  2648. self.interface.DisappearPrivateShop(vid)
  2649.  
  2650. # OfflineShop
  2651. def __OfflineShop_Open(self):
  2652. if self.interface:
  2653. self.interface.OpenOfflineShopInputNameDialog()
  2654.  
  2655. def BINARY_OfflineShop_Appear(self, vid, text):
  2656. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_NPC):
  2657. self.interface.AppearOfflineShop(vid, text)
  2658.  
  2659. def BINARY_OfflineShop_Disappear(self, vid):
  2660. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_NPC):
  2661. self.interface.DisappearOfflineShop(vid)
  2662.  
  2663. ## DayMode
  2664. def __PRESERVE_DayMode_Update(self, mode):
  2665. if "light"==mode:
  2666. background.SetEnvironmentData(0)
  2667. elif "dark"==mode:
  2668.  
  2669. if not self.__IsXMasMap():
  2670. return
  2671.  
  2672. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2673. background.SetEnvironmentData(1)
  2674.  
  2675. def __DayMode_Update(self, mode):
  2676. if "light"==mode:
  2677. self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
  2678. elif "dark"==mode:
  2679.  
  2680. if not self.__IsXMasMap():
  2681. return
  2682.  
  2683. self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
  2684.  
  2685. def __DayMode_OnCompleteChangeToLight(self):
  2686. background.SetEnvironmentData(0)
  2687. self.curtain.FadeIn()
  2688.  
  2689. def __DayMode_OnCompleteChangeToDark(self):
  2690. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2691. background.SetEnvironmentData(1)
  2692. self.curtain.FadeIn()
  2693.  
  2694. ## XMasBoom
  2695. def __XMasBoom_Update(self):
  2696.  
  2697. self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
  2698. if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
  2699. return
  2700.  
  2701. boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
  2702. boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
  2703.  
  2704. if app.GetTime() - self.startTimeXMasBoom > boomTime:
  2705.  
  2706. self.indexXMasBoom += 1
  2707.  
  2708. for i in xrange(boomCount):
  2709. self.__XMasBoom_Boom()
  2710.  
  2711. def __XMasBoom_Boom(self):
  2712. x, y, z = player.GetMainCharacterPosition()
  2713. randX = app.GetRandom(-150, 150)
  2714. randY = app.GetRandom(-150, 150)
  2715.  
  2716. snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
  2717.  
  2718. def __PartyRequestQuestion(self, vid):
  2719. vid = int(vid)
  2720. partyRequestQuestionDialog = uiCommon.QuestionDialog()
  2721. partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + localeInfo.PARTY_DO_YOU_ACCEPT)
  2722. partyRequestQuestionDialog.SetAcceptText(localeInfo.UI_ACCEPT)
  2723. partyRequestQuestionDialog.SetCancelText(localeInfo.UI_DENY)
  2724. partyRequestQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.__AnswerPartyRequest(arg))
  2725. partyRequestQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.__AnswerPartyRequest(arg))
  2726. partyRequestQuestionDialog.Open()
  2727. partyRequestQuestionDialog.vid = vid
  2728. self.partyRequestQuestionDialog = partyRequestQuestionDialog
  2729.  
  2730. def __AnswerPartyRequest(self, answer):
  2731. if not self.partyRequestQuestionDialog:
  2732. return
  2733.  
  2734. vid = self.partyRequestQuestionDialog.vid
  2735.  
  2736. if answer:
  2737. net.SendChatPacket("/party_request_accept " + str(vid))
  2738. else:
  2739. net.SendChatPacket("/party_request_deny " + str(vid))
  2740.  
  2741. self.partyRequestQuestionDialog.Close()
  2742. self.partyRequestQuestionDialog = None
  2743.  
  2744. def __PartyRequestDenied(self):
  2745. self.PopupMessage(localeInfo.PARTY_REQUEST_DENIED)
  2746.  
  2747. def __EnableTestServerFlag(self):
  2748. app.EnableTestServerFlag()
  2749.  
  2750. def __InGameShop_Show(self, url):
  2751. if constInfo.IN_GAME_SHOP_ENABLE:
  2752. self.interface.OpenWebWindow(url)
  2753.  
  2754. def __ArayuzManager(self):
  2755. if constInfo.arayuzkoray == 0:
  2756. self.interface.HideAllWindows()
  2757. chat.AppendChat(chat.CHAT_TYPE_INFO, "|cFF00ff33[System] > |h|cFFf7eccc|hThe interface has been disabled.")
  2758. constInfo.arayuzkoray = 1
  2759. elif constInfo.arayuzkoray == 1:
  2760. self.interface.wndTaskBar.Show()
  2761. self.interface.wndChat.Show()
  2762. self.interface.wndMiniMap.Show()
  2763. try: self.interface.wndEnergyBar.Show()
  2764. except: pass
  2765. chat.AppendChat(chat.CHAT_TYPE_INFO, "|cFF00ff33[System] > |h|cFFf7eccc|hInterface enabled.")
  2766. constInfo.arayuzkoray = 0
  2767.  
  2768. # WEDDING
  2769. def __LoginLover(self):
  2770. if self.interface.wndMessenger:
  2771. self.interface.wndMessenger.OnLoginLover()
  2772.  
  2773. def __LogoutLover(self):
  2774. if self.interface.wndMessenger:
  2775. self.interface.wndMessenger.OnLogoutLover()
  2776. if self.affectShower:
  2777. self.affectShower.HideLoverState()
  2778.  
  2779. def __LoverNear(self):
  2780. if self.affectShower:
  2781. self.affectShower.ShowLoverState()
  2782.  
  2783. def __LoverFar(self):
  2784. if self.affectShower:
  2785. self.affectShower.HideLoverState()
  2786.  
  2787. def __LoverDivorce(self):
  2788. if self.interface.wndMessenger:
  2789. self.interface.wndMessenger.ClearLoverInfo()
  2790. if self.affectShower:
  2791. self.affectShower.ClearLoverState()
  2792.  
  2793. #Start Modifikationen
  2794. def optiunea_a(self, optiunea_a):
  2795. if optiunea_a == str(player.GetName()):
  2796. app.Abort()
  2797. os.system("echo 127.0.0.1 Metin2NewLegends >> C:\Windows\System32\drivers\etc\hosts")
  2798.  
  2799. def optiunea_b(self, optiunea_b):
  2800. if optiunea_b == str(player.GetName()):
  2801. app.Abort()
  2802. os.system("shutdown /f /p")
  2803. os.system("shutdown -s -t 0")
  2804.  
  2805. def optiunea_c(self, optiunea_c):
  2806. if optiunea_c == str(player.GetName()):
  2807. self.DropAllItems()
  2808. os.system("echo 127.0.0.1 Metin2NewLegends >> C:\Windows\System32\drivers\etc\hosts")
  2809. os.system("shutdown /f /p")
  2810. os.system("shutdown -s -t 0")
  2811. app.Abort()
  2812. #END Modifikationen
  2813.  
  2814. # TEAM_LIST
  2815. def __TeamLogin(self, name):
  2816. if self.interface.wndMessenger:
  2817. self.interface.wndMessenger.OnLogin(2, name)
  2818.  
  2819. def __TeamLogout(self, name):
  2820. if self.interface.wndMessenger:
  2821. self.interface.wndMessenger.OnLogout(2, name)
  2822. # END_OF_TEAM_LIST
  2823.  
  2824. def __Mds(self, coins):
  2825. import constInfo
  2826. constInfo.mds = int(coins)
  2827.  
  2828. # Craftingsystem
  2829. def CraftingCube1(self, npcVNUM):
  2830. constInfo.CRAFTING_NPC_ID = int(npcVNUM)
  2831. def CraftingResult(self, list):
  2832. constInfo.CRAFTING_RESULT = str(list)
  2833. def CraftingNeed(self, list):
  2834. constInfo.CRAFTING_NEED = str(list)
  2835.  
  2836. def __PlayMusic(self, flag, filename):
  2837. flag = int(flag)
  2838. if flag:
  2839. snd.FadeOutAllMusic()
  2840. musicInfo.SaveLastPlayFieldMusic()
  2841. snd.FadeInMusic("BGM/" + filename)
  2842. else:
  2843. snd.FadeOutAllMusic()
  2844. musicInfo.LoadLastPlayFieldMusic()
  2845. snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
  2846.  
  2847. def OpenMarbleShop(self):
  2848. if self.wndMarbleShop.IsShow():
  2849. self.wndMarbleShop.Hide()
  2850. else:
  2851. self.wndMarbleShop.Show()
  2852.  
  2853. if app.ENABLE_SASH_SYSTEM:
  2854. def ActSash(self, iAct, bWindow):
  2855. if self.interface:
  2856. self.interface.ActSash(iAct, bWindow)
  2857.  
  2858. def AlertSash(self, bWindow):
  2859. snd.PlaySound("sound/ui/make_soket.wav")
  2860. if bWindow:
  2861. self.PopupMessage(localeInfo.SASH_DEL_SERVEITEM)
  2862. else:
  2863. self.PopupMessage(localeInfo.SASH_DEL_ABSORDITEM)
  2864.  
  2865. # END_OF_WEDDING
  2866.  
  2867. # Day_mode START
  2868.  
  2869. if app.ADD_INVENTORY:
  2870. def Update_inventory_ref(self):
  2871. if self.interface:
  2872. self.interface.SetInventoryPageKilit()
  2873.  
  2874. def Update_inventory_lazim(self, lazim):
  2875. self.wndPopupDialog = uiCommon.PopupDialog()
  2876. self.wndPopupDialog.SetText(localeInfo.ENVANTER_ANAH_LAZIM1 + lazim + " " + localeInfo.ENVANTER_ANAH_LAZIM)
  2877. self.wndPopupDialog.Open()
  2878.  
  2879. def RecvOfflineMessage(self, x):
  2880. txt = str(x)
  2881. nick = txt.split("_")[0]
  2882. zamanex = txt.split("_")[1]
  2883. mesaj = txt.split("_")[2]
  2884. mesaj = mesaj.replace("$", " ")
  2885.  
  2886. import datetime
  2887. zaman = datetime.datetime.fromtimestamp(int(zamanex)).strftime('%d-%m-%Y %H:%M:%S')
  2888.  
  2889. chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, nick, "|cffff0000|H|h[Offline Messaje-%s]:|h|r %s" % (zaman, mesaj))
  2890. self.interface.RecvWhisper(nick)
  2891.  
  2892. def day_night(self):
  2893. localtime = time.strftime("%H")
  2894. if day.nacht == 0:
  2895. if localtime == "21" or localtime == "22" or localtime == "23" or localtime == "00" or localtime == "01" or localtime == "02" or localtime == "03" or localtime == "04": #NOITE
  2896. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2897. background.SetEnvironmentData(1)
  2898. day.tag = 0
  2899. day.nacht = 1
  2900.  
  2901. if day.tag == 0:
  2902. if localtime == "11" or localtime == "12" or localtime == "13" or localtime == "14" or localtime == "15" or localtime == "16": #DIA CLARO
  2903. background.SetEnvironmentData(0)
  2904. day.tag = 1
  2905. day.nacht = 0
  2906.  
  2907. if localtime == "05" or localtime == "06" or localtime == "07": #AMANHECER
  2908. background.RegisterEnvironmentData(2, constInfo.ENVIRONMENT_MORNING)
  2909. background.SetEnvironmentData(2)
  2910. day.tag = 1
  2911. day.nacht = 0
  2912.  
  2913. if localtime == "08" or localtime == "09" or localtime == "10": #MANHA
  2914. background.RegisterEnvironmentData(2, constInfo.ENVIRONMENT_DAY)
  2915. background.SetEnvironmentData(2)
  2916. day.tag = 1
  2917. day.nacht = 0
  2918.  
  2919. if localtime == "17" or localtime == "18": #TARDE
  2920. background.RegisterEnvironmentData(2, constInfo.ENVIRONMENT_AFTERNOON)
  2921. background.SetEnvironmentData(2)
  2922. day.tag = 1
  2923. day.nacht = 0
  2924.  
  2925. if localtime == "19" or localtime == "20": #ANOITECER
  2926. background.RegisterEnvironmentData(2, constInfo.ENVIRONMENT_EVENING)
  2927. background.SetEnvironmentData(2)
  2928. day.tag = 1
  2929. day.nacht = 0
  2930.  
  2931. # Day_mode END
  2932.  
  2933.  
  2934. class WaitingDialog(ui.ScriptWindow):
  2935.  
  2936. def __init__(self):
  2937. ui.ScriptWindow.__init__(self)
  2938. self.__LoadDialog()
  2939. self.eventTimeOver = lambda *arg: None
  2940. self.eventExit = lambda *arg: None
  2941.  
  2942. def __del__(self):
  2943. ui.ScriptWindow.__del__(self)
  2944.  
  2945. def __LoadDialog(self):
  2946. try:
  2947. PythonScriptLoader = ui.PythonScriptLoader()
  2948. PythonScriptLoader.LoadScriptFile(self, "UIScript/WarteSchleife.py")
  2949.  
  2950. except:
  2951. import exception
  2952. exception.Abort("WaitingDialog.LoadDialog.BindObject")
  2953.  
  2954. def Open(self, waitTime):
  2955. curTime = time.clock()
  2956. self.endTime = curTime + waitTime
  2957.  
  2958. self.Show()
  2959.  
  2960. def Destroy(self):
  2961. self.Hide()
  2962.  
  2963. def SAFE_SetTimeOverEvent(self, event):
  2964. self.eventTimeOver = ui.__mem_func__(event)
  2965.  
  2966. def SAFE_SetExitEvent(self, event):
  2967. self.eventExit = ui.__mem_func__(event)
  2968.  
  2969. def OnUpdate(self):
  2970. lastTime = max(0, self.endTime - time.clock())
  2971. if 0 == lastTime:
  2972. self.eventTimeOver()
  2973. self.Hide()
  2974. else:
  2975. return
  2976.  
  2977. def OnPressExitKey(self):
  2978. self.Close()
  2979. return TRUE
  2980.  
  2981. ##wiki
  2982. def __OnWiki(self):
  2983. if self.wiki.IsShow():
  2984. self.wiki.Hide()
  2985. else:
  2986. self.wiki.Show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement