Guest User

game.py - team online

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