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

1468 diye aratırsanız ekledim #