Guest User

Untitled

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