Advertisement
Guest User

game

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